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(result.py): swap formatting and status display logic for ema…

Jason Huntera350ec1e8326
diff --git a/user_scanner/core/result.py b/user_scanner/core/result.py
index bf4a8c3..1e59f19 100644
--- a/user_scanner/core/result.py
+++ b/user_scanner/core/result.py
@@ -23,12 +23,10 @@ CSV_TEMPLATE = "{username},{category},{site_name},{status},{reason}"
def humanize_exception(e: Exception) -> str:
msg = str(e).lower()
-
if "10054" in msg:
return "Connection closed by remote server"
if "11001" in msg:
return "Could not resolve hostname"
-
return str(e)
@@ -38,7 +36,6 @@ class Status(Enum):
ERROR = 2
def to_label(self, is_email=False):
- """Returns the appropriate text label based on the scan type"""
if self == Status.ERROR:
return "Error"
if is_email:
@@ -53,11 +50,10 @@ class Result:
def __init__(self, status: Status, reason: str | Exception | None = None, **kwargs):
self.status = status
self.reason = reason
-
self.username = None
self.site_name = None
self.category = None
- self.is_email = False # Track if this is an email result
+ self.is_email = False
self.update(**kwargs)
def update(self, **kwargs):
@@ -83,7 +79,6 @@ class Result:
status = Status(i)
except ValueError:
return cls(Status.ERROR, "Invalid status. Please contact maintainers.")
-
return cls(status, reason if status == Status.ERROR else None)
def to_number(self) -> int:
@@ -97,13 +92,12 @@ class Result:
return ""
if isinstance(self.reason, str):
return self.reason
- # Format the exception
msg = humanize_exception(self.reason)
return f"{type(self.reason).__name__}: {msg.capitalize()}"
def as_dict(self) -> dict:
return {
- "status": self.status.to_label(self.is_email), # Use dynamic labels
+ "status": self.status.to_label(self.is_email),
"reason": self.get_reason(),
"username": self.username,
"site_name": self.site_name,
@@ -129,13 +123,10 @@ class Result:
def __eq__(self, other):
if isinstance(other, Status):
return self.status == other
-
if isinstance(other, Result):
return self.status == other.status
-
if isinstance(other, int):
return self.to_number() == other
-
return NotImplemented
def get_console_output(self) -> str:
@@ -143,14 +134,17 @@ class Result:
username = self.username
status_text = self.status.to_label(self.is_email)
- if self == Status.AVAILABLE:
- return f" {Fore.GREEN}[βœ”] {site_name} ({username}): {status_text}{Style.RESET_ALL}"
- elif self == Status.TAKEN:
- return f" {Fore.RED}[✘] {site_name} ({username}): {status_text}{Style.RESET_ALL}"
+ if self.is_email:
+ color = Fore.GREEN if self == Status.TAKEN else Fore.RED
+ icon = "[βœ”]" if self == Status.TAKEN else "[✘]"
+ else:
+ color = Fore.GREEN if self == Status.AVAILABLE else Fore.RED
+ icon = "[βœ”]" if self == Status.AVAILABLE else "[✘]"
+
+ if self == Status.AVAILABLE or self == Status.TAKEN:
+ return f" {color}{icon} {site_name} ({username}): {status_text}{Style.RESET_ALL}"
elif self == Status.ERROR:
- reason = ""
- if isinstance(self, Result) and self.has_reason():
- reason = f" ({self.get_reason()})"
+ reason = f" ({self.get_reason()})" if self.has_reason() else ""
return f" {Fore.YELLOW}[!] {site_name} ({username}): {status_text}{reason}{Style.RESET_ALL}"
return ""