🕵️♂️ (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(sourceforge): verify accounts through the Allura REST profile
Bruno Leonardo Michelsba2298820069
diff --git a/user_scanner/user_scan/dev/sourceforge.py b/user_scanner/user_scan/dev/sourceforge.pyindex 69f1652..7648250 100644--- a/user_scanner/user_scan/dev/sourceforge.py+++ b/user_scanner/user_scan/dev/sourceforge.py@@ -1,6 +1,19 @@+import htmlimport re-from user_scanner.core.orchestrator import Result, status_validate+from user_scanner.core.impersonate import impersonate_request+from user_scanner.core.result import Result++BASE_URL = "https://sourceforge.net"++# Cloudflare answers every other curl_cffi fingerprint (including the default+# "chrome") with a "Just a moment..." interstitial on this host; "safari184" is+# the only profile that reaches the origin. The same page comes back with 429+# once the host starts rate limiting, so it is matched on its title, not status.+IMPERSONATE = "safari184"++NOT_FOUND_TITLE = "Page not found - SourceForge.net"+MAX_LISTED_PROJECTS = 20def validate_sourceforge(user: str) -> Result:@@ -13,7 +26,156 @@ def validate_sourceforge(user: str) -> Result:return Result.error("Only use lowercase letters, numbers, and dashes.")- url = f"https://sourceforge.net/u/{user}/"- show_url = f"https://sourceforge.net/u/{user}/"+ show_url = f"{BASE_URL}/u/{user}/profile/"++ try:+ response = impersonate_request(+ f"{BASE_URL}/rest/u/{user}/profile", impersonate=IMPERSONATE, allow_redirects=True+ )+ except Exception as e:+ return Result.error(e, url=show_url)++ if _is_challenge(response.text):+ return Result.error("Blocked by a Cloudflare challenge", url=show_url)++ if response.status_code == 404:+ if _title(response.text) == NOT_FOUND_TITLE:+ return Result.available(url=show_url)+ return Result.error("Unexpected 404 (not the not-found page)", url=show_url)++ if response.status_code != 200:+ return Result.error(f"Unexpected status: {response.status_code}", url=show_url)++ try:+ profile = response.json()+ except Exception:+ return Result.error("Profile endpoint did not return JSON", url=show_url)++ if str(profile.get("username", "")).lower() != user.lower():+ return Result.error("Profile confirmation not found", url=show_url)++ extra, media = _extract_page(user)+ extra.update(_extract_profile(profile))++ return Result.taken(extra=extra, media=media, url=show_url)+++def _extract_page(user: str) -> tuple[dict, dict]:+ """Read the headline, latest activity and avatar, which the REST profile+ does not expose. Best effort: a failure here must not affect the verdict."""+ try:+ response = impersonate_request(+ f"{BASE_URL}/u/{user}/profile/", impersonate=IMPERSONATE, allow_redirects=True+ )+ except Exception:+ return {}, {}++ if response.status_code != 200 or _is_challenge(response.text):+ return {}, {}++ page = response.text+ extra: dict = {}+ media: dict = {}++ # The activity feed below repeats both the avatar and h2 markup for other+ # users, so the header block is the only safe place to read them from.+ header = _slice(page, '<div class="overview">', "</section>")++ headline = re.search(r'<h2 class="as-h3 summary">(.*?)</h2>', header, re.DOTALL)+ if headline:+ extra["headline"] = _text(headline.group(1))++ # The activity feed is ordered newest first.+ activity = re.search(r'<time datetime="([^"]+)"', page)+ if activity:+ extra["last_activity"] = activity.group(1)++ avatar = re.search(r'<img[^>]+src="([^"]*user_icon[^"]*)"', header)+ if avatar:+ media["avatar"] = html.unescape(avatar.group(1))++ return extra, media+++def _extract_profile(profile: dict) -> dict:+ extra: dict = {}++ if profile.get("name"):+ extra["name"] = profile["name"]++ if profile.get("joined"):+ extra["joined"] = profile["joined"]++ localization = profile.get("localization") or {}+ location = ", ".join(+ part for part in (localization.get("city"), localization.get("country")) if part+ )+ if location:+ extra["location"] = location++ # The field defaults to "Unknown" for everyone who never set it.+ if profile.get("sex") and profile["sex"] != "Unknown":+ extra["sex"] = profile["sex"]++ if profile.get("webpages"):+ extra["webpages"] = ", ".join(profile["webpages"])++ if profile.get("telnumbers"):+ extra["phone_numbers"] = ", ".join(profile["telnumbers"])++ socials = "; ".join(+ f"{entry.get('socialnetwork')}: {entry.get('accounturl')}"+ for entry in profile.get("socialnetworks") or []+ if entry.get("accounturl")+ )+ if socials:+ extra["social_networks"] = socials++ skills = "; ".join(_format_skill(entry) for entry in profile.get("skills") or [])+ if skills:+ extra["skills"] = skills++ availability = "; ".join(+ f"{slot.get('week_day')} {slot.get('start_time')}-{slot.get('end_time')}"+ for slot in profile.get("availability") or []+ )+ if availability:+ extra["availability"] = availability++ projects = profile.get("projects") or []+ if projects:+ extra["projects"] = len(projects)+ names = [project.get("name", "") for project in projects[:MAX_LISTED_PROJECTS]]+ if len(projects) > MAX_LISTED_PROJECTS:+ names.append(f"(+{len(projects) - MAX_LISTED_PROJECTS} more)")+ extra["project_names"] = ", ".join(name for name in names if name)++ return extra+++def _format_skill(entry: dict) -> str:+ skill = entry.get("skill") or {}+ name = skill.get("fullname") or skill.get("fullpath") or skill.get("shortname") or ""+ level = entry.get("level")+ return f"{name} ({level})" if name and level else name+++def _is_challenge(page: str) -> bool:+ return _title(page) == "Just a moment..."+++def _title(page: str) -> str:+ match = re.search(r"<title[^>]*>(.*?)</title>", page, re.IGNORECASE | re.DOTALL)+ return _text(match.group(1)) if match else ""+++def _slice(page: str, start_marker: str, end_marker: str) -> str:+ start = page.find(start_marker)+ if start < 0:+ return ""+ end = page.find(end_marker, start + len(start_marker))+ return page[start:end] if end > 0 else page[start:]+- return status_validate(url, 404, 200, show_url=show_url, follow_redirects=True)+def _text(markup: str) -> str:+ return html.unescape(re.sub(r"\s+", " ", re.sub(r"<[^>]+>", " ", markup))).strip()