π΅οΈββοΈ (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
Improve extra's functionality (#351)
Vamato34b99016a776
diff --git a/README.md b/README.mdindex 71d2003..f07f4e6 100644--- a/README.md+++ b/README.md@@ -132,15 +132,26 @@ asyncio.run(main())Output:```json-{- "email": "[email protected]",- "category": "Shopping",- "site_name": "Etsy",- "status": "Registered",- "url": "https://www.etsy.com",- "extra": "ID: 98832\nName: test123\nUsername: test123\nGender: private\nIs Seller: No\nHas Public Page: No\nStats: 0 followers | 0 following | 0 favorites\nPrivacy: Items are Public | Shops are Public\nJoined: 2010-09-19 09:34:06\nLast Profile Update: 2020-07-31 06:10:24\nAvatar: https://i.etsystatic.com/site-assets/images/avatars/default_avatar.png?width=400",- "reason": ""+ "email": "[email protected]",+ "category": "Shopping",+ "site_name": "Etsy",+ "status": "Registered",+ "url": "https://www.etsy.com",+ "extra": {+ "id": 98832,+ "name": "test123",+ "username": "test123",+ "gender": "private",+ "is_seller": "No",+ "has_public_page": "No",+ "stats": "0 followers | 0 following | 0 favorites",+ "privacy": "Items are Public | Shops are Public",+ "joined": "2010-09-19 05:04:06",+ "last_profile_update": "2020-07-31 01:40:24",+ "avatar": "https://i.etsystatic.com/site-assets/images/avatars/default_avatar.png?width=400"+ },+ "reason": ""}```---diff --git a/tests/test_result.py b/tests/test_result.pyindex 267a80c..0df3843 100644--- a/tests/test_result.py+++ b/tests/test_result.py@@ -92,14 +92,14 @@ def test_update_and_fields():res = Result.available()assert res.username is Noneassert res.url == ""- assert res.extra == ""+ assert res.extra == {}res.update(username="alice",site_name="GitHub",category="Social",url="https://github.com/alice",- extra="Verified",+ extra={"status": "Verified"},is_email=False,)@@ -107,7 +107,7 @@ def test_update_and_fields():assert res.site_name == "GitHub"assert res.category == "Social"assert res.url == "https://github.com/alice"- assert res.extra == "Verified"+ assert res.extra.get("status") == "Verified"def test_output_formats():@@ -116,20 +116,23 @@ def test_output_formats():site_name="Example",category="Tech",url="https://example.com/user",- extra="Additional info",+ extra={"Additional info:": "smth"},)d = res.as_dict()assert d["url"] == "https://example.com/user"- assert d["extra"] == "Additional info"+ assert d["extra"] == {"additional_info": "smth"}assert d["status"] == "Found"- assert res.to_csv() == "testuser,Tech,Example,Found,https://example.com/user,Additional info,"+ assert (+ res.to_csv()+ == "testuser,Tech,Example,Found,https://example.com/user,additional_info: smth,"+ )json_std = res.to_json()assert '"username": "testuser"' in json_stdassert '"url": "https://example.com/user"' in json_std- assert '"extra": "Additional info"' in json_std+ assert '"extra":{\n"additional_info":"smth"\n}' in json_std.replace(" ", "")res.update(is_email=True)json_email = res.to_json()@@ -141,17 +144,19 @@ def test_console_output_and_show_url():conf = ScanConfig()v_conf = ScanConfig(verbose=True)- res = Result.taken(site_name="MySite", url="https://mysite.com/u", extra="Info")+ res = Result.taken(+ site_name="MySite", url="https://mysite.com/u", extra={"info": "smth"}+ )out_hidden = res.get_console_output(conf)assert "[β]" in out_hiddenassert "Found" in out_hidden- assert "Info" in out_hidden+ assert "info: smth" in out_hiddenassert "https://mysite.com" not in out_hiddenout_visible = res.get_console_output(v_conf)assert "[https://mysite.com/u]" in out_visible- assert "Info" in out_visible+ assert "info: smth" in out_visibleres_skip = Result.skipped(site_name="PrivacySite")output = res_skip.get_console_output(conf)@@ -160,10 +165,12 @@ def test_console_output_and_show_url():def test_debug_string():- res = Result.available(username="dev", url="http://dev.link", extra="Debug info")+ res = Result.available(+ username="dev", url="http://dev.link", extra={"mode": "Debug info"}+ )debug_str = res.debug()assert 'url: "http://dev.link"' in debug_str- assert 'extra: "Debug info"' in debug_str+ assert "extra: \"{'mode': 'Debug info'}\"" in debug_strassert "status: Not Found" in debug_strdiff --git a/user_scanner/core/formatter.py b/user_scanner/core/formatter.pyindex 0abcdee..6b2f273 100644--- a/user_scanner/core/formatter.py+++ b/user_scanner/core/formatter.py@@ -1,10 +1,10 @@import jsonfrom typing import List-from user_scanner.core.result import CSV_TEMPLATE, Result+from user_scanner.core.result import CSV_FIELDS, ResultINDENT = " "-CSV_HEADER = CSV_TEMPLATE.replace("{", "").replace("}", "")+CSV_HEADER = ",".join(CSV_FIELDS)def indentate(msg: str, indent: int):diff --git a/user_scanner/core/result.py b/user_scanner/core/result.pyindex 0d51deb..c6294ec 100644--- a/user_scanner/core/result.py+++ b/user_scanner/core/result.py@@ -1,3 +1,5 @@+import csv+import ioimport jsonfrom enum import Enumfrom colorama import Fore, Style@@ -15,19 +17,9 @@ DEBUG_MSG = """Result {{is_email: "{is_email}"}}"""-# Added "url": "{url}" to the JSON template-JSON_TEMPLATE = """{{-\t"username": "{username}",-\t"category": "{category}",-\t"site_name": "{site_name}",-\t"status": "{status}",-\t"url": "{url}",-\t"extra": "{extra}",-\t"reason": "{reason}"-}}"""# Added {url} to the CSV template-CSV_TEMPLATE = "{username},{category},{site_name},{status},{url},{extra},{reason}"+CSV_FIELDS = ["username", "category", "site_name", "status", "url", "extra", "reason"]def humanize_exception(e: Exception) -> str:@@ -74,15 +66,30 @@ class Result:self.site_name = Noneself.category = Noneself.url = "" # Initialized url field- self.extra = ""+ self.extra: dict[str, str | bool | int] = {}self.is_email = Falseself.update(**kwargs)def update(self, **kwargs):# Added "url" to the list of fields allowed for dynamic updates- for field in ("username", "site_name", "category", "is_email", "url", "extra"):+ for field in ("username", "site_name", "category", "is_email", "url"):if field in kwargs and kwargs[field] is not None:setattr(self, field, kwargs[field])++ if "extra" in kwargs and isinstance(kwargs["extra"], dict):+ for key, value in kwargs["extra"].items():+ if value is None or (isinstance(value, str) and not value.strip()):+ continue++ clean_key = key.strip().rstrip(":").strip().replace(" ", "_").lower()+ if not clean_key:+ continue++ if not isinstance(value, (bool, int)):+ value = str(value)++ self.extra[clean_key] = value+return self@classmethod@@ -153,33 +160,29 @@ class Result:return DEBUG_MSG.format(**self.as_dict())def to_json(self) -> str:- data = self.as_dict()-- if data.get("extra"):- # use json.dumps to get a perfectly escaped string, then strip the surrounding quotes- data["extra"] = json.dumps(str(data["extra"]))[1:-1]- else:- data["extra"] = ""-- msg = JSON_TEMPLATE.format(**data)- if self.is_email:- msg = msg.replace('\t"username":', '\t"email":')- return msg-+ data = self.to_dict()+ return json.dumps(data, indent=4)def to_csv(self) -> str:+ # uses .as_dict() since header has "username"data = self.as_dict()# flatten multiline extra string parameters so it doesn't break row alignmentsif data.get("extra"):- # swap real newlines out for a clean inline separator- clean_extra = str(data["extra"]).replace("\n", "; ")- # normalize whitespace sequences- data["extra"] = " ".join(clean_extra.split())+ clean_extra = ""+ for key, value in data["extra"].items():+ clean_extra += f"{key}: {value}; "++ data["extra"] = clean_extra.rstrip("; ")else:data["extra"] = ""- return CSV_TEMPLATE.format(**data)+ del data["is_email"]+ output = io.StringIO()+ writer = csv.DictWriter(output, fieldnames=CSV_FIELDS, lineterminator="")+ writer.writerow(data)++ return output.getvalue()def __str__(self):return self.get_reason()@@ -228,19 +231,10 @@ class Result:# dynamic extra layout handling logicextra_display = ""- if self.extra:- # cast to string just in case, and split by newline or custom delimiter- extra_str = str(self.extra)-- # clean up empty lines and split by newline- extra_lines = [line.strip() for line in extra_str.split("\n") if line.strip()]-- # draw a tree link for each line- formatted_lines = []- for line in extra_lines:- formatted_lines.append(f"\n{' ' * 6}{Fore.CYAN}βββ {line}")+ for i, (key, value) in enumerate(self.extra.items()):+ connector = "βββ" if i == len(self.extra) - 1 else "βββ"+ extra_display += f"\n{' ' * 6}{Fore.CYAN}{connector} {key}: {value}"- extra_display = "".join(formatted_lines)reason = f" ({self.get_reason()})" if self.has_reason() else ""return f" {color}{icon} {site_name}{url_display} {username}: {status_text}{reason}{extra_display}{Style.RESET_ALL}"diff --git a/user_scanner/email_scan/learning/allen.py b/user_scanner/email_scan/learning/allen.pyindex 56698d1..e201178 100644--- a/user_scanner/email_scan/learning/allen.py+++ b/user_scanner/email_scan/learning/allen.py@@ -43,7 +43,9 @@ async def _check(email: str) -> Result:breakif masked_phone:- return Result.taken(url=show_url, extra=f"Phone: +91{masked_phone}")+ return Result.taken(+ url=show_url, extra={"phone": f"+91{masked_phone}"}+ )return Result.taken(url=show_url)# status 200 + "Invalid email" means not registereddiff --git a/user_scanner/email_scan/learning/vedantu.py b/user_scanner/email_scan/learning/vedantu.pyindex 43f7b0d..b16138b 100644--- a/user_scanner/email_scan/learning/vedantu.py+++ b/user_scanner/email_scan/learning/vedantu.py@@ -50,11 +50,7 @@ async def _check(email: str) -> Result:# Primary check using the emailExists keyif data.get("emailExists") is True:- masked_phone = data.get("phone")- if masked_phone:- # Passing the masked phone number to the result- return Result.taken(url=show_url, extra=f"Phone: {masked_phone}")- return Result.taken(url=show_url)+ return Result.taken(url=show_url, extra={"phone": data.get("phone")})elif data.get("emailExists") is False:return Result.available(url=show_url)diff --git a/user_scanner/email_scan/news/indiatimes.py b/user_scanner/email_scan/news/indiatimes.pyindex 979efdc..e301518 100644--- a/user_scanner/email_scan/news/indiatimes.py+++ b/user_scanner/email_scan/news/indiatimes.py@@ -37,7 +37,7 @@ async def _check(email: str) -> Result:elif user_status == "UNREGISTERED_EMAIL":return Result.available(url=show_url)elif user_status == "UNVERIFIED_EMAIL":- return Result.taken(url=show_url, extra="However email is not verified on the site")+ return Result.taken(url=show_url, extra={"email": "unverified"})return Result.error("Unexpected response body, report it on github")diff --git a/user_scanner/email_scan/shopping/etsy.py b/user_scanner/email_scan/shopping/etsy.pyindex 03dfe84..f742cc0 100644--- a/user_scanner/email_scan/shopping/etsy.py+++ b/user_scanner/email_scan/shopping/etsy.py@@ -67,31 +67,34 @@ async def _check(email: str) -> Result:created = data.get("create_date")updated = data.get("update_date")- date_created = datetime.fromtimestamp(created).strftime('%Y-%m-%d %H:%M:%S') if created else "Unknown"- date_updated = datetime.fromtimestamp(updated).strftime('%Y-%m-%d %H:%M:%S') if updated else None-- # Build the full structured list- info_parts = [- f"ID: {user_id}",- f"Name: {real_name}" if real_name else "Name: N/A",- f"Username: {login_name}" if login_name else "Username: N/A",- f"Gender: {gender}" if gender else None,- f"Location: {location}" if location else None,- f"Bio: {bio}" if bio else None,- f"Is Seller: {is_seller}",- f"Has Public Page: {has_page}",- f"Stats: {followers} followers | {following} following | {favs} favorites",- f"Privacy: Items are {fav_items} | Shops are {fav_shops}",- f"Joined: {date_created}",- ]-- if date_updated:- info_parts.append(f"Last Profile Update: {date_updated}")-- info_parts.append(f"Avatar: {pfp}")-- extra_str = "\n".join(filter(None, info_parts))- return Result.taken(url=show_url, extra=extra_str)+ date_created = (+ datetime.fromtimestamp(created).strftime("%Y-%m-%d %H:%M:%S")+ if created+ else "Unknown"+ )+ date_updated = (+ datetime.fromtimestamp(updated).strftime("%Y-%m-%d %H:%M:%S")+ if updated+ else None+ )++ extras = {+ "id": user_id,+ "name": real_name or "N/A",+ "username": login_name or "N/A",+ "gender": gender,+ "location": location,+ "bio": bio,+ "is seller": is_seller,+ "has public page": has_page,+ "stats": f"{followers} followers | {following} following | {favs} favorites",+ "privacy": f"Items are {fav_items} | Shops are {fav_shops}",+ "joined": date_created,+ "last profile update": date_updated,+ "avatar": pfp,+ }++ return Result.taken(url=show_url, extra=extras)return Result.error("Unexpected response body structure")diff --git a/user_scanner/email_scan/shopping/vivino.py b/user_scanner/email_scan/shopping/vivino.pyindex fa71804..94ae701 100644--- a/user_scanner/email_scan/shopping/vivino.py+++ b/user_scanner/email_scan/shopping/vivino.py@@ -41,7 +41,7 @@ async def _check(email: str) -> Result:return Result.taken(url=show_url)if "account has been locked" in error_msg:- return Result.taken(url=show_url, extra="Account is locked by Vivino")+ return Result.taken(url=show_url, extra={"Account status": "locked"})return Result.error(f"Vivino Error: {error_msg}", url=show_url)diff --git a/user_scanner/user_scan/creator/twitch.py b/user_scanner/user_scan/creator/twitch.pyindex ff45e18..bae6003 100644--- a/user_scanner/user_scan/creator/twitch.py+++ b/user_scanner/user_scan/creator/twitch.py@@ -57,7 +57,16 @@ def validate_twitch(user: str) -> Result:typename = user_data.get("__typename")if typename == "User":- return Result.taken()+ extra = {+ "id": user_data.get("id"),+ "description": user_data.get("description"),+ "followers": user_data.get("followers", {}).get("totalCount"),+ }++ for social_media in user_data.get("channel", {}).get("socialMedias"):+ extra[social_media.get("name")] = social_media.get("url")++ return Result.taken(extra=extra)elif typename == "UserDoesNotExist":return Result.available()else:diff --git a/user_scanner/user_scan/gaming/roblox.py b/user_scanner/user_scan/gaming/roblox.pyindex c8983ec..f3de968 100644--- a/user_scanner/user_scan/gaming/roblox.py+++ b/user_scanner/user_scan/gaming/roblox.py@@ -27,7 +27,14 @@ def validate_roblox(user: str) -> Result:for entry in search_results["data"]:# .lower() so casing from the API doesn't matterif entry["name"].lower() == user.lower(): # if a username matches the user- return Result.taken()+ return Result.taken(+ extra={+ "display name": entry.get("displayName"),+ "uid": entry.get("id"),+ "is verified": entry.get("hasVerifiedBadge"),+ }+ )+return Result.available()# First try: Using roblox's APIdiff --git a/user_scanner/user_scan/shopping/vinted.py b/user_scanner/user_scan/shopping/vinted.pyindex 635bb6b..fc8aa8c 100644--- a/user_scanner/user_scan/shopping/vinted.py+++ b/user_scanner/user_scan/shopping/vinted.py@@ -30,9 +30,13 @@ def validate_vinted(user: str):return Result.available()elif user not in search:closest = difflib.get_close_matches(user, search, n=1)- msg = f"closest: {closest[0]}" if closest else None- return Result.available(msg)+ return Result.available(extra={"closest": closest[0] if closest else None})else:- return Result.taken()+ id_search = re.findall(+ rf"www.vinted.pt\/member\/(\d+)-{user}\\", response.text+ )+ return Result.taken(+ extra={"id": id_search[0] if len(id_search) > 0 else None}+ )return generic_validate(url, process, show_url=show_url)