π΅οΈββοΈ (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
move generate_permutations into helpers.py
Vamato080c1fff5cd1
diff --git a/tests/test_helpers.py b/tests/test_helpers.pynew file mode 100644index 0000000..bd46eec--- /dev/null+++ b/tests/test_helpers.py@@ -0,0 +1,34 @@+from user_scanner.core import helpers+from types import SimpleNamespace++def test_generate_permutations():+ perms = helpers.generate_permutations("user", "ab", limit=None)+ assert "user" in perms+ # All permutations must be valid+ assert all(+ p == "user" or+ (p.startswith("user") and len(p) > len("user"))+ for p in perms+ )++ assert len(perms) > 1++def test_generate_permutations_email():+ perms = helpers.generate_permutations("[email protected]", "abc", limit=None, is_email=True)+ assert "[email protected]" in perms+ assert all(+ p == "[email protected]" or+ (p.startswith("john") and len(p) > len("[email protected]") and p.endswith("@email.com"))+ for p in perms+ )+ assert len(perms) > 1++def test_get_site_name():+ def module(name:str) -> SimpleNamespace:+ return SimpleNamespace(**{"__name__":name})+ assert helpers.get_site_name(module("X")) == "X (Twitter)"+ assert helpers.get_site_name(module("x")) == "X (Twitter)"+ assert helpers.get_site_name(module("user_scanner.github")) == "Github"+ assert helpers.get_site_name(module("user_scanner.chess_com")) == "Chess.com"++diff --git a/tests/test_orchestrator.py b/tests/test_orchestrator.pyindex 418c525..7b1b3c4 100644--- a/tests/test_orchestrator.py+++ b/tests/test_orchestrator.py@@ -12,28 +12,6 @@ def test_status_validate_available(monkeypatch):assert res.to_number() == 1 # AVAILABLE-def test_generate_permutations():- perms = orchestrator.generate_permutations("user", "ab", limit=None)- assert "user" in perms- # All permutations must be valid- assert all(- p == "user" or- (p.startswith("user") and len(p) > len("user"))- for p in perms- )-- assert len(perms) > 1--def test_generate_permutations_email():- perms = orchestrator.generate_permutations("[email protected]", "abc", limit=None, is_email=True)- assert "[email protected]" in perms- assert all(- p == "[email protected]" or- (p.startswith("john") and len(p) > len("[email protected]") and p.endswith("@email.com"))- for p in perms- )- assert len(perms) > 1-def test_run_module_single_prints_json_and_csv(capsys):module = types.ModuleType("fake.testsite")module.__file__ = "<in-memory>/fake/testsite.py"diff --git a/user_scanner/__main__.py b/user_scanner/__main__.pyindex d4a97d9..7485511 100644--- a/user_scanner/__main__.py+++ b/user_scanner/__main__.py@@ -14,11 +14,11 @@ from user_scanner.core.helpers import (load_categories,load_modules,find_module,- get_site_name+ get_site_name,+ generate_permutations)from user_scanner.core.orchestrator import (- generate_permutations,run_user_full,run_user_category,run_user_modulediff --git a/user_scanner/core/helpers.py b/user_scanner/core/helpers.pyindex 6d9327d..5ba6959 100644--- a/user_scanner/core/helpers.py+++ b/user_scanner/core/helpers.py@@ -1,16 +1,18 @@-# helpers.pyimport importlibimport importlib.util+from itertools import permutationsfrom types import ModuleTypefrom pathlib import Pathfrom typing import Dict, List+def get_site_name(module) -> str:name = module.__name__.split('.')[-1].capitalize().replace("_", ".")if name == "X":return "X (Twitter)"return name+def load_modules(category_path: Path) -> List[ModuleType]:modules = []for file in category_path.glob("*.py"):@@ -64,5 +66,30 @@ def find_category(module: ModuleType) -> str | None:return None-def is_last_value(values, i: int) -> bool:- return i == len(values) - 1+def generate_permutations(username: str, pattern: str, limit: int | None = None, is_email: bool = False) -> List[str]:+ """+ Generate all order-based permutations of characters in `pattern`+ appended after `username`.+ """++ if limit and limit <= 0:+ return []++ permutations_set = {username}+ chars = list(pattern)++ domain = ""+ if is_email:+ username, domain = username.strip().split("@")++ # generate permutations of length 1 β len(chars)+ for r in range(len(chars)):+ for combo in permutations(chars, r):+ new = username + ''.join(combo)+ if is_email:+ new += "@" + domain+ permutations_set.add(new)+ if limit and len(permutations_set) >= limit:+ return sorted(permutations_set)++ return sorted(permutations_set)diff --git a/user_scanner/core/orchestrator.py b/user_scanner/core/orchestrator.pyindex cebefe5..cec1f9f 100644--- a/user_scanner/core/orchestrator.py+++ b/user_scanner/core/orchestrator.py@@ -1,6 +1,5 @@from colorama import Fore, Stylefrom concurrent.futures import ThreadPoolExecutor-from itertools import permutationsimport httpxfrom pathlib import Pathfrom user_scanner.core.result import Result@@ -120,32 +119,3 @@ def status_validate(url: str, available: int | List[int], taken: int | List[int]return Result.error("Status didn't match. Report this on Github.")return generic_validate(url, inner, **kwargs)---def generate_permutations(username: str, pattern: str, limit: int | None = None, is_email: bool = False) -> List[str]:- """- Generate all order-based permutations of characters in `pattern`- appended after `username`.- """-- if limit and limit <= 0:- return []-- permutations_set = {username}- chars = list(pattern)-- domain = ""- if is_email:- username, domain = username.strip().split("@")-- # generate permutations of length 1 β len(chars)- for r in range(len(chars)):- for combo in permutations(chars, r):- new = username + ''.join(combo)- if is_email:- new += "@" + domain- permutations_set.add(new)- if limit and len(permutations_set) >= limit:- return sorted(permutations_set)-- return sorted(permutations_set)