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(walmart): status code 412 fix (#353)

Kaife8ce286abe51
diff --git a/user_scanner/email_scan/shopping/walmart.py b/user_scanner/email_scan/shopping/walmart.py
index c7b93ff..aa28a8c 100644
--- a/user_scanner/email_scan/shopping/walmart.py
+++ b/user_scanner/email_scan/shopping/walmart.py
@@ -41,18 +41,18 @@ async def _check(email: str) -> Result:
}
headers = {
- 'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Mobile Safari/537.36",
+ 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
'Accept': "application/json",
'Accept-Encoding': "identity",
'Content-Type': "application/json",
'x-o-mart': "B2C",
'x-o-gql-query': "query GetLoginOptions",
- 'sec-ch-ua-platform': '"Android"',
+ 'sec-ch-ua-platform': '"Windows"',
'x-o-segment': "oaoh",
'device_profile_ref_id': "xpmjgxfheteohb199lo0r5qewtwjywqaifje",
- 'sec-ch-ua': '"Not:A-Brand";v="99", "Google Chrome";v="145", "Chromium";v="145"',
+ 'sec-ch-ua': '"Not:A-Brand";v="99", "Google Chrome";v="124", "Chromium";v="124"',
'x-enable-server-timing': "1",
- 'sec-ch-ua-mobile': "?1",
+ 'sec-ch-ua-mobile': "?0",
'x-latency-trace': "1",
'traceparent': trace_id,
'wm_mp': "true",
@@ -76,7 +76,16 @@ async def _check(email: str) -> Result:
}
try:
- async with httpx.AsyncClient(timeout=10.0) as client:
+ async with httpx.AsyncClient(timeout=10.0, follow_redirects=True) as client:
+ # Step 1: Request the login page to initialize cookie sessions and bypass 412 errors
+ # MUST use the identical User-Agent to avoid session mismatches causing 412 errors.
+ await client.get(headers['wm_page_url'], headers={
+ 'User-Agent': headers['User-Agent'],
+ 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
+ 'Accept-Language': "en-US,en;q=0.9",
+ })
+
+ # Step 2: Post to the GraphQL endpoint
response = await client.post(url, content=json.dumps(payload), headers=headers)
if response.status_code == 429:
@@ -89,14 +98,28 @@ async def _check(email: str) -> Result:
return Result.error(f"HTTP Error: {response.status_code}")
data = response.json()
+ errors = data.get("errors", [])
+
+ # Check if there is an error stating Enum can't represent STEP_UP_REQUIRED
+ # This validation failure happens specifically on existing accounts requiring a step-up check
+ if errors and any("STEP_UP_REQUIRED" in err.get("message", "") for err in errors):
+ return Result.taken(url=show_url)
+
login_data = data.get("data", {}).get("getLoginOptions", {})
- login_options = login_data.get("loginOptions", {})
- errors = login_data.get("errors", [])
+ if login_data is None:
+ return Result.error("GraphQL getLoginOptions returned null")
+
+ login_options = login_data.get("loginOptions", {}) or {}
+ login_errors = login_data.get("errors", []) or []
+
+ # Check if errors indicates a non-existent email
+ if any(err.get("code") == "EMAIL_ID_INVALID" for err in login_errors):
+ return Result.available(url=show_url)
pref = login_options.get("signInPreference", "")
if pref in ["PASSWORD", "CHOICE"]:
- if any(err.get("code") == "COMPROMISED" for err in errors):
+ if any(err.get("code") == "COMPROMISED" for err in login_errors):
return Result.taken("Account flagged as compromised")
return Result.taken(url=show_url)