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.

3.7 KB
Raw Blame
import httpx
import re
from user_scanner.core.result import Result

# screener.in renders its "field required" error with Django's errorlist markup.
# Django now emits an id on that <ul> (id="id_<field>_error"), so the previous
# exact-tag string match stopped matching and every address fell through to the
# "unexpected response body structure" error. Match on the class and the message
# it wraps instead, so the check survives further attribute changes.
_REQUIRED_FIELD_ERROR = re.compile(
    r'<ul[^>]*\sclass="[^"]*\berrorlist\b[^"]*"[^>]*>\s*<li>\s*This field is required\.\s*</li>',
    re.IGNORECASE,
)


async def _check(email: str) -> Result:
    url = "https://www.screener.in/register/"
    show_url = "https://www.screener.in"

    headers = {
        'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36",
        'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
        'Accept-Language': "en-US,en;q=0.5",
        'sec-ch-ua-platform': '"Android"',
        'sec-ch-ua': '"Brave";v="147", "Not.A/Brand";v="8", "Chromium";v="147"',
        'sec-ch-ua-mobile': "?1",
        'Upgrade-Insecure-Requests': "1",
    }

    try:
        async with httpx.AsyncClient(timeout=15.0, follow_redirects=True) as client:
            init_res = await client.get(url, headers=headers)

            if init_res.status_code == 403:
                return Result.error("Caught by WAF or IP Block (403)")
            if init_res.status_code == 429:
                return Result.error("Rate limited by Screener (429)")
            if init_res.status_code != 200:
                return Result.error(f"HTTP Error: {init_res.status_code}")

            csrf_middleware = re.search(
                r'name="csrfmiddlewaretoken" value="([^"]+)"', init_res.text)
            reg_token = re.search(
                r'name="token" value="([^"]+)"', init_res.text)

            if not csrf_middleware or not reg_token:
                return Result.error("Unexpected response body structure, report it via GitHub issues")

            payload = {
                'csrfmiddlewaretoken': csrf_middleware.group(1),
                'next': "",
                'token': reg_token.group(1),
                'email': email,
                'email2': email,
                'password': ""
            }

            api_headers = headers.copy()
            api_headers.update({
                'Origin': "https://www.screener.in",
                'Referer': url,
            })

            response = await client.post(url, data=payload, headers=api_headers)

            if response.status_code == 403:
                return Result.error("Caught by WAF or IP Block (403)")
            if response.status_code == 429:
                return Result.error("Rate limited by Screener (429)")
            if response.status_code != 200:
                return Result.error(f"HTTP Error: {response.status_code}")

            res_text = response.text

            if "User account with this Email already exists" in res_text:
                return Result.taken(url=show_url)

            if _REQUIRED_FIELD_ERROR.search(res_text):
                return Result.available(url=show_url)

            return Result.error("Unexpected response body structure, report it via GitHub issues")

    except httpx.ConnectTimeout:
        return Result.error("Connection timed out! maybe region blocks")
    except httpx.ReadTimeout:
        return Result.error("Server took too long to respond (Read Timeout)")
    except Exception as e:
        return Result.error(e)


async def validate_screener(email: str) -> Result:
    return await _check(email)