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: Added ScanConfig

Vamato83b142b4713b
diff --git a/docs/FLAGS.md b/docs/FLAGS.md
index 8c30a64..9a237b0 100644
--- a/docs/FLAGS.md
+++ b/docs/FLAGS.md
@@ -1,21 +1,22 @@
## Important Flags
-| Flag | Description |
-|------|-------------|
-| `-u, --username USERNAME` | Scan a single username across platforms |
-| `-e, --email EMAIL` | Scan a single email across platforms |
-| `-uf, --username-file FILE` | Scan multiple usernames from file (one per line) |
-| `-ef, --email-file FILE` | Scan multiple emails from file (one per line) |
-| `--only-found` | Only show sites where the username/email was found|
-| `-c, --category CATEGORY` | Scan all platforms in a specific category |
-| `-lu, --list-user` | List all available modules for username scanning |
-| `-le, --list-email` | List all available modules for email scanning |
-| `-v, --verbose` | Enable verbose output to show urls of the websites |
-| `-m, --module MODULE` | Scan a single specific module |
-| `-p, --permute PERMUTE` | Generate username permutations using a pattern/suffix |
-| `-P, --proxy-file FILE` | Use proxies from file (one per line) |
-| `--validate-proxies` | Validate proxies before scanning (tests against google.com) |
-| `-s, --stop STOP` | Limit the number of permutations generated |
-| `-d, --delay DELAY` | Delay (in seconds) between requests |
-| `-f, --format {csv,json}` | Select output format |
-| `-o, --output OUTPUT` | Save results to a file |
+| Flag | Description |
+| --------------------------- | ----------------------------------------------------------- |
+| `-u, --username USERNAME` | Scan a single username across platforms |
+| `-e, --email EMAIL` | Scan a single email across platforms |
+| `-uf, --username-file FILE` | Scan multiple usernames from file (one per line) |
+| `-ef, --email-file FILE` | Scan multiple emails from file (one per line) |
+| `--only-found` | Only show sites where the username/email was found |
+| `--allow-loud` | Enable scanning sites that may send emails/notifications |
+| `-c, --category CATEGORY` | Scan all platforms in a specific category |
+| `-lu, --list-user` | List all available modules for username scanning |
+| `-le, --list-email` | List all available modules for email scanning |
+| `-v, --verbose` | Enable verbose output to show urls of the websites |
+| `-m, --module MODULE` | Scan a single specific module |
+| `-p, --permute PERMUTE` | Generate username permutations using a pattern/suffix |
+| `-P, --proxy-file FILE` | Use proxies from file (one per line) |
+| `--validate-proxies` | Validate proxies before scanning (tests against google.com) |
+| `-s, --stop STOP` | Limit the number of permutations generated |
+| `-d, --delay DELAY` | Delay (in seconds) between requests |
+| `-f, --format {csv,json}` | Select output format |
+| `-o, --output OUTPUT` | Save results to a file |
diff --git a/tests/test_formatter.py b/tests/test_formatter.py
index d18731e..8bde034 100644
--- a/tests/test_formatter.py
+++ b/tests/test_formatter.py
@@ -1,4 +1,4 @@
-from user_scanner.core.formatter import into_csv, into_json, indentate, INDENT
+from user_scanner.core.formatter import INDENT, indentate, into_csv, into_json
from user_scanner.core.result import Result
@@ -7,9 +7,11 @@ def test_indentate():
assert indentate("", 0) == ""
assert indentate("", 2) == 2 * INDENT
- msg = ("This is a test message\n"
- "made to test the indentation\n"
- "and shouldn't be changed.")
+ msg = (
+ "This is a test message\n"
+ "made to test the indentation\n"
+ "and shouldn't be changed."
+ )
for i in range(0, 4):
new = indentate(msg, i)
@@ -18,8 +20,7 @@ def test_indentate():
def test_get_result_output_formats():
- res = Result.available(
- username="alice", site_name="ExampleSite", category="Cat")
+ res = Result.available(username="alice", site_name="ExampleSite", category="Cat")
out_console = res.get_console_output()
assert "Not Found" in out_console
diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index 11e041a..d034b8a 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -1,42 +1,53 @@
import sys
+import threading
+from types import SimpleNamespace
+from unittest.mock import MagicMock, patch
+
import pytest
-from user_scanner.core import helpers
+
from user_scanner.__main__ import main
+from user_scanner.core import helpers
from user_scanner.core.result import Result
-from types import SimpleNamespace
-from unittest.mock import MagicMock, patch
-import threading
+
def test_generate_permutations():
- perms = helpers.generate_permutations("user", "ab", limit=None)
- assert "user" in perms
+ 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
+ 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
+ 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"))
+ 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})
+ 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"
+
@pytest.fixture
def run_main(monkeypatch):
def _run(args):
@@ -47,31 +58,39 @@ def run_main(monkeypatch):
# Added **kwargs to handle show_url argument
monkeypatch.setattr(
"user_scanner.__main__.run_email_module_batch",
- lambda m, t, **kwargs: [Result.taken(username=t, site_name=m, is_email=True)])
+ lambda m, t, config, **kwargs: [
+ Result.taken(username=t, site_name=m, is_email=True)
+ ],
+ )
# Added **kwargs to handle show_url argument
monkeypatch.setattr(
- "user_scanner.__main__.run_user_module",
- lambda module, target, **kwargs: [Result.taken(username=target, site_name=module, is_email=False)]
+ "user_scanner.__main__.run_user_module",
+ lambda module, target, config, **kwargs: [
+ Result.taken(username=target, site_name=module, is_email=False)
+ ],
)
try:
main()
return 0
except SystemExit as exc:
return exc.code
+
return _run
+
def test_bulk_emails_valid(tmp_path, run_main, capsys):
email_file = tmp_path / "test_emails.txt"
email_file.write_text("""[email protected]
-
+
exit_code = run_main(["-ef", str(email_file), "-m", "github"])
out = capsys.readouterr().out
assert "Loaded 3 emails" in out
assert exit_code == 0
+
def test_bulk_emails_partially_valid(tmp_path, run_main, capsys):
email_file = tmp_path / "test_emails.txt"
email_file.write_text("""[email protected]
@@ -85,6 +104,7 @@ def test_bulk_emails_partially_valid(tmp_path, run_main, capsys):
assert "Loaded 2 emails" in out
assert exit_code == 0
+
def test_bulk_emails_single_valid(tmp_path, run_main, capsys):
email_file = tmp_path / "test_emails.txt"
email_file.write_text("""[email protected]
@@ -97,6 +117,7 @@ def test_bulk_emails_single_valid(tmp_path, run_main, capsys):
assert "Loaded 1 email" in out
assert exit_code == 0
+
def test_bulk_emails_invalid(tmp_path, run_main):
email_file = tmp_path / "test_emails.txt"
email_file.write_text("""invalid-email-1
@@ -106,31 +127,35 @@ def test_bulk_emails_invalid(tmp_path, run_main):
exit_code = run_main(["-ef", str(email_file), "-m", "github"])
assert exit_code == 1
+
def test_bulk_emails_empty_file(tmp_path, run_main):
email_file = tmp_path / "test_emails.txt"
email_file.write_text("")
exit_code = run_main(["-ef", str(email_file), "-m", "github"])
assert exit_code == 1
+
def test_bulk_emails_no_file(run_main):
exit_code = run_main(["-ef", "no_file.txt", "-m", "github"])
assert exit_code == 1
+
def test_bulk_emails_skip_comments_blank_lines(tmp_path, run_main, capsys):
email_file = tmp_path / "test_emails.txt"
email_file.write_text("""[email protected]
# comment
-
+
-
+
""")
-
+
exit_code = run_main(["-ef", str(email_file), "-m", "github"])
out = capsys.readouterr().out
assert "Loaded 2 emails" in out
assert exit_code == 0
+
def test_email_file_unreadable(tmp_path, run_main):
email_file = tmp_path / "test_emails.txt"
email_file.write_text("[email protected]")
@@ -138,18 +163,20 @@ def test_email_file_unreadable(tmp_path, run_main):
code = run_main(["-ef", str(email_file), "-m", "github"])
assert code == 1
+
def test_bulk_usernames_valid(tmp_path, run_main, capsys):
username_file = tmp_path / "test_usernames.txt"
username_file.write_text("""user1
user2
user3""")
-
+
exit_code = run_main(["-uf", str(username_file), "-m", "github"])
out = capsys.readouterr().out
assert "Loaded 3 usernames" in out
assert exit_code == 0
+
def test_bulk_usernames_single_valid(tmp_path, run_main, capsys):
username_file = tmp_path / "test_usernames.txt"
username_file.write_text("user1")
@@ -160,29 +187,33 @@ def test_bulk_usernames_single_valid(tmp_path, run_main, capsys):
assert "Loaded 1 username" in out
assert exit_code == 0
+
def test_bulk_usernames_empty_file(tmp_path, run_main):
username_file = tmp_path / "test_usernames.txt"
username_file.write_text("")
exit_code = run_main(["-uf", str(username_file), "-m", "github"])
assert exit_code == 1
+
def test_bulk_usernames_no_file(run_main):
exit_code = run_main(["-uf", "no_file.txt", "-m", "github"])
assert exit_code == 1
+
def test_bulk_usernames_skip_comments_blank_lines(tmp_path, run_main, capsys):
username_file = tmp_path / "test_usernames.txt"
username_file.write_text("""user1
# comment
-
+
user2""")
-
+
exit_code = run_main(["-uf", str(username_file), "-m", "github"])
out = capsys.readouterr().out
assert "Loaded 2 usernames" in out
assert exit_code == 0
+
def test_username_file_unreadable(tmp_path, run_main):
username_file = tmp_path / "test_usernames.txt"
username_file.write_text("user")
@@ -190,24 +221,25 @@ def test_username_file_unreadable(tmp_path, run_main):
code = run_main(["-uf", str(username_file), "-m", "github"])
assert code == 1
-@patch('httpx.Client')
+
+@patch("httpx.Client")
def test_validate_proxy_all_invalid(mock_client):
instance = mock_client.return_value.__enter__.return_value
response = MagicMock()
response.status_code = 302
instance.get.return_value = response
- proxies = ["http://proxy1.example.com:8080",
- "http://proxy2.example.com:3128"]
+ proxies = ["http://proxy1.example.com:8080", "http://proxy2.example.com:3128"]
result = helpers.validate_proxies(proxies)
assert result == []
-@patch('httpx.Client')
+
+@patch("httpx.Client")
def test_validate_proxy_partially_invalid(mock_client):
def side_effect(*args, **kwargs):
proxy = kwargs.get("proxy")
instance = MagicMock()
- if "invalid" in proxy:
+ if proxy and "invalid" in proxy:
instance.get.side_effect = Exception("connection failed")
else:
response = MagicMock()
@@ -216,26 +248,28 @@ def test_validate_proxy_partially_invalid(mock_client):
instance.__enter__.return_value = instance
instance.__exit__.return_value = None
return instance
-
+
mock_client.side_effect = side_effect
- proxies = ["http://invalid",
- "socks5://socks-proxy.example.com:1080"]
+ proxies = ["http://invalid", "socks5://socks-proxy.example.com:1080"]
result = helpers.validate_proxies(proxies)
assert result == ["socks5://socks-proxy.example.com:1080"]
+
def test_validate_proxy_empty_list():
result = helpers.validate_proxies([])
assert result == []
-@patch('httpx.Client')
+
+@patch("httpx.Client")
def test_validate_proxy_timeout(mock_client):
instance = mock_client.return_value.__enter__.return_value
instance.get.side_effect = helpers.httpx.TimeoutException("timeout")
proxies = ["http://proxy1.example.com:8080"]
-
+
result = helpers.validate_proxies(proxies, timeout=1)
assert result == []
+
@patch("httpx.Client")
def test_validate_proxy_single_worker(mock_client):
instance = mock_client.return_value.__enter__.return_value
@@ -243,12 +277,12 @@ def test_validate_proxy_single_worker(mock_client):
response.status_code = 200
instance.get.return_value = response
- proxies = ["http://proxy1.example.com:8080",
- "http://proxy2.example.com:3128"]
+ proxies = ["http://proxy1.example.com:8080", "http://proxy2.example.com:3128"]
result = helpers.validate_proxies(proxies, max_workers=1)
assert result == proxies
+
def test_proxy_manager_add_protocol(tmp_path):
proxy_file = tmp_path / "test_proxies.txt"
proxy_file.write_text("""proxy1.example.com:8080
@@ -260,19 +294,22 @@ socks5://socks-proxy.example.com:1080""")
assert manager.proxies[0].startswith("http://")
assert manager.proxies[1].startswith("socks5://")
+
def test_proxy_manager_no_poxy_file(tmp_path):
with pytest.raises(FileNotFoundError) as exc_info:
helpers.ProxyManager("no_proxy_file.txt")
assert exc_info.type is FileNotFoundError
+
def test_proxy_manager_empty_file_only_comments(tmp_path):
proxy_file = tmp_path / "test_proxy.txt"
proxy_file.write_text("""#comment
-
+
""")
with pytest.raises(Exception):
helpers.ProxyManager(str(proxy_file))
+
def test_proxy_rotation(tmp_path):
proxy_file = tmp_path / "test_proxy.txt"
proxy_file.write_text("""http://1
@@ -285,6 +322,7 @@ http://3""")
assert manager.get_next_proxy() == "http://3"
assert manager.get_next_proxy() == "http://1"
+
def test_single_proxy_rotation(tmp_path):
proxy_file = tmp_path / "test_proxy.txt"
proxy_file.write_text("http://1")
@@ -292,6 +330,7 @@ def test_single_proxy_rotation(tmp_path):
for _ in range(3):
assert manager.get_next_proxy() == "http://1"
+
def test_global_manager(tmp_path):
proxy_file = tmp_path / "test_proxy.txt"
proxy_file.write_text("""http://1
@@ -305,6 +344,7 @@ http://2""")
assert p1 != p2
assert helpers.get_proxy_count() == 2
+
def test_thread_safe_rotation(tmp_path):
proxy_file = tmp_path / "test_proxy.txt"
proxy_file.write_text("""http://1
@@ -324,4 +364,3 @@ http://3""")
t.join()
assert len(results) == 50
-
diff --git a/tests/test_orchestrator.py b/tests/test_orchestrator.py
index 7b1b3c4..faa7511 100644
--- a/tests/test_orchestrator.py
+++ b/tests/test_orchestrator.py
@@ -1,12 +1,17 @@
import types
from types import SimpleNamespace
+
from user_scanner.core import orchestrator
+from user_scanner.core.helpers import ScanConfig
from user_scanner.core.result import Result
def test_status_validate_available(monkeypatch):
- monkeypatch.setattr(orchestrator, "make_request",
- lambda url, **kwargs: SimpleNamespace(status_code=200))
+ monkeypatch.setattr(
+ orchestrator,
+ "make_request",
+ lambda url, **kwargs: SimpleNamespace(status_code=200),
+ )
res = orchestrator.status_validate("http://example.com", available=200, taken=404)
assert res.to_number() == 1 # AVAILABLE
@@ -21,10 +26,9 @@ def test_run_module_single_prints_json_and_csv(capsys):
setattr(module, "validate_testsite", validate_testsite)
- orchestrator.run_user_module(module, "bob")
+ orchestrator.run_user_module(module, "bob", ScanConfig())
out = capsys.readouterr().out
- assert 'bob' in out #Needs to be improved
-
+ assert "bob" in out # Needs to be improved
def test_run_checks_category_threaded(monkeypatch, tmp_path):
@@ -41,7 +45,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_user_category(tmp_path, "someone")
+ results = orchestrator.run_user_category(tmp_path, "someone", ScanConfig())
assert isinstance(results, list)
assert len(results) == 1
assert results[0].to_number() == 0 # TAKEN
diff --git a/tests/test_result.py b/tests/test_result.py
index 85dcbdf..23c684f 100644
--- a/tests/test_result.py
+++ b/tests/test_result.py
@@ -1,5 +1,7 @@
+from user_scanner.core.helpers import ScanConfig
from user_scanner.core.result import Result, Status
+
def test_status_labels():
assert Status.TAKEN.to_label(is_email=False) == "Found"
assert Status.AVAILABLE.to_label(is_email=False) == "Not Found"
@@ -34,10 +36,19 @@ def test_get_reason_and_humanize():
assert Result.available().get_reason() == ""
assert Result.available("manual reason").get_reason() == "manual reason"
- assert "Could not resolve hostname" in Result.error(Exception("Error 11001")).get_reason()
- assert "Connection closed by remote server" in Result.error(Exception("Error 10054")).get_reason()
+ assert (
+ "Could not resolve hostname"
+ in Result.error(Exception("Error 11001")).get_reason()
+ )
+ assert (
+ "Connection closed by remote server"
+ in Result.error(Exception("Error 10054")).get_reason()
+ )
- assert Result.available(Exception("some error")).get_reason() == "Exception: Some error"
+ assert (
+ Result.available(Exception("some error")).get_reason()
+ == "Exception: Some error"
+ )
def test_has_reason():
@@ -82,7 +93,7 @@ def test_update_and_fields():
site_name="GitHub",
category="Social",
url="https://github.com/alice",
- is_email=False
+ is_email=False,
)
assert res.username == "alice"
@@ -96,7 +107,7 @@ def test_output_formats():
username="testuser",
site_name="Example",
category="Tech",
- url="https://example.com/user"
+ url="https://example.com/user",
)
d = res.as_dict()
@@ -118,12 +129,16 @@ def test_output_formats():
def test_console_output_and_show_url():
res = Result.taken(site_name="MySite", url="https://mysite.com/u")
- out_hidden = res.get_console_output(show_url=False)
+ out_hidden = res.get_console_output()
assert "[βœ”]" in out_hidden
assert "Found" in out_hidden
assert "https://mysite.com" not in out_hidden
- out_visible = res.get_console_output(show_url=True)
+ out_visible = res.get_console_output(
+ ScanConfig(
+ show_url=True,
+ )
+ )
assert "[https://mysite.com/u]" in out_visible
@@ -131,4 +146,4 @@ def test_debug_string():
res = Result.available(username="dev", url="http://dev.link")
debug_str = res.debug()
assert 'url: "http://dev.link"' in debug_str
- assert 'status: Not Found' in debug_str
+ assert "status: Not Found" in debug_str
diff --git a/user_scanner/__main__.py b/user_scanner/__main__.py
index dfc581d..1ece16d 100644
--- a/user_scanner/__main__.py
+++ b/user_scanner/__main__.py
@@ -3,35 +3,34 @@ import json
import re
import sys
import time
+
from colorama import Fore, Style
from user_scanner.cli.banner import print_banner
-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
-from user_scanner.utils.update import update_self
-
+from user_scanner.core.email_orchestrator import (
+ run_email_category_batch,
+ run_email_full_batch,
+ run_email_module_batch,
+)
from user_scanner.core.helpers import (
- load_categories,
- load_modules,
+ ScanConfig,
find_module,
- get_site_name,
generate_permutations,
+ get_proxy_count,
+ get_site_name,
+ load_categories,
+ load_modules,
set_proxy_manager,
- get_proxy_count
)
-
from user_scanner.core.orchestrator import (
- run_user_full,
run_user_category,
- run_user_module
-)
-
-from user_scanner.core.email_orchestrator import (
- run_email_full_batch,
- run_email_category_batch,
- run_email_module_batch
+ run_user_full,
+ run_user_module,
)
+from user_scanner.core.version import load_local_version
+from user_scanner.utils.update import update_self
+from user_scanner.utils.updater_logic import check_for_updates
# Color configs
R = Fore.RED
@@ -46,61 +45,93 @@ MAX_PERMUTATIONS_LIMIT = 100
def main():
parser = argparse.ArgumentParser(
prog="user-scanner",
- description="Scan usernames or emails across multiple platforms."
+ description="Scan usernames or emails across multiple platforms.",
)
group = parser.add_mutually_exclusive_group(required=False)
- group.add_argument("-u", "--username",
- help="Username to scan across platforms")
+ group.add_argument("-u", "--username", help="Username to scan across platforms")
group.add_argument("-e", "--email", help="Email to scan across platforms")
- group.add_argument("-uf", "--username-file",
- help="File containing usernames (one per line)")
- group.add_argument("-ef", "--email-file",
- help="File containing emails (one per line)")
+ group.add_argument(
+ "-uf", "--username-file", help="File containing usernames (one per line)"
+ )
+ group.add_argument(
+ "-ef", "--email-file", help="File containing emails (one per line)"
+ )
- parser.add_argument("-c", "--category",
- help="Scan all platforms in a category")
+ parser.add_argument("-c", "--category", help="Scan all platforms in a category")
parser.add_argument("-m", "--module", help="Scan a single specific module")
- parser.add_argument("-lu", "--list-user", action="store_true",
- help="List all available modules for username scanning")
-
- parser.add_argument("-le", "--list-email", action="store_true",
- help="List all available modules for email scanning")
+ parser.add_argument(
+ "-lu",
+ "--list-user",
+ action="store_true",
+ help="List all available modules for username scanning",
+ )
- parser.add_argument("-v", "--verbose", action="store_true",
- help="Enable verbose output to show urls of the websites")
+ parser.add_argument(
+ "-le",
+ "--list-email",
+ action="store_true",
+ help="List all available modules for email scanning",
+ )
- parser.add_argument("-p", "--permute", type=str,
- help="Generate permutations using a pattern")
+ parser.add_argument(
+ "-v",
+ "--verbose",
+ action="store_true",
+ help="Enable verbose output to show urls of the websites",
+ )
- parser.add_argument("-s", "--stop", type=int,
- default=MAX_PERMUTATIONS_LIMIT, help="Limit permutations")
+ parser.add_argument(
+ "-p", "--permute", type=str, help="Generate permutations using a pattern"
+ )
- parser.add_argument("-d", "--delay", type=float,
- default=0, help="Delay between requests")
+ parser.add_argument(
+ "-s",
+ "--stop",
+ type=int,
+ default=MAX_PERMUTATIONS_LIMIT,
+ help="Limit permutations",
+ )
parser.add_argument(
- "-f", "--format", choices=["csv", "json"], help="Output format")
+ "-d", "--delay", type=float, default=0, help="Delay between requests"
+ )
+
+ parser.add_argument("-f", "--format", choices=["csv", "json"], help="Output format")
parser.add_argument("-o", "--output", type=str, help="Output file path")
parser.add_argument(
- "-P", "--proxy-file", type=str, help="Path to proxy list file (one proxy per line)")
+ "-P",
+ "--proxy-file",
+ type=str,
+ help="Path to proxy list file (one proxy per line)",
+ )
parser.add_argument(
- "--validate-proxies", action="store_true",
- help="Validate proxies before scanning (tests against google.com)")
+ "--validate-proxies",
+ action="store_true",
+ help="Validate proxies before scanning (tests against google.com)",
+ )
parser.add_argument(
- "--only-found", action="store_true",
- help="Only show sites where the username/email was found")
+ "--only-found",
+ action="store_true",
+ help="Only show sites where the username/email was found",
+ )
parser.add_argument(
- "-U", "--update", action="store_true", help="Update the tool")
+ "--allow-loud",
+ action="store_true",
+ help="Enable scanning sites that may send emails/notifications "
+ "(password resets, etc.)",
+ )
+
+ parser.add_argument("-U", "--update", action="store_true", help="Update the tool")
parser.add_argument("--version", action="store_true", help="Print version")
@@ -120,8 +151,7 @@ def main():
categories = load_categories()
for cat_name, cat_path in categories.items():
modules = load_modules(cat_path)
- print(Fore.MAGENTA +
- f"\n== {cat_name.upper()} SITES =={Style.RESET_ALL}")
+ print(Fore.MAGENTA + f"\n== {cat_name.upper()} SITES =={Style.RESET_ALL}")
for module in modules:
print(f" - {get_site_name(module)}")
return
@@ -130,8 +160,7 @@ def main():
categories = load_categories(is_email=True)
for cat_name, cat_path in categories.items():
modules = load_modules(cat_path)
- print(Fore.MAGENTA +
- f"\n== {cat_name.upper()} SITES =={Style.RESET_ALL}")
+ print(Fore.MAGENTA + f"\n== {cat_name.upper()} SITES =={Style.RESET_ALL}")
for module in modules:
print(f" - {get_site_name(module)}")
return
@@ -146,7 +175,7 @@ def main():
# Validate proxies if flag is set
if args.validate_proxies:
print(f"{C}[*] Validating proxies from {args.proxy_file}...{X}")
- from user_scanner.core.helpers import validate_proxies, ProxyManager
+ from user_scanner.core.helpers import ProxyManager, validate_proxies
# Load proxies first
temp_manager = ProxyManager(args.proxy_file)
@@ -161,13 +190,14 @@ def main():
sys.exit(1)
print(
- f"{G}[+] Found {len(working_proxies)} working proxies out of {len(all_proxies)}{X}")
+ f"{G}[+] Found {len(working_proxies)} working proxies out of {len(all_proxies)}{X}"
+ )
# Save working proxies to temp file
temp_proxy_file = "validated_proxies.txt"
- with open(temp_proxy_file, 'w', encoding='utf-8') as f:
+ with open(temp_proxy_file, "w", encoding="utf-8") as f:
for proxy in working_proxies:
- f.write(proxy + '\n')
+ f.write(proxy + "\n")
set_proxy_manager(temp_proxy_file)
proxy_count = get_proxy_count()
@@ -175,8 +205,7 @@ def main():
else:
set_proxy_manager(args.proxy_file)
proxy_count = get_proxy_count()
- print(
- f"{G}[+] Loaded {proxy_count} proxies from {args.proxy_file}{X}")
+ print(f"{G}[+] Loaded {proxy_count} proxies from {args.proxy_file}{X}")
except Exception as e:
print(f"{R}[✘] Error loading proxies: {e}{X}")
sys.exit(1)
@@ -187,9 +216,12 @@ def main():
# Handle bulk email file
if args.email_file:
try:
- with open(args.email_file, 'r', encoding='utf-8') as f:
- emails = [line.strip() for line in f if line.strip()
- and not line.startswith('#')]
+ with open(args.email_file, "r", encoding="utf-8") as f:
+ emails = [
+ line.strip()
+ for line in f
+ if line.strip() and not line.startswith("#")
+ ]
# Validate email formats
valid_emails = []
@@ -200,12 +232,12 @@ def main():
print(f"{Y}[!] Skipping invalid email format: {email}{X}")
if not valid_emails:
- print(
- f"{R}[✘] Error: No valid emails found in {args.email_file}{X}")
+ print(f"{R}[✘] Error: No valid emails found in {args.email_file}{X}")
sys.exit(1)
print(
- f"{C}[+] Loaded {len(valid_emails)} {'email' if len(valid_emails) == 1 else 'emails'} from {args.email_file}{X}")
+ f"{C}[+] Loaded {len(valid_emails)} {'email' if len(valid_emails) == 1 else 'emails'} from {args.email_file}{X}"
+ )
is_email = True
targets = valid_emails
except FileNotFoundError:
@@ -217,15 +249,20 @@ def main():
# Handle bulk username file
elif args.username_file:
try:
- with open(args.username_file, 'r', encoding='utf-8') as f:
- usernames = [line.strip() for line in f if line.strip()
- and not line.startswith('#')]
+ with open(args.username_file, "r", encoding="utf-8") as f:
+ usernames = [
+ line.strip()
+ for line in f
+ if line.strip() and not line.startswith("#")
+ ]
if not usernames:
print(
- f"{R}[✘] Error: No valid usernames found in {args.username_file}{X}")
+ f"{R}[✘] Error: No valid usernames found in {args.username_file}{X}"
+ )
sys.exit(1)
print(
- f"{C}[+] Loaded {len(usernames)} {'username' if len(usernames) == 1 else 'usernames'} from {args.username_file}{X}")
+ f"{C}[+] Loaded {len(usernames)} {'username' if len(usernames) == 1 else 'usernames'} from {args.username_file}{X}"
+ )
is_email = False
targets = usernames
except FileNotFoundError:
@@ -246,17 +283,20 @@ def main():
# Handle permutations (only for single username/email)
if args.permute and not (args.username_file or args.email_file):
target_name = args.username or args.email
- targets = generate_permutations(
- target_name, args.permute, args.stop, is_email)
- print(
- C + f"[+] Generated {len(targets)} permutations" + Style.RESET_ALL)
+ targets = generate_permutations(target_name, args.permute, args.stop, is_email)
+ print(C + f"[+] Generated {len(targets)} permutations" + Style.RESET_ALL)
elif args.permute and (args.username_file or args.email_file):
- print(
- f"{R}[✘] Error: Permutations not supported with file-based scanning{X}")
+ print(f"{R}[✘] Error: Permutations not supported with file-based scanning{X}")
sys.exit(1)
results = []
+ config = ScanConfig(
+ show_url=args.verbose,
+ only_found=args.only_found,
+ allow_loud=args.allow_loud,
+ )
+
for i, target in enumerate(targets):
if i != 0 and args.delay:
time.sleep(args.delay)
@@ -271,32 +311,41 @@ def main():
fn = run_email_module_batch if is_email else run_user_module
if modules:
for module in modules:
- results.extend(fn(module, target, show_url=args.verbose))
+ results.extend(fn(module, target, config))
else:
print(
- R +
- f"[!] {'Email' if is_email else 'User'} 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).get(args.category)
fn = run_email_category_batch if is_email else run_user_category
if cat_path:
- results.extend(fn(cat_path, target, show_url=args.verbose, only_found=args.only_found))
+ results.extend(
+ fn(
+ cat_path,
+ target,
+ config,
+ )
+ )
else:
print(
- R +
- f"[!] {'Email' if is_email else 'User'} category '{args.category}' not found." +
- Style.RESET_ALL
+ R
+ + f"[!] {'Email' if is_email else 'User'} category '{args.category}' not found."
+ + Style.RESET_ALL
)
else:
fn = run_email_full_batch if is_email else run_user_full
- results.extend(fn(target, show_url=args.verbose, only_found=args.only_found))
+ results.extend(fn(target, config))
if args.output:
- content = formatter.into_csv(
- results) if args.format == "csv" else formatter.into_json(results)
+ content = (
+ formatter.into_csv(results)
+ if args.format == "csv"
+ else formatter.into_json(results)
+ )
if args.format == "json":
data = []
@@ -309,7 +358,9 @@ def main():
pass
new_items = json.loads(content)
- if isinstance(new_items, list) and all(isinstance(x, dict) for x in new_items):
+ if isinstance(new_items, list) and all(
+ isinstance(x, dict) for x in new_items
+ ):
data.extend(new_items)
with open(args.output, "w", encoding="utf-8") as f:
@@ -338,5 +389,6 @@ def main():
else:
print(f"\n{C}[i] Scan complete. Total hits:{X} {total_found}")
+
if __name__ == "__main__":
main()
diff --git a/user_scanner/core/email_orchestrator.py b/user_scanner/core/email_orchestrator.py
index 83857c4..838296c 100644
--- a/user_scanner/core/email_orchestrator.py
+++ b/user_scanner/core/email_orchestrator.py
@@ -2,18 +2,28 @@ import asyncio
from pathlib import Path
from types import ModuleType
from typing import List, Optional, Set
+
from colorama import Fore, Style
-from user_scanner.core.helpers import find_category, load_categories, load_modules
+from user_scanner.core.helpers import (
+ ScanConfig,
+ find_category,
+ load_categories,
+ load_modules,
+)
from user_scanner.core.result import Result, Status
# Concurrency control
MAX_CONCURRENT_REQUESTS = 25
-async def _async_worker(module: ModuleType, email: str, sem: asyncio.Semaphore,
- show_url: bool = False, only_found: bool = False,
- printed_cats: Optional[Set] = None) -> Result:
+async def _async_worker(
+ module: ModuleType,
+ email: str,
+ sem: asyncio.Semaphore,
+ configs: ScanConfig,
+ printed_cats: Optional[Set] = None,
+) -> Result:
async with sem:
module_name = module.__name__.split(".")[-1]
func_name = f"validate_{module_name}"
@@ -30,7 +40,7 @@ async def _async_worker(module: ModuleType, email: str, sem: asyncio.Semaphore,
return (
Result.error(f"Function {func_name} not found")
.update(**params)
- .show(show_url=show_url, only_found=only_found)
+ .show(configs)
)
func = getattr(module, func_name)
@@ -44,46 +54,68 @@ async def _async_worker(module: ModuleType, email: str, sem: asyncio.Semaphore,
result.update(**params)
# Logic to print header dynamically for --only-found streaming
- if only_found and result.status == Status.TAKEN:
+ if configs.only_found and result.status == Status.TAKEN:
if printed_cats is not None and actual_cat not in printed_cats:
print(
- f"\n{Fore.MAGENTA}== {actual_cat.upper()} SITES =={Style.RESET_ALL}")
+ f"\n{Fore.MAGENTA}== {actual_cat.upper()} SITES =={Style.RESET_ALL}"
+ )
printed_cats.add(actual_cat)
- return result.show(show_url=show_url, only_found=only_found)
+ return result.show(configs)
-async def _run_batch(modules: List[ModuleType], email: str, show_url: bool = False,
- only_found: bool = False, printed_cats: Optional[Set] = None) -> List[Result]:
+async def _run_batch(
+ modules: List[ModuleType],
+ email: str,
+ configs: ScanConfig,
+ printed_cats: Optional[Set] = None,
+) -> List[Result]:
sem = asyncio.Semaphore(MAX_CONCURRENT_REQUESTS)
tasks = []
for module in modules:
- tasks.append(_async_worker(module, email, sem, show_url=show_url,
- only_found=only_found, printed_cats=printed_cats))
+ tasks.append(
+ _async_worker(
+ module,
+ email,
+ sem,
+ configs,
+ printed_cats=printed_cats,
+ )
+ )
if not tasks:
return []
return list(await asyncio.gather(*tasks))
-def run_email_module_batch(module: ModuleType, email: str, show_url: bool = False, only_found: bool = False) -> List[Result]:
- return asyncio.run(_run_batch([module], email, show_url=show_url, only_found=only_found))
+def run_email_module_batch(
+ module: ModuleType, email: str, configs: ScanConfig
+) -> List[Result]:
+ return asyncio.run(_run_batch([module], email, configs))
-def run_email_category_batch(category_path: Path, email: str, show_url: bool = False, only_found: bool = False) -> List[Result]:
+def run_email_category_batch(
+ category_path: Path, email: str, configs: ScanConfig
+) -> List[Result]:
cat_name = category_path.stem.capitalize()
modules = load_modules(category_path)
printed_cats = set()
- if not only_found:
+ if not configs.only_found:
print(f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}")
printed_cats.add(cat_name)
- return asyncio.run(_run_batch(modules, email, show_url=show_url,
- only_found=only_found, printed_cats=printed_cats))
+ return asyncio.run(
+ _run_batch(
+ modules,
+ email,
+ configs,
+ printed_cats=printed_cats,
+ )
+ )
-def run_email_full_batch(email: str, show_url: bool = False, only_found: bool = False) -> List[Result]:
+def run_email_full_batch(email: str, configs: ScanConfig) -> List[Result]:
categories = load_categories(is_email=True)
all_results = []
printed_cats = set()
@@ -91,13 +123,18 @@ def run_email_full_batch(email: str, show_url: bool = False, only_found: bool =
for cat_name, cat_path in categories.items():
modules = load_modules(cat_path)
- if not only_found:
- print(
- f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}")
+ if not configs.only_found:
+ print(f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}")
printed_cats.add(cat_name)
- cat_results = asyncio.run(_run_batch(modules, email, show_url=show_url,
- only_found=only_found, printed_cats=printed_cats))
+ cat_results = asyncio.run(
+ _run_batch(
+ modules,
+ email,
+ configs,
+ printed_cats=printed_cats,
+ )
+ )
all_results.extend(cat_results)
return all_results
diff --git a/user_scanner/core/helpers.py b/user_scanner/core/helpers.py
index 61fa85a..1cdc374 100644
--- a/user_scanner/core/helpers.py
+++ b/user_scanner/core/helpers.py
@@ -1,17 +1,26 @@
import importlib
import importlib.util
+import random
+import threading
+from concurrent.futures import ThreadPoolExecutor, as_completed
+from dataclasses import dataclass
from itertools import permutations
-from types import ModuleType
from pathlib import Path
+from types import ModuleType
from typing import Dict, List, Optional
-import random
-import threading
+
import httpx
-from concurrent.futures import ThreadPoolExecutor, as_completed
+
+
+@dataclass(frozen=True)
+class ScanConfig:
+ allow_loud: bool = False
+ only_found: bool = False
+ show_url: bool = False
def get_site_name(module) -> str:
- name = module.__name__.split('.')[-1].capitalize().replace("_", ".")
+ name = module.__name__.split(".")[-1].capitalize().replace("_", ".")
if name == "X":
return "X (Twitter)"
return name
@@ -38,9 +47,11 @@ def load_categories(is_email: bool = False) -> Dict[str, Path]:
categories = {}
for subfolder in root.iterdir():
- if subfolder.is_dir() and \
- subfolder.name.lower() not in ["cli", "utils", "core"] and \
- "__" not in subfolder.name: # Removes __pycache__
+ if (
+ subfolder.is_dir()
+ and subfolder.name.lower() not in ["cli", "utils", "core"]
+ and "__" not in subfolder.name
+ ): # Removes __pycache__
categories[subfolder.name] = subfolder.resolve()
return categories
@@ -58,8 +69,7 @@ def find_module(name: str, is_email: bool = False) -> List[ModuleType]:
def find_category(module: ModuleType) -> str | None:
-
- module_file = getattr(module, '__file__', None)
+ module_file = getattr(module, "__file__", None)
if not module_file:
return None
@@ -70,7 +80,9 @@ def find_category(module: ModuleType) -> str | None:
return None
-def generate_permutations(username: str, pattern: str, limit: int | None = None, is_email: bool = False) -> List[str]:
+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`.
@@ -89,7 +101,7 @@ def generate_permutations(username: str, pattern: str, limit: int | None = None,
# generate permutations of length 1 β†’ len(chars)
for r in range(len(chars)):
for combo in permutations(chars, r):
- new = username + ''.join(combo)
+ new = username + "".join(combo)
if is_email:
new += "@" + domain
permutations_set.add(new)
@@ -99,10 +111,12 @@ def generate_permutations(username: str, pattern: str, limit: int | None = None,
return sorted(permutations_set)
-def validate_proxies(proxy_list: List[str], timeout: int = 5, max_workers: int = 50) -> List[str]:
+def validate_proxies(
+ proxy_list: List[str], timeout: int = 5, max_workers: int = 50
+) -> List[str]:
"""Validate proxies by testing them against google.com. Returns list of working proxies."""
working_proxies = []
-
+
def test_proxy(proxy: str) -> Optional[str]:
try:
with httpx.Client(proxy=proxy, timeout=timeout) as client:
@@ -112,62 +126,62 @@ def validate_proxies(proxy_list: List[str], timeout: int = 5, max_workers: int =
except Exception:
pass
return None
-
+
with ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = {executor.submit(test_proxy, proxy): proxy for proxy in proxy_list}
for future in as_completed(futures):
result = future.result()
if result:
working_proxies.append(result)
-
+
return working_proxies
class ProxyManager:
"""Thread-safe proxy manager that loads and rotates proxies from a file."""
-
+
def __init__(self, proxy_file: str):
self.proxies: list[str] = []
self.current_index = 0
self.lock = threading.Lock()
self._load_proxies(proxy_file)
-
+
def _load_proxies(self, proxy_file: str) -> None:
"""Load proxies from a text file. Supports http://, https://, and socks5:// proxies."""
try:
- with open(proxy_file, 'r', encoding='utf-8') as f:
+ with open(proxy_file, "r", encoding="utf-8") as f:
for line in f:
line = line.strip()
- if line and not line.startswith('#'):
+ if line and not line.startswith("#"):
# Add protocol if not present
- if not line.startswith(('http://', 'https://', 'socks5://')):
- line = 'http://' + line
+ if not line.startswith(("http://", "https://", "socks5://")):
+ line = "http://" + line
self.proxies.append(line)
-
+
if not self.proxies:
raise ValueError("No valid proxies found in file")
-
+
except FileNotFoundError:
raise FileNotFoundError(f"Proxy file not found: {proxy_file}")
except Exception as e:
raise Exception(f"Error loading proxies: {e}")
-
+
def get_next_proxy(self) -> Optional[str]:
"""Get the next proxy in rotation (round-robin)."""
if not self.proxies:
return None
-
+
with self.lock:
proxy = self.proxies[self.current_index]
self.current_index = (self.current_index + 1) % len(self.proxies)
return proxy
-
+
def get_random_proxy(self) -> Optional[str]:
"""Get a random proxy from the list."""
if not self.proxies:
return None
return random.choice(self.proxies)
-
+
def count(self) -> int:
"""Return the number of loaded proxies."""
return len(self.proxies)
@@ -202,8 +216,10 @@ def get_proxy_count() -> int:
# Function to return random user agent
+
def get_random_user_agent():
- agents = [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36",
+ agents = [
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0",
@@ -211,9 +227,8 @@ def get_random_user_agent():
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0",
"Mozilla/5.0 (iPhone; CPU iPhone OS 19_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/19.0 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (Linux; Android 15; Pixel 9 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36"
- ]
+ "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36",
+ ]
"""return random"""
random_agent = random.choice(agents)
return random_agent
-
diff --git a/user_scanner/core/orchestrator.py b/user_scanner/core/orchestrator.py
index 59399d5..ad6c31c 100644
--- a/user_scanner/core/orchestrator.py
+++ b/user_scanner/core/orchestrator.py
@@ -1,16 +1,31 @@
-from colorama import Fore, Style
from concurrent.futures import ThreadPoolExecutor
-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, get_proxy
+from typing import Callable, List
+
+import httpx
+from colorama import Fore, Style
+
+from user_scanner.core.helpers import (
+ ScanConfig,
+ find_category,
+ get_proxy,
+ get_site_name,
+ load_categories,
+ load_modules,
+)
+from user_scanner.core.result import 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)
+ func = next(
+ (
+ getattr(module, f)
+ for f in dir(module)
+ if f.startswith("validate_") and callable(getattr(module, f))
+ ),
+ None,
+ )
site_name = get_site_name(module)
@@ -29,7 +44,9 @@ def _worker_single(module: ModuleType, username: str) -> Result:
return Result.error(e, site_name=site_name, username=username)
-def run_user_module(module: ModuleType, username: str, show_url: bool = False, only_found: bool = False) -> List[Result]:
+def run_user_module(
+ module: ModuleType, username: str, configs: ScanConfig
+) -> List[Result]:
result = _worker_single(module, username)
category = find_category(module)
@@ -37,16 +54,18 @@ def run_user_module(module: ModuleType, username: str, show_url: bool = False, o
result.update(category=category)
# Use the result.show logic which handles the only_found filtering
- result.show(show_url=show_url, only_found=only_found)
+ result.show(configs)
return [result]
-def run_user_category(category_path: Path, username: str, show_url: bool = False, only_found: bool = False) -> List[Result]:
+def run_user_category(
+ category_path: Path, username: str, configs: ScanConfig
+) -> List[Result]:
category_name = category_path.stem.capitalize()
results = []
modules = load_modules(category_path)
- header_printed = False
+ header_printed = False
with ThreadPoolExecutor(max_workers=20) as executor:
# map returns results as they are finished, allowing for "streaming" output
@@ -55,22 +74,26 @@ def run_user_category(category_path: Path, username: str, show_url: bool = False
result.update(category=category_name)
results.append(result)
- if only_found:
+ if configs.only_found:
if result.is_found():
if not header_printed:
- print(f"\n{Fore.MAGENTA}== {category_name.upper()} SITES =={Style.RESET_ALL}")
+ print(
+ f"\n{Fore.MAGENTA}== {category_name.upper()} SITES =={Style.RESET_ALL}"
+ )
header_printed = True
- result.show(show_url=show_url, only_found=only_found)
+ result.show(configs)
else:
if not header_printed:
- print(f"\n{Fore.MAGENTA}== {category_name.upper()} SITES =={Style.RESET_ALL}")
+ print(
+ f"\n{Fore.MAGENTA}== {category_name.upper()} SITES =={Style.RESET_ALL}"
+ )
header_printed = True
- result.show(show_url=show_url, only_found=only_found)
+ result.show(configs)
return results
-def run_user_full(username: str, show_url: bool = False, only_found: bool = False) -> List[Result]:
+def run_user_full(username: str, configs: ScanConfig) -> List[Result]:
results = []
all_modules = []
categories = list(load_categories().items())
@@ -88,37 +111,41 @@ def run_user_full(username: str, show_url: bool = False, only_found: bool = Fals
exec_map = executor.map(lambda m: _worker_single(m, username), all_modules)
for result in exec_map:
site_name = result.site_name
- cat_name = module_to_cat.get(site_name, "Unknown") if site_name else "Unknown"
+ cat_name = (
+ module_to_cat.get(site_name, "Unknown") if site_name else "Unknown"
+ )
result.update(category=cat_name)
results.append(result)
- if only_found:
+ if configs.only_found:
if result.is_found():
if cat_name not in printed_categories:
- print(f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}")
+ print(
+ f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}"
+ )
printed_categories.add(cat_name)
- result.show(show_url=show_url, only_found=only_found)
+ result.show(configs)
else:
if cat_name not in printed_categories:
- print(f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}")
+ print(
+ f"\n{Fore.MAGENTA}== {cat_name.upper()} SITES =={Style.RESET_ALL}"
+ )
printed_categories.add(cat_name)
- result.show(show_url=show_url, only_found=only_found)
+ result.show(configs)
return results
-
-
def make_request(url: str, **kwargs) -> httpx.Response:
"""Simple wrapper to **httpx.get** that predefines headers and timeout"""
if "headers" not in kwargs:
kwargs["headers"] = {
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
- 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
- 'Accept-Encoding': "gzip, deflate, br",
- 'Accept-Language': "en-US,en;q=0.9",
- 'sec-fetch-dest': "document",
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "en-US,en;q=0.9",
+ "sec-fetch-dest": "document",
}
if "show_url" in kwargs:
kwargs.pop("show_url", None)
@@ -138,7 +165,9 @@ def make_request(url: str, **kwargs) -> httpx.Response:
return client.request(method.upper(), url, **kwargs)
-def generic_validate(url: str, func: Callable[[httpx.Response], Result], **kwargs) -> Result:
+def generic_validate(
+ url: str, func: Callable[[httpx.Response], Result], **kwargs
+) -> Result:
"""
A generic validate function that makes a request and executes the provided function on the response.
"""
@@ -154,15 +183,20 @@ def generic_validate(url: str, func: Callable[[httpx.Response], Result], **kwarg
return Result.error(e, url=display_url)
-def status_validate(url: str, available: int | List[int], taken: int | List[int], **kwargs) -> Result:
+def status_validate(
+ url: str, available: int | List[int], taken: int | List[int], **kwargs
+) -> Result:
"""
- Function that takes a **url** and **kwargs** for the request and
+ Function that takes a **url** and **kwargs** for the request and
checks if the request status matches the available or taken.
**Available** and **Taken** must either be whole numbers or lists of whole numbers.
"""
+
def inner(response: httpx.Response):
# Checks if a number is equal or is contained inside
- def contains(a, b): return (isinstance(a, list) and b in a) or (a == b)
+ def contains(a, b):
+ return (isinstance(a, list) and b in a) or (a == b)
+
status = response.status_code
available_value = contains(available, status)
taken_value = contains(taken, status)
diff --git a/user_scanner/core/result.py b/user_scanner/core/result.py
index 2ea9b32..34ac87f 100644
--- a/user_scanner/core/result.py
+++ b/user_scanner/core/result.py
@@ -1,6 +1,9 @@
from enum import Enum
+
from colorama import Fore, Style
+from user_scanner.core.helpers import ScanConfig
+
# Added {url} to the debug message
DEBUG_MSG = """Result {{
status: {status},
@@ -110,7 +113,7 @@ class Result:
"username": self.username,
"site_name": self.site_name,
"category": self.category,
- "url": self.url, # Added url to dictionary output
+ "url": self.url, # Added url to dictionary output
"is_email": self.is_email,
}
@@ -150,7 +153,7 @@ class Result:
else:
return "[βœ”]" if self == Status.TAKEN else "[✘]"
- def get_console_output(self, show_url=False) -> str:
+ def get_console_output(self, configs: ScanConfig | None = None) -> str:
site_name = self.site_name
status_text = self.status.to_label(self.is_email)
username = ""
@@ -161,7 +164,11 @@ class Result:
# Added logic to include URL in console output if show_url is True
## Color the URL in white for better visibility
- url_display = f" {Fore.WHITE}[{self.url}]{color}" if show_url and self.url else ""
+ url_display = (
+ f" {Fore.WHITE}[{self.url}]{color}"
+ if (configs and configs.show_url) and self.url
+ else ""
+ )
reason = f" ({self.get_reason()})" if self.has_reason() else ""
return f" {color}{icon} {site_name}{url_display} {username}: {status_text}{reason}{Style.RESET_ALL}"
@@ -170,12 +177,11 @@ class Result:
"""Returns True if the target was found or registered (Status.TAKEN)"""
return self.status == Status.TAKEN
-
- def show(self, show_url=False, only_found=False):
+ def show(self, configs: ScanConfig):
"""Prints the console output and returns itself for chaining.
If only_found is True, only results with Status.TAKEN are printed."""
# Updated show() to accept and pass the show_url flag
- if only_found and self.status != Status.TAKEN:
+ if configs.only_found and self.status != Status.TAKEN:
return self
- print(self.get_console_output(show_url=show_url))
+ print(self.get_console_output(configs))
return self