🕵️♂️ (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: Result stores data; Output file
Vamatobf79eade98a5
diff --git a/README.md b/README.mdindex 8605c40..89085d7 100644--- a/README.md+++ b/README.md@@ -51,12 +51,13 @@ user-scanner -l # Lists all available modulesuser-scanner -u <username> -m github```-Also, the output format can be specified: <br>+Also, the output file and format can be specified: <br>\* Errors and warnings will only appear when the format is set to "console"```bash-user-scanner -u <username> -o console #Default format-user-scanner -u <username> -o csv-user-scanner -u <username> -o json+user-scanner -u <username> -f console #Default format+user-scanner -u <username> -f csv+user-scanner -u <username> -f json+user-scanner -u <username> -o <output-file>```Generate multiple username variations by appending a suffix:diff --git a/user_scanner/__main__.py b/user_scanner/__main__.pyindex eeff161..414dabc 100644--- a/user_scanner/__main__.py+++ b/user_scanner/__main__.py@@ -2,9 +2,12 @@ import argparseimport timeimport refrom user_scanner.cli import printer-from user_scanner.core.orchestrator import load_modules , generate_permutations, load_categories+from user_scanner.core.orchestrator import generate_permutations, load_categoriesfrom colorama import Fore, Stylefrom user_scanner.cli.banner import print_banner+from typing import List+from user_scanner.core.result import Result+from user_scanner.core.utils import is_last_valueMAX_PERMUTATIONS_LIMIT = 100 # To prevent excessive generation@@ -42,12 +45,16 @@ def main():)parser.add_argument(- "-o", "--output-format", choices=["console", "csv", "json"], default="console", help="Specify output format (default: console)"+ "-f", "--format", choices=["console", "csv", "json"], default="console", help="Specify the output format (default: console)"+ )++ parser.add_argument(+ "-o", "--output", type=str, help="Specify the output file")args = parser.parse_args()- Printer = printer.Printer(args.output_format)+ Printer = printer.Printer(args.format)if args.list:Printer.print_modules(args.category)@@ -89,21 +96,26 @@ def main():if args.module and "." in args.module:args.module = args.module.replace(".", "_")- def run_all_usernames(func, arg = None):+ def run_all_usernames(func, arg = None) -> List[Result]:"""Executes a function for all given usernames.Made in order to simplify main()"""- Printer.print_start()+ results = []+ print(Printer.get_start())for i, name in enumerate(usernames):is_last = i == len(usernames) - 1if arg == None:- func(name, Printer, is_last)+ results.extend(func(name, Printer, is_last))else:- func(arg, name, Printer, is_last)+ results.extend(func(arg, name, Printer, is_last))if args.delay > 0 and not is_last:time.sleep(args.delay)- Printer.print_end()+ if Printer.is_json:+ print(Printer.get_end())+ return results++ results = []if args.module:# Single module search across all categories@@ -112,7 +124,7 @@ def main():if len(modules) > 0:for module in modules:- run_all_usernames(run_module_single, module)+ results.extend(run_all_usernames(run_module_single, module))else:print(Fore.RED + f"[!] Module '{args.module}' not found in any category." + Style.RESET_ALL)@@ -121,12 +133,35 @@ def main():# Category-wise scancategory_package = load_categories().get(args.category)from user_scanner.core.orchestrator import run_checks_category- run_all_usernames(run_checks_category, category_package)+ results = run_all_usernames(run_checks_category, category_package)else:# Full scanfrom user_scanner.core.orchestrator import run_checks- run_all_usernames(run_checks)+ results = run_all_usernames(run_checks)++ if not args.output:+ return++ if args.output and Printer.is_console:+ msg = (+ "\n[!] The console format cannot be "+ f"written to file: '{args.output}'."+ )+ print(Fore.RED + msg + Style.RESET_ALL)+ return++ content = Printer.get_start()++ for i,result in enumerate(results):+ char = "" if Printer.is_csv or is_last_value(results, i) else ","+ content += "\n" + Printer.get_result_output(result) + char++ if Printer.is_json:+ content += "\n" + Printer.get_end()++ with open(args.output, "a", encoding="utf-8") as f:+ f.write(content)if __name__ == "__main__":diff --git a/user_scanner/cli/printer.py b/user_scanner/cli/printer.pyindex ea641ff..69c5b83 100644--- a/user_scanner/cli/printer.py+++ b/user_scanner/cli/printer.py@@ -3,23 +3,7 @@ from typing import Literalfrom user_scanner.core.result import Result, StatusINDENT = " "--JSON_TEMPLATE = """{{-\t"site_name": "{site_name}",-\t"username": "{username}",-\t"result": "{result}"-}}""".replace("\t", INDENT)--JSON_TEMPLATE_ERROR = """{{-\t"site_name": "{site_name}",-\t"username": "{username}",-\t"result": "Error",-\t"reason": "{reason}"-}}""".replace("\t", INDENT)---CSV_HEADER = "site_name,username,result,reason"-CSV_TEMPLATE = "{site_name},{username},{result},{reason}"+CSV_HEADER = "username,category,site_name,status,url,reason"def indentate(msg: str, indent: int):@@ -30,10 +14,10 @@ def indentate(msg: str, indent: int):class Printer:- def __init__(self, output_format: Literal["console", "csv", "json"]) -> None:- if not output_format in ["console", "csv", "json"]:- raise ValueError(f"Invalid output-format: {output_format}")- self.mode: str = output_format+ def __init__(self, format: Literal["console", "csv", "json"]) -> None:+ if not format in ["console", "csv", "json"]:+ raise ValueError(f"Invalid output-format: {format}")+ self.mode: str = formatself.indent: int = 0@property@@ -48,25 +32,23 @@ class Printer:def is_json(self) -> bool:return self.mode == "json"- def print_start(self, json_char: str = "[") -> None:+ def get_start(self, json_char: str = "[") -> str:if self.is_json:self.indent += 1- print(indentate(json_char, self.indent - 1))+ return indentate(json_char, self.indent - 1)elif self.is_csv:- print(CSV_HEADER)+ return CSV_HEADER- def print_end(self, json_char: str = "]") -> None:+ def get_end(self, json_char: str = "]") -> str:if not self.is_json:returnself.indent = max(self.indent - 1, 0)- print(indentate(json_char, self.indent))-- def get_result_output(self, site_name: str, username: str, result: Result) -> str:- if result == None:- result = Result.error("Invalid return value: None")+ return indentate(json_char, self.indent)- if isinstance(result, int):- result = Result.from_number(result)+ def get_result_output(self, result: Result) -> str:+ #In principle result should always have this+ site_name = result.site_name+ username = result.usernamematch (result.status, self.mode):case (Status.AVAILABLE, "console"):@@ -81,27 +63,11 @@ class Printer:reason = f" ({result.get_reason()})"return f"{INDENT}{Fore.YELLOW}[!] {site_name} ({username}): Error{reason}{Style.RESET_ALL}"- case (Status.AVAILABLE, "json") | (Status.TAKEN, "json"):- return indentate(JSON_TEMPLATE, self.indent).format(- site_name=site_name,- username=username,- result=str(result.status)- )-- case (Status.ERROR, "json"):- return indentate(JSON_TEMPLATE_ERROR, self.indent).format(- site_name=site_name,- username=username,- reason=result.get_reason()- )+ case (_, "json"):+ return indentate(result.to_json().replace("\t", INDENT), self.indent)case (_, "csv"):- return CSV_TEMPLATE.format(- site_name=site_name,- username=username,- result=str(result.status),- reason=result.get_reason()- )+ return result.to_csv()return ""@@ -112,7 +78,7 @@ class Printer:# Print the startif self.is_json:- self.print_start("{")+ print(self.get_start("{"))elif self.is_csv:print("category,site_name")@@ -126,7 +92,7 @@ class Printer:print(Fore.MAGENTA +f"\n== {cat_name.upper()} SITES =={Style.RESET_ALL}")case "json":- self.print_start(f"\"{cat_name}\": [")+ print(self.get_start(f"\"{cat_name}\": ["))for j, module in enumerate(modules):is_last = j == len(modules) - 1@@ -144,7 +110,7 @@ class Printer:if self.is_json:is_last = i == len(categories_to_list) - 1- self.print_end("]" if is_last else "],")+ print(self.get_end("]" if is_last else "],"))if self.is_json:- self.print_end("}")+ print(self.get_end("}"))diff --git a/user_scanner/core/orchestrator.py b/user_scanner/core/orchestrator.pyindex de71e7e..13775e8 100644--- a/user_scanner/core/orchestrator.py+++ b/user_scanner/core/orchestrator.py@@ -57,34 +57,34 @@ def worker_single(module, username: str) -> Result:site_name = get_site_name(module)if not func:- return Result.error(f"{site_name} has no validate_ function")+ return Result.error(f"{site_name} has no validate_ function", site_name=site_name, username=username)try:- return func(username)+ result: Result = func(username)+ result.update(site_name=site_name, username=username)+ return resultexcept Exception as e:- return Result.error(e)+ return Result.error(e, site_name=site_name, username=username)-def run_module_single(module, username: str, printer: Printer, last: bool = True) -> Result:+def run_module_single(module, username: str, printer: Printer, last: bool = True) -> List[Result]:# Just executes as if it was a threadresult = worker_single(module, username)site_name = get_site_name(module)- msg = printer.get_result_output(- site_name, username, result- )+ msg = printer.get_result_output(result)if last == False and printer.is_json:msg += ","print(msg)- return result+ return [result]def run_checks_category(category_path: Path, username: str, printer: Printer, last: bool = True) -> List[Result]:modules = load_modules(category_path)+ category_name = category_path.stem.capitalize()if printer.is_console:- category_name = category_path.stem.capitalize()print(f"\n{Fore.MAGENTA}== {category_name} SITES =={Style.RESET_ALL}")results = []@@ -92,13 +92,12 @@ def run_checks_category(category_path: Path, username: str, printer: Printer, lawith ThreadPoolExecutor(max_workers=10) as executor:exec_map = executor.map(lambda m: worker_single(m, username), modules)for i, result in enumerate(exec_map):+ result.update(category = category_name)results.append(result)is_last = last and is_last_value(modules, i)site_name = get_site_name(modules[i])- msg = printer.get_result_output(- site_name, username, result- )+ msg = printer.get_result_output(result)if is_last == False and printer.is_json:msg += ","print(msg)@@ -144,9 +143,11 @@ def generic_validate(url: str, func: Callable[[httpx.Response], AnyResult], **kw"""try:response = make_get_request(url, **kwargs)- return func(response)+ result = func(response)+ result.url = url+ return resultexcept Exception as e:- return Result.error(e)+ return Result.error(e, url=url)def status_validate(url: str, available: int | List[int], taken: int | List[int], **kwargs) -> Result:diff --git a/user_scanner/core/result.py b/user_scanner/core/result.pyindex 15365a3..ca3dd56 100644--- a/user_scanner/core/result.py+++ b/user_scanner/core/result.py@@ -1,6 +1,26 @@from enum import Enumfrom typing import Literal+DEBUG_MSG = """Result {{+ status: {status},+ reason: "{reason}",+ username: "{username}",+ site_name: "{site_name}",+ category: "{category}",+ url: "{url}",+}}"""++JSON_TEMPLATE = """{{+\t"username": "{username}",+\t"category": "{category}",+\t"site_name": "{site_name}",+\t"status": "{status}",+\t"url": "{url}",+\t"reason": "{reason}"+}}"""++CSV_TEMPLATE = "{username},{category},{site_name},{status},{url},{reason}"+def humanize_exception(e: Exception) -> str:msg = str(e).lower()@@ -23,21 +43,32 @@ class Status(Enum):class Result:- def __init__(self, status: Status, reason: str | Exception | None = None):+ def __init__(self, status: Status, reason: str | Exception | None = None, **kwargs):self.status = statusself.reason = reason+ self.username = None+ self.site_name = None+ self.category = None+ self.url = None+ self.update(**kwargs)++ def update(self, **kwargs):+ for field in ("username", "site_name", "category", "url"):+ if field in kwargs and kwargs[field] is not None:+ setattr(self, field, kwargs[field])+@classmethod- def taken(cls):- return cls(Status.TAKEN)+ def taken(cls, **kwargs):+ return cls(Status.TAKEN, **kwargs)@classmethod- def available(cls):- return cls(Status.AVAILABLE)+ def available(cls, **kwargs):+ return cls(Status.AVAILABLE, **kwargs)@classmethod- def error(cls, reason: str | Exception | None = None):- return cls(Status.ERROR, reason)+ def error(cls, reason: str | Exception | None = None, **kwargs):+ return cls(Status.ERROR, reason, **kwargs)@classmethoddef from_number(cls, i: int, reason: str | Exception | None = None):@@ -59,10 +90,29 @@ class Result:return ""if isinstance(self.reason, str):return self.reason- #Format the exception+ # Format the exceptionmsg = humanize_exception(self.reason)return f"{type(self.reason).__name__}: {msg.capitalize()}"+ def as_dict(self) -> dict:+ return {+ "status": self.status,+ "reason": self.get_reason(),+ "username": self.username,+ "site_name": self.site_name,+ "category": self.category,+ "url": self.url+ }++ def debug(self) -> str:+ return DEBUG_MSG.format(**self.as_dict())++ def to_json(self) -> str:+ return JSON_TEMPLATE.format(**self.as_dict())++ def to_csv(self) -> str:+ return CSV_TEMPLATE.format(**self.as_dict())+def __str__(self):return self.get_reason()diff --git a/user_scanner/creator/hashnode.py b/user_scanner/creator/hashnode.pyindex 4087ab7..0a532d3 100644--- a/user_scanner/creator/hashnode.py+++ b/user_scanner/creator/hashnode.py@@ -26,17 +26,17 @@ def validate_hashnode(user):if 'status' in data:if data['status'] == 1:- return Result.available()+ return Result.available(url=url)elif data['status'] == 0:- return Result.taken()+ return Result.taken(url=url)- return Result.error("Status not found")+ return Result.error("Status not found", url=url)else:- return Result.error("Invalid status code")+ return Result.error("Invalid status code", url=url)except Exception as e:- return Result.error(e)+ return Result.error(e, url=url)if __name__ == "__main__":diff --git a/user_scanner/social/discord.py b/user_scanner/social/discord.pyindex d4938b7..17ed9a6 100644--- a/user_scanner/social/discord.py+++ b/user_scanner/social/discord.py@@ -20,12 +20,12 @@ def validate_discord(user):if response.status_code == 200:status = response.json().get("taken")if status is True:- return Result.taken()+ return Result.taken(url=url)elif status is False:- return Result.available()- return Result.error("Invalid status code")+ return Result.available(url=url)+ return Result.error("Invalid status code",url=url)except Exception as e:- return Result.error(e)+ return Result.error(e,url=url)if __name__ == "__main__":