🕵️♂️ (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
fix(types): fix mypy implicit optional and import type errors in pdf_generator and formatter
Kaif86e8c982b332
diff --git a/user_scanner/core/formatter.py b/user_scanner/core/formatter.pyindex 213ef39..28364e4 100644--- a/user_scanner/core/formatter.py+++ b/user_scanner/core/formatter.py@@ -1,5 +1,5 @@import json-from typing import List+from typing import List, Optionalfrom user_scanner.core.result import CSV_FIELDS, Result@@ -23,9 +23,9 @@ def into_pdf(results: List[Result],target: str = "Target",scan_type: str = "Unknown",- total_modules: int = None,+ total_modules: Optional[int] = None,include_media: bool = True,- version: str = None,+ version: Optional[str] = None,) -> bytes:from user_scanner.core.pdf_generator import generate_pdf_reportdiff --git a/user_scanner/core/pdf_generator.py b/user_scanner/core/pdf_generator.pyindex 417507a..ca79ffb 100644--- a/user_scanner/core/pdf_generator.py+++ b/user_scanner/core/pdf_generator.py@@ -6,23 +6,23 @@ from typing import List, Any, Optionalimport httpxtry:- from reportlab.lib.pagesizes import A4- from reportlab.lib import colors- from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle- from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, Image as RLImage, KeepTogether- from reportlab.lib.units import inch+ from reportlab.lib.pagesizes import A4 # type: ignore[import-untyped,import-not-found]+ from reportlab.lib import colors # type: ignore[import-untyped,import-not-found]+ from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle # type: ignore[import-untyped,import-not-found]+ from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, Image as RLImage, KeepTogether # type: ignore[import-untyped,import-not-found]+ from reportlab.lib.units import inch # type: ignore[import-untyped,import-not-found]REPORTLAB_AVAILABLE = Trueexcept ImportError:REPORTLAB_AVAILABLE = Falsetry:- from PIL import Image as PILImage+ from PIL import Image as PILImage # type: ignore[import-untyped,import-not-found]PIL_AVAILABLE = Trueexcept ImportError:PIL_AVAILABLE = Falsetry:- from svglib.svglib import svg2rlg+ from svglib.svglib import svg2rlg # type: ignore[import-untyped,import-not-found]SVGLIB_AVAILABLE = Trueexcept ImportError:SVGLIB_AVAILABLE = False@@ -79,8 +79,8 @@ def fetch_and_resize_image(url: str, size: tuple = (60, 60)) -> Optional[Any]:except Exception:pass- img = PILImage.open(io.BytesIO(resp.content))- img = img.convert("RGB")+ img_raw = PILImage.open(io.BytesIO(resp.content))+ img = img_raw.convert("RGB")# Crop to squaremin_dim = min(img.width, img.height)@@ -88,11 +88,11 @@ def fetch_and_resize_image(url: str, size: tuple = (60, 60)) -> Optional[Any]:top = (img.height - min_dim) / 2right = (img.width + min_dim) / 2bottom = (img.height + min_dim) / 2- img = img.crop((left, top, right, bottom))- img = img.resize(size, PILImage.Resampling.LANCZOS)+ cropped = img.crop((left, top, right, bottom))+ resized = cropped.resize(size, PILImage.Resampling.LANCZOS)img_byte_arr = io.BytesIO()- img.save(img_byte_arr, format="JPEG")+ resized.save(img_byte_arr, format="JPEG")img_byte_arr.seek(0)return img_byte_arrexcept Exception: