Skip to content

Commit 67faa92

Browse files
authored
Merge pull request #310 from kaifcodec/add/email-osint-modules
add(allen.py): new learning website in email_scan mode
2 parents 995d0ba + b1ce338 commit 67faa92

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

  • user_scanner/email_scan/learning
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import httpx
2+
from user_scanner.core.result import Result
3+
4+
5+
async def _check(email: str) -> Result:
6+
7+
url = f"https://api.allen-live.in/api/v1/user/identities/{email}"
8+
show_url = "https://allen.in"
9+
10+
headers = {
11+
'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36",
12+
'Accept': "application/json",
13+
'Accept-Encoding': "identity",
14+
'x-client-type': "mweb",
15+
'Origin': "https://allen.in",
16+
'Referer': "https://allen.in/",
17+
}
18+
19+
params = {
20+
'communicable': "true",
21+
'identity_type': "EMAIL"
22+
}
23+
24+
try:
25+
async with httpx.AsyncClient(timeout=10.0) as client:
26+
response = await client.get(url, params=params, headers=headers)
27+
28+
if response.status_code == 403:
29+
return Result.error("Blocked by Allen WAF (403)")
30+
31+
data = response.json()
32+
reason = data.get("reason", "")
33+
34+
# status 200 + reason "OK" means registered
35+
if data.get("status") == 200 and reason == "OK":
36+
identities = data.get("data", {}).get("identities", [])
37+
masked_phone = None
38+
39+
# masked phone in the identities list
40+
for item in identities:
41+
if item.get("identity_type") == "PHONE":
42+
masked_phone = item.get("identity_value")
43+
break
44+
45+
if masked_phone:
46+
return Result.taken(url=show_url, extra=f"Phone: +91{masked_phone}")
47+
return Result.taken(url=show_url)
48+
49+
# status 200 + "Invalid email" means not registered
50+
if "Invalid email" in reason:
51+
return Result.available(url=show_url)
52+
53+
return Result.error(f"Unknown response reason: {reason}")
54+
55+
except Exception as e:
56+
return Result.error(e)
57+
58+
59+
async def validate_allen(email: str) -> Result:
60+
return await _check(email)

0 commit comments

Comments
 (0)