🕵️♂️ (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(livejournal): resolve journals, and split purged from suspended (#543)
BrunoLMb21339d72710
diff --git a/user_scanner/user_scan/social/livejournal.py b/user_scanner/user_scan/social/livejournal.pyindex f9e7bf0..fd6ff1a 100644--- a/user_scanner/user_scan/social/livejournal.py+++ b/user_scanner/user_scan/social/livejournal.py@@ -1,38 +1,97 @@-import reimport json-from user_scanner.core.helpers import get_random_user_agent-from user_scanner.core.orchestrator import Result, make_request+import re++from user_scanner.core.impersonate import impersonate_validate+from user_scanner.core.result import Result++# The journal subdomain answers a ~750 KB page and stalls Python's TLS stack;+# the profile page carries the same Site.journal payload and always resolves.+PROFILE_URL = "https://www.livejournal.com/profile/"+JOURNAL_RE = re.compile(r"Site\.journal\s*=\s*(\{.+?\});")+NOT_FOUND_MARKER = "The page was not found!"++# A purged journal frees its username for re-registration ("You can rename your+# account with this username"); a suspended one keeps it.+PURGED_MARKER = "This journal has been deleted and purged"+SUSPENDED_MARKER = "This journal has been suspended"+++def validate_livejournal(user: str) -> Result:+ show_url = f"https://{user}.livejournal.com"++ def process(response):+ if response.status_code == 404 and NOT_FOUND_MARKER in response.text:+ return Result.available()++ if response.status_code == 410 and PURGED_MARKER in response.text:+ return Result.available()++ if response.status_code == 403 and SUSPENDED_MARKER in response.text:+ return Result.taken(extra={"status": "suspended"})++ if response.status_code != 200:+ return Result.error(f"Unexpected status: {response.status_code}")++ journal = _journal(response.text)+ if not journal:+ return Result.error("200 response with no journal data")++ # Guard against the generic profile shell: only the requested journal's+ # own page echoes its username back.+ if _canonical(journal.get("display_username", "")) != _canonical(user):+ return Result.error("200 response for a different journal")-def validate_livejournal(user):- url = f"https://{user}.livejournal.com"- show_url = url- headers = {"User-Agent": get_random_user_agent()}+ return Result.taken(extra=_extract(journal), media=_media(journal))+ return impersonate_validate(+ PROFILE_URL, process, params={"user": user}, show_url=show_url+ )+++def _canonical(username) -> str:+ # LiveJournal usernames are case-insensitive and treat "-" and "_" as the+ # same character, so james-nicoll and JAMES_NICOLL are one journal.+ return str(username).lower().replace("-", "_")+++def _journal(body: str) -> dict:+ match = JOURNAL_RE.search(body)+ if not match:+ return {}try:- response = make_request(url, headers=headers)- if response.status_code == 200:- extra = {}- match = re.search(r'Site\.journal\s*=\s*({.+?});', response.text)- if match:- try:- data = json.loads(match.group(1))- if 'id' in data: extra['uid'] = data['id']- if 'display_username' in data: extra['name'] = data['display_username']- if 'is_paid' in data: extra['is_paid'] = data['is_paid']- if 'is_community' in data: extra['is_community'] = data['is_community']- except Exception:- pass- return Result.taken(extra=extra, url=show_url)- elif response.status_code == 404:- return Result.available(url=show_url)- elif response.status_code in [403, 410, 302, 301]:- # Non-existent user might redirect or give 404- # If 403, usually suspended (which means taken)- if response.status_code == 403:- return Result.taken(extra={"status": "suspended or forbidden"}, url=show_url)- # Fallback for others- return Result.available(url=show_url)- else:- return Result.error(f"Unexpected status: {response.status_code}", url=show_url)- except Exception as e:- return Result.error(e, url=show_url)+ data = json.loads(match.group(1))+ except json.JSONDecodeError:+ return {}+ return data if isinstance(data, dict) else {}+++def _extract(journal: dict) -> dict:+ extra: dict = {}++ if uid := journal.get("id"):+ extra["uid"] = uid+ if name := journal.get("display_username"):+ extra["name"] = name+ if subtitle := journal.get("journal_subtitle"):+ extra["subtitle"] = subtitle+ if url := journal.get("journal_url"):+ extra["journal_url"] = url++ extra["type"] = _account_type(journal)+ if journal.get("is_paid"):+ extra["is_paid"] = True++ return extra+++def _account_type(journal: dict) -> str:+ if journal.get("is_syndicated"):+ return "syndicated feed"+ if journal.get("is_news"):+ return "news"+ return "personal" if journal.get("is_personal") else "community"+++def _media(journal: dict) -> dict:+ userhead = journal.get("userhead_url")+ return {"userhead": userhead} if userhead else {}