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.

fix(patreon): clear the 403 and recognise the sso_required auth step (#535)

BrunoLMe22bba3648ad
diff --git a/user_scanner/email_scan/creator/patreon.py b/user_scanner/email_scan/creator/patreon.py
index b62f28f..c9e475c 100644
--- a/user_scanner/email_scan/creator/patreon.py
+++ b/user_scanner/email_scan/creator/patreon.py
@@ -1,63 +1,78 @@
-import httpx
+import json
+
+from user_scanner.core.impersonate import impersonate_request_async
from user_scanner.core.result import Result
+# Auth steps Patreon returns for an address that already has an account:
+# "password" for a local login, "sso_required" when the account can only be
+# reached through a social provider.
+_TAKEN_STEPS = ("password", "sso_required")
+
async def _check(email: str) -> Result:
- async with httpx.AsyncClient(timeout=15.0, http2=False) as client:
- try:
- url = "https://www.patreon.com/api/auth"
- show_url = "https://patreon.com"
-
- params = {
- 'include': "user.null",
- 'fields[user]': "[]",
- 'json-api-version': "1.0",
- 'json-api-use-default-includes': "false"
- }
-
- payload = "{\"data\":{\"type\":\"genericPatreonApi\",\"attributes\":{\"patreon_auth\":{\"email\":\"" + email + \
- "\",\"allow_account_creation\":false},\"auth_context\":\"auth\",\"ru\":\"https://www.patreon.com/home\"},\"relationships\":{}}}"
-
- headers = {
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36",
- 'Accept-Encoding': "gzip, deflate, br, zstd",
- 'sec-ch-ua-platform': '"Linux"',
- 'sec-ch-ua': '"Brave";v="149", "Chromium";v="149", "Not)A;Brand";v="24"',
- 'content-type': "application/vnd.api+json",
- 'sec-ch-ua-mobile': "?0",
- 'sec-gpc': "1",
- 'accept-language': "en-US,en;q=0.7",
- 'origin': "https://www.patreon.com",
- 'sec-fetch-site': "same-origin",
- 'sec-fetch-mode': "cors",
- 'sec-fetch-dest': "empty",
- 'referer': "https://www.patreon.com/login"
- }
-
- response = await client.post(
- url,
- params=params,
- content=payload,
- headers=headers,
- timeout=15.0
- )
+ url = "https://www.patreon.com/api/auth"
+ show_url = "https://patreon.com"
+
+ params = {
+ 'include': "user.null",
+ 'fields[user]': "[]",
+ 'json-api-version': "1.0",
+ 'json-api-use-default-includes': "false"
+ }
+
+ payload = json.dumps({
+ "data": {
+ "type": "genericPatreonApi",
+ "attributes": {
+ "patreon_auth": {"email": email, "allow_account_creation": False},
+ "auth_context": "auth",
+ "ru": "https://www.patreon.com/home",
+ },
+ "relationships": {},
+ }
+ })
- if response.status_code != 200:
- return Result.error(f"Status {response.status_code}, report it via GitHub issues")
+ headers = {
+ 'Accept-Encoding': "gzip, deflate, br, zstd",
+ 'content-type': "application/vnd.api+json",
+ 'sec-gpc': "1",
+ 'accept-language': "en-US,en;q=0.7",
+ 'origin': "https://www.patreon.com",
+ 'sec-fetch-site': "same-origin",
+ 'sec-fetch-mode': "cors",
+ 'sec-fetch-dest': "empty",
+ 'referer': "https://www.patreon.com/login"
+ }
+
+ try:
+ response = await impersonate_request_async(
+ url, "POST", params=params, data=payload, headers=headers
+ )
+
+ if response.status_code != 200:
+ return Result.error(f"Status {response.status_code}, report it via GitHub issues")
+
+ data = response.json()
+ attributes = (data.get("data") or {}).get("attributes") or {}
+ next_step = attributes.get("next_auth_step")
+
+ if next_step in _TAKEN_STEPS:
+ providers = attributes.get("supported_sso_providers") or []
+ return Result.taken(
+ url=show_url,
+ extra={
+ "login_method": "SSO" if next_step == "sso_required" else "password",
+ "sso_providers": ", ".join(providers),
+ },
+ )
- data = response.json()
- next_step = data.get("data", {}).get(
- "attributes", {}).get("next_auth_step")
+ if next_step == "signup":
+ return Result.available(url=show_url)
- if next_step == "password":
- return Result.taken(url=show_url)
- elif next_step == "signup":
- return Result.available(url=show_url)
- else:
- return Result.error("Unexpected auth step, report it via GitHub issues")
+ return Result.error("Unexpected auth step, report it via GitHub issues")
- except Exception as e:
- return Result.error(f"unexpected exception: {e}")
+ except Exception as e:
+ return Result.error(f"unexpected exception: {e}")
async def validate_patreon(email: str) -> Result: