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.

feat(liberapay): extract the OAuth-verified accounts the profile vouches for

Bruno Leonardo Michels10ea4e92a310
diff --git a/user_scanner/user_scan/donation/liberapay.py b/user_scanner/user_scan/donation/liberapay.py
index fae13e7..81aa9b3 100644
--- a/user_scanner/user_scan/donation/liberapay.py
+++ b/user_scanner/user_scan/donation/liberapay.py
@@ -1,6 +1,18 @@
from user_scanner.core.orchestrator import generic_validate, Result
+import html
import re
+# Liberapay connects an "elsewhere" account through OAuth only, so the block the
+# profile renders is the site vouching for ownership rather than free text the
+# owner typed. /<user>/public.json omits it, leaving the page as the only source.
+ACCOUNTS_MARKER = "owns the following accounts on other platforms"
+ACCOUNTS_BLOCK_OPEN = '<div class="accounts">'
+DIV_TAG_RE = re.compile(r"</?div\b", re.I)
+ACCOUNT_ANCHOR_RE = re.compile(r'<a\b([^>]*\bclass="account-link"[^>]*)>(.*?)</a>', re.S)
+HREF_RE = re.compile(r'href="([^"]+)"')
+PLATFORM_RE = re.compile(r'<span class="sr-only">\s*([^<:]+?)\s*:?\s*</span>')
+
+
def validate_liberapay(user):
url = f"https://en.liberapay.com/{user}"
show_url = f"https://en.liberapay.com/{user}"
@@ -30,9 +42,51 @@ def validate_liberapay(user):
name = title_match.group(1).split("&#39;s profile")[0].split("'s profile")[0].strip()
if name.lower() != user.lower():
extra["name"] = name
+ accounts = _verified_accounts(response.text)
+ if accounts:
+ extra["verified_accounts"] = ", ".join(accounts)
return Result.taken(extra=extra)
elif response.status_code in (404, 410):
return Result.available()
return Result.error(f"Unexpected status {response.status_code}")
return generic_validate(url, process, show_url=show_url, headers=headers, follow_redirects=True)
+
+
+def _verified_accounts(page):
+ accounts = []
+ seen = set()
+ for match in ACCOUNT_ANCHOR_RE.finditer(_accounts_block(page)):
+ href = HREF_RE.search(match.group(1))
+ if not href:
+ continue
+ # Mastodon renders the visible name as user@instance, so the href is the
+ # only place a usable profile URL appears.
+ url = html.unescape(href.group(1)).strip()
+ if not url.startswith(("http://", "https://")) or url in seen:
+ continue
+ seen.add(url)
+ platform = PLATFORM_RE.search(match.group(2))
+ label = html.unescape(platform.group(1)).strip() if platform else "Account"
+ accounts.append(f"{label}: {url}")
+ return accounts
+
+
+def _accounts_block(page):
+ """The linked-accounts markup only, empty when the profile lists none.
+
+ The rest of the page renders donation relationships and patron lists naming
+ other people, so a document-wide sweep would harvest strangers.
+ """
+ marker = page.find(ACCOUNTS_MARKER)
+ if marker < 0:
+ return ""
+ start = page.find(ACCOUNTS_BLOCK_OPEN, marker)
+ if start < 0:
+ return ""
+ depth = 0
+ for tag in DIV_TAG_RE.finditer(page, start):
+ depth += -1 if tag.group(0).startswith("</") else 1
+ if depth == 0:
+ return page[start : tag.start()]
+ return ""