Skip to content

🕵️‍♂️ (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.

refactor __main__

Vamatoc25989c457b7
diff --git a/tests/test_orchestrator.py b/tests/test_orchestrator.py
index 15e6dd3..418c525 100644
--- a/tests/test_orchestrator.py
+++ b/tests/test_orchestrator.py
@@ -43,7 +43,7 @@ def test_run_module_single_prints_json_and_csv(capsys):
setattr(module, "validate_testsite", validate_testsite)
- orchestrator.run_module_single(module, "bob")
+ orchestrator.run_user_module(module, "bob")
out = capsys.readouterr().out
assert 'bob' in out #Needs to be improved
@@ -63,7 +63,7 @@ def test_run_checks_category_threaded(monkeypatch, tmp_path):
monkeypatch.setattr(orchestrator, "load_modules", lambda p: [module])
monkeypatch.setattr(orchestrator, "get_site_name", lambda m: "Testsite")
- results = orchestrator.run_checks_category(tmp_path, "someone")
+ results = orchestrator.run_user_category(tmp_path, "someone")
assert isinstance(results, list)
assert len(results) == 1
assert results[0].to_number() == 0 # TAKEN
diff --git a/user_scanner/__main__.py b/user_scanner/__main__.py
index 63b409c..d4a97d9 100644
--- a/user_scanner/__main__.py
+++ b/user_scanner/__main__.py
@@ -3,10 +3,8 @@ import time
import sys
import re
from colorama import Fore, Style
-from typing import List
from user_scanner.cli.banner import print_banner
-from user_scanner.core.result import Result
from user_scanner.core.version import load_local_version
from user_scanner.core import formatter
from user_scanner.utils.updater_logic import check_for_updates
@@ -16,15 +14,14 @@ from user_scanner.core.helpers import (
load_categories,
load_modules,
find_module,
- is_last_value,
get_site_name
)
from user_scanner.core.orchestrator import (
generate_permutations,
- run_checks,
- run_checks_category,
- run_module_single
+ run_user_full,
+ run_user_category,
+ run_user_module
)
from user_scanner.core.email_orchestrator import (
@@ -130,55 +127,42 @@ def main():
results = []
- if is_email:
- if args.module:
- modules = find_module(args.module, is_email=True)
- if modules:
- for module in modules:
- results.extend(run_email_module_batch(module, targets))
- else:
- print(
- R + f"[!] Email module '{args.module}' not found." + Style.RESET_ALL)
- elif args.category:
- cat_path = load_categories(is_email=True).get(args.category)
- if cat_path:
- results.extend(run_email_category_batch(cat_path, targets))
- else:
- print(
- R + f"[!] Email category '{args.category}' not found." + Style.RESET_ALL)
+ for i, target in enumerate(targets):
+ if i != 0 and args.delay:
+ time.sleep(args.delay)
+
+ if is_email:
+ print(f"\n{Fore.CYAN} Checking email: {target}{Style.RESET_ALL}")
else:
- results = run_email_full_batch(targets)
- else:
- def run_all_targets(func, arg=None) -> List[Result]:
- all_results = []
- for i, name in enumerate(targets):
- is_last = is_last_value(targets, i)
- res = func(name) if arg is None else func(arg, name)
- if isinstance(res, list):
- all_results.extend(res)
- else:
- all_results.append(res)
- if args.delay > 0 and not is_last:
- time.sleep(args.delay)
- return all_results
+ print(f"\n{Fore.CYAN} Checking username: {target}{Style.RESET_ALL}")
if args.module:
- modules = find_module(args.module, is_email=False)
+ modules = find_module(args.module, is_email)
+ fn = run_email_module_batch if is_email else run_user_module
if modules:
- for mod in modules:
- results.extend(run_all_targets(run_module_single, mod))
+ for module in modules:
+ results.extend(fn(module, target))
else:
print(
- R + f"[!] Module '{args.module}' not found." + Style.RESET_ALL)
+ R +
+ f"[!] {'Email' if is_email else 'User'} module '{args.module}' not found." +
+ Style.RESET_ALL
+ )
+
elif args.category:
- cat_path = load_categories(is_email=False).get(args.category)
+ cat_path = load_categories(is_email).get(args.category)
+ fn = run_email_category_batch if is_email else run_user_category
if cat_path:
- results.extend(run_all_targets(run_checks_category, cat_path))
+ results.extend(fn(cat_path, target))
else:
print(
- R + f"[!] Category '{args.category}' not found." + Style.RESET_ALL)
+ R +
+ f"[!] {'Email' if is_email else 'User'} category '{args.module}' not found." +
+ Style.RESET_ALL
+ )
else:
- results = run_all_targets(run_checks)
+ fn = run_email_full_batch if is_email else run_user_full
+ results.extend(fn(target))
if args.output:
if args.format == "console":
diff --git a/user_scanner/core/email_orchestrator.py b/user_scanner/core/email_orchestrator.py
index 9b42bff..77dceb7 100644
--- a/user_scanner/core/email_orchestrator.py
+++ b/user_scanner/core/email_orchestrator.py
@@ -41,31 +41,30 @@ async def _async_worker(module: ModuleType, email: str, sem: asyncio.Semaphore)
return result
-async def _run_batch(modules: List[ModuleType], emails: List[str]) -> List[Result]:
+async def _run_batch(modules: List[ModuleType], email:str) -> List[Result]:
sem = asyncio.Semaphore(MAX_CONCURRENT_REQUESTS)
tasks = []
for module in modules:
- for email in emails:
- tasks.append(_async_worker(module, email, sem))
+ tasks.append(_async_worker(module, email, sem))
if not tasks:
return []
return list(await asyncio.gather(*tasks))
-def run_email_module_batch(module: ModuleType, emails: List[str]) -> List[Result]:
- return asyncio.run(_run_batch([module], emails))
+def run_email_module_batch(module: ModuleType, email: str) -> List[Result]:
+ return asyncio.run(_run_batch([module], email))
-def run_email_category_batch(category_path: Path, emails: List[str]) -> List[Result]:
- cat_name = category_path.name.upper()
+def run_email_category_batch(category_path: Path, email: str) -> List[Result]:
+ cat_name = category_path.stem.capitalize()
print(f"\n{Fore.MAGENTA}== {cat_name} SITES =={Style.RESET_ALL}")
modules = load_modules(category_path)
- return asyncio.run(_run_batch(modules, emails))
+ return asyncio.run(_run_batch(modules, email))
-def run_email_full_batch(emails: List[str]) -> List[Result]:
+def run_email_full_batch(email: str) -> List[Result]:
categories = load_categories(is_email=True)
all_results = []
@@ -73,7 +72,7 @@ def run_email_full_batch(emails: List[str]) -> List[Result]:
print(f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}")
modules = load_modules(cat_path)
- cat_results = asyncio.run(_run_batch(modules, emails))
+ cat_results = asyncio.run(_run_batch(modules, email))
all_results.extend(cat_results)
return all_results
diff --git a/user_scanner/core/orchestrator.py b/user_scanner/core/orchestrator.py
index 3cea3b0..cebefe5 100644
--- a/user_scanner/core/orchestrator.py
+++ b/user_scanner/core/orchestrator.py
@@ -5,10 +5,11 @@ import httpx
from pathlib import Path
from user_scanner.core.result import Result
from typing import Callable, List
+from types import ModuleType
from user_scanner.core.helpers import find_category, get_site_name, load_categories, load_modules
-def worker_single(module, username: str) -> Result:
+def _worker_single(module: ModuleType, username: str) -> Result:
func = next((getattr(module, f) for f in dir(module)
if f.startswith("validate_") and callable(getattr(module, f))), None)
@@ -23,10 +24,9 @@ def worker_single(module, username: str) -> Result:
return result
except Exception as e:
return Result.error(e, site_name=site_name, username=username)
-
-
-def run_module_single(module, username: str) -> List[Result]:
- result = worker_single(module, username)
+
+def run_user_module(module: ModuleType, username: str) -> List[Result]:
+ result = _worker_single(module, username)
category = find_category(module)
if category:
@@ -37,16 +37,15 @@ def run_module_single(module, username: str) -> List[Result]:
return [result]
-def run_checks_category(category_path: Path, username: str) -> List[Result]:
- modules = load_modules(category_path)
-
+def run_user_category(category_path: Path, username: str) -> List[Result]:
category_name = category_path.stem.capitalize()
print(f"\n{Fore.MAGENTA}== {category_name} SITES =={Style.RESET_ALL}")
results = []
+ modules = load_modules(category_path)
with ThreadPoolExecutor(max_workers=10) as executor:
- exec_map = executor.map(lambda m: worker_single(m, username), modules)
+ exec_map = executor.map(lambda m: _worker_single(m, username), modules)
for result in exec_map:
result.update(category=category_name)
results.append(result)
@@ -56,15 +55,12 @@ def run_checks_category(category_path: Path, username: str) -> List[Result]:
return results
-def run_checks(username: str) -> List[Result]:
-
- print(f"\n{Fore.CYAN} Checking username: {username}{Style.RESET_ALL}")
-
+def run_user_full(username: str) -> List[Result]:
results = []
categories = list(load_categories().values())
for category_path in categories:
- temp = run_checks_category(category_path, username)
+ temp = run_user_category(category_path, username)
results.extend(temp)
return results
diff --git a/user_scanner/email_scan/social/mastodon.py b/user_scanner/email_scan/social/mastodon.py
index 217a8e2..0685438 100644
--- a/user_scanner/email_scan/social/mastodon.py
+++ b/user_scanner/email_scan/social/mastodon.py
@@ -46,7 +46,7 @@ async def _check(email):
return Result.available()
except Exception as e:
- return Result.error(str(e))
+ return Result.error(e)
def validate_mastodon(email: str) -> Result:
diff --git a/user_scanner/email_scan/social/x.py b/user_scanner/email_scan/social/x.py
index 2a3599c..9033a1e 100644
--- a/user_scanner/email_scan/social/x.py
+++ b/user_scanner/email_scan/social/x.py
@@ -32,7 +32,8 @@ async def _check(email):
return Result.available()
except Exception as e:
- return Result.error(str(e))
+ return Result.error(e)
+
def validate_x(email: str) -> Result:
return _check(email)