🕵️♂️ (2-in-1) Email & Username OSINT suite featuring native MCP support for deep data extraction just from a single Email/Username. Analyzes 2720+ actively maintained scan vectors (210+ email / 2510+ username) for security research, investigations, and digital footprinting.
Python cybersecuritycybersecurity-toolsemail-osintethical-hackingethical-hacking-toolsidentificationinfosecosintosint-emailosint-toolosint-toolsosint-usernamepentestingpythonredteam-toolsredteamingthreat-intelligence
feat(gravatar): enrich profile metadata extraction (#477)
Kaife3ef0236cbfb
diff --git a/user_scanner/email_scan/social/gravatar.py b/user_scanner/email_scan/social/gravatar.pyindex 77e0090..49131ee 100644--- a/user_scanner/email_scan/social/gravatar.py+++ b/user_scanner/email_scan/social/gravatar.py@@ -1,6 +1,83 @@import hashlibimport httpxfrom user_scanner.core.result import Result++def _extract_profile_data(entry: dict, extra: dict) -> None:+ if entry.get("preferredUsername"):+ extra["username"] = str(entry["preferredUsername"]).strip()+ if entry.get("displayName"):+ extra["display_name"] = str(entry["displayName"]).strip()+ if entry.get("profileUrl"):+ extra["profile_url"] = str(entry["profileUrl"]).strip()+ if entry.get("thumbnailUrl"):+ extra["thumbnail_url"] = str(entry["thumbnailUrl"]).strip()+ if entry.get("aboutMe"):+ extra["bio"] = str(entry["aboutMe"]).strip()+ if entry.get("currentLocation"):+ extra["location"] = str(entry["currentLocation"]).strip()+ if entry.get("jobTitle"):+ extra["job_title"] = str(entry["jobTitle"]).strip()+ if entry.get("company"):+ extra["company"] = str(entry["company"]).strip()++ name_info = entry.get("name")+ if isinstance(name_info, dict) and name_info.get("formatted"):+ extra["full_name"] = str(name_info["formatted"]).strip()++ photos = entry.get("photos")+ if isinstance(photos, list):+ photo_list = [+ str(p["value"]).strip()+ for p in photos+ if isinstance(p, dict) and p.get("value") is not None and str(p["value"]).strip()+ ]+ if photo_list:+ extra["photos"] = ", ".join(photo_list)++ accounts = entry.get("accounts")+ if isinstance(accounts, list):+ acc_list = []+ for acc in accounts:+ if not isinstance(acc, dict):+ continue+ acc_name = str(acc.get("name") or acc.get("shortname") or "Account")+ acc_url = acc.get("url") or acc.get("display") or acc.get("username")+ if acc_url is not None and str(acc_url).strip():+ status = " (verified)" if acc.get("verified") else ""+ acc_list.append(f"{acc_name}: {str(acc_url).strip()}{status}")+ if acc_list:+ extra["verified_accounts"] = ", ".join(acc_list)++ urls = entry.get("urls")+ if isinstance(urls, list):+ url_list = [+ str(u["value"]).strip()+ for u in urls+ if isinstance(u, dict) and u.get("value") is not None and str(u["value"]).strip()+ ]+ if url_list:+ extra["websites"] = ", ".join(url_list)++ emails = entry.get("emails")+ if isinstance(emails, list):+ email_list = [+ str(e["value"]).strip()+ for e in emails+ if isinstance(e, dict) and e.get("value") is not None and str(e["value"]).strip()+ ]+ if email_list:+ extra["public_emails"] = ", ".join(email_list)++ crypto = entry.get("crypto")+ if isinstance(crypto, list):+ crypto_list = [+ f"{str(c.get('currency', 'Wallet'))}: {str(c['value']).strip()}"+ for c in crypto+ if isinstance(c, dict) and c.get("value") is not None and str(c["value"]).strip()+ ]+ if crypto_list:+ extra["crypto_addresses"] = ", ".join(crypto_list)+async def _check(email: str) -> Result:show_url = "https://gravatar.com"email_clean = email.lower().strip()@@ -14,22 +91,18 @@ async def _check(email: str) -> Result:response = await client.get(url, headers=headers)if response.status_code == 200:extra = {"avatar_url": f"https://www.gravatar.com/avatar/{email_hash}"}- # Optionally attempt to load public profile data for enriched metadataprofile_url = f"https://en.gravatar.com/{email_hash}.json"try:profile_resp = await client.get(profile_url, headers=headers, timeout=15.0)if profile_resp.status_code == 200:data = profile_resp.json()- entry = data.get("entry", [{}])[0]- if entry.get("preferredUsername"):- extra["username"] = entry["preferredUsername"]- if entry.get("displayName"):- extra["display_name"] = entry["displayName"]- if entry.get("profileUrl"):- extra["profile_url"] = entry["profileUrl"]+ entries = data.get("entry", [])+ if entries and isinstance(entries, list):+ _extract_profile_data(entries[0], extra)except Exception:pass- return Result.taken(url=show_url, extra=extra)+ final_url = extra.get("profile_url", show_url)+ return Result.taken(url=final_url, extra=extra)elif response.status_code == 404:# Also fall back to check MD5 since some older profiles might only map via MD5email_md5 = hashlib.md5(email_clean.encode("utf-8")).hexdigest()@@ -43,24 +116,22 @@ async def _check(email: str) -> Result:profile_resp = await client.get(profile_url_md5, headers=headers, timeout=15.0)if profile_resp.status_code == 200:data = profile_resp.json()- entry = data.get("entry", [{}])[0]- if entry.get("preferredUsername"):- extra["username"] = entry["preferredUsername"]- if entry.get("displayName"):- extra["display_name"] = entry["displayName"]- if entry.get("profileUrl"):- extra["profile_url"] = entry["profileUrl"]+ entries = data.get("entry", [])+ if entries and isinstance(entries, list):+ _extract_profile_data(entries[0], extra)except Exception:pass- return Result.taken(url=show_url, extra=extra)+ final_url = extra.get("profile_url", show_url)+ return Result.taken(url=final_url, extra=extra)elif response_md5.status_code == 404:return Result.available(url=show_url)else:- return Result.error(f"HTTP MD5 {response_md5.status_code}")- return Result.error(f"HTTP {response.status_code}")+ return Result.error(f"HTTP MD5 {response_md5.status_code}", url=show_url)+ return Result.error(f"HTTP {response.status_code}", url=show_url)except httpx.TimeoutException:- return Result.error("Connection timed out")+ return Result.error("Connection timed out", url=show_url)except Exception as e:- return Result.error(e)+ return Result.error(e, url=show_url)+async def validate_gravatar(email: str) -> Result:return await _check(email)