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: add Troc Vélo email and username modules (#678)

Kristo Isberg1c1edc82a1e9
diff --git a/user_scanner/email_scan/shopping/trocvelo.py b/user_scanner/email_scan/shopping/trocvelo.py
new file mode 100644
index 0000000..2c741cb
--- /dev/null
+++ b/user_scanner/email_scan/shopping/trocvelo.py
@@ -0,0 +1,83 @@
+"""Silent Troc Vélo email registration check."""
+
+import base64
+import re
+
+from curl_cffi.requests.exceptions import RequestException
+
+from user_scanner.core.impersonate import impersonate_request_async
+from user_scanner.core.nextjs import iter_next_app_flight_chunks
+from user_scanner.core.result import Result
+
+SITE_URL = "https://www.troc-velo.com"
+SIGNUP_URL = f"{SITE_URL}/fr-fr/creation-de-compte/particulier"
+CHECK_URL = "https://api.troc-velo.com/api/users/check_email"
+TOKEN_DATA_RE = re.compile(
+ r'"apiCsrfToken"\s*:\s*"([^"]+)".*?'
+ r'"routeIdentifier"\s*:\s*"([^"]+)".*?'
+ r'"clientIp"\s*:\s*"([^"]+)"'
+)
+
+
+async def validate_trocvelo(email: str) -> Result:
+ """Check registration availability without creating an account or sending email."""
+ try:
+ page = await impersonate_request_async(
+ SIGNUP_URL, warmup_url=SITE_URL, allow_redirects=True
+ )
+ if page.status_code != 200:
+ return Result.error(
+ f"Unexpected signup status: {page.status_code}", url=SITE_URL
+ )
+
+ match = next(
+ (
+ match
+ for chunk in iter_next_app_flight_chunks(page.text)
+ if (match := TOKEN_DATA_RE.search(chunk))
+ ),
+ None,
+ )
+ if not match:
+ return Result.error("Registration token not found", url=SITE_URL)
+
+ encoded_token, route_identifier, client_ip = match.groups()
+ encoded_token = encoded_token[24:-48]
+ token = base64.urlsafe_b64decode(
+ encoded_token + "=" * (-len(encoded_token) % 4)
+ ).decode()
+
+ response = await impersonate_request_async(
+ CHECK_URL,
+ method="POST",
+ json={"email": email},
+ headers={
+ "Accept": "application/json, text/plain, */*",
+ "Origin": SITE_URL,
+ "Referer": f"{SITE_URL}/",
+ "token-signature": token,
+ "route-identifier": route_identifier,
+ "ip-forward": client_ip,
+ },
+ )
+ except (RequestException, ValueError) as exc:
+ return Result.error(exc, url=SITE_URL)
+
+ if response.status_code == 429:
+ return Result.error("Rate limited; try again later", url=SITE_URL)
+ if response.status_code != 200:
+ return Result.error(
+ f"Unexpected check status: {response.status_code}", url=SITE_URL
+ )
+
+ try:
+ data = response.json()
+ except ValueError:
+ return Result.error("Unexpected check response", url=SITE_URL)
+ match data:
+ case {"exists": True}:
+ return Result.taken(url=SITE_URL)
+ case {"exists": False}:
+ return Result.available(url=SITE_URL)
+ case _:
+ return Result.error("Email status was missing", url=SITE_URL)
diff --git a/user_scanner/user_scan/shopping/trocvelo.py b/user_scanner/user_scan/shopping/trocvelo.py
new file mode 100644
index 0000000..f31f39c
--- /dev/null
+++ b/user_scanner/user_scan/shopping/trocvelo.py
@@ -0,0 +1,157 @@
+import re
+import unicodedata
+from urllib.parse import urljoin
+
+from curl_cffi.requests.exceptions import RequestException
+
+from user_scanner.core.impersonate import impersonate_request
+from user_scanner.core.result import Result
+
+API_URL = "https://api.troc-velo.com/api/users"
+SITE_URL = "https://www.troc-velo.com/fr-fr"
+INTERESTS = {
+ "1": "Vélo de route",
+ "2": "VTT",
+ "3": "Triathlon",
+ "4": "Gravel",
+ "5": "Urbain",
+}
+
+
+def validate_trocvelo(user: str) -> Result:
+ username = user.strip()
+ try:
+ response = impersonate_request(
+ f"{API_URL}/check_username",
+ method="POST",
+ json={"username": username},
+ headers={"Accept": "application/json"},
+ )
+ if response.status_code != 200:
+ return Result.error(
+ f"Unexpected response status: {response.status_code}", url=SITE_URL
+ )
+
+ if (data := _json_object(response)) is None:
+ return Result.error("Unexpected response body", url=SITE_URL)
+
+ exists = data.get("exists")
+ if exists is False:
+ return Result.available(url=SITE_URL)
+ if exists is not True:
+ return Result.error("Username status was missing", url=SITE_URL)
+
+ extra, media, profile_url = _profile(username)
+ return Result.taken(extra=extra, media=media, url=profile_url or SITE_URL)
+ except RequestException as exc:
+ return Result.error(exc, url=SITE_URL)
+
+
+def _json_object(response) -> dict | None:
+ try:
+ data = response.json()
+ except ValueError:
+ return None
+ return data if isinstance(data, dict) else None
+
+
+def _profile(username: str) -> tuple[dict, dict, str | None]:
+ url = API_URL
+ params: dict[str, object] | None = {
+ "usernameCanonical": username,
+ "itemsPerPage": 1000,
+ }
+ while True:
+ response = impersonate_request(
+ url, params=params, headers={"Accept": "application/ld+json"}
+ )
+ if response.status_code != 200:
+ return {}, {}, None
+
+ if (data := _json_object(response)) is None:
+ return {}, {}, None
+
+ members = data.get("hydra:member", [])
+ if not isinstance(members, list):
+ return {}, {}, None
+
+ member = next(
+ (
+ item
+ for item in members
+ if isinstance(item, dict)
+ and str(item.get("username", "")).casefold() == username.casefold()
+ ),
+ None,
+ )
+ if member:
+ break
+
+ view = data.get("hydra:view")
+ next_page = view.get("hydra:next") if isinstance(view, dict) else None
+ if not isinstance(next_page, str):
+ return {}, {}, None
+ url, params = urljoin(API_URL, next_page), None
+
+ if not (slug := member.get("slug")):
+ return {}, {}, None
+
+ route = _slugify(str(member.get("username", "")))
+ profile_url = f"{SITE_URL}/user/{route}/{slug}" if route else None
+ response = impersonate_request(
+ f"{API_URL}/{slug}", headers={"Accept": "application/ld+json"}
+ )
+ if response.status_code != 200:
+ return {}, {}, profile_url
+
+ if (profile := _json_object(response)) is None:
+ return {}, {}, profile_url
+
+ extra = {
+ (
+ f"{_snake_case(key)}_reviews" if key.endswith("Star") else _snake_case(key)
+ ): value
+ for key, value in profile.items()
+ if not key.startswith("@")
+ and key
+ not in {
+ "avatar",
+ "country",
+ "countryOfResidence",
+ "interests",
+ "nationality",
+ "username",
+ "userBanner",
+ "userProConfiguration",
+ }
+ }
+ for key in ("country", "nationality", "countryOfResidence"):
+ value = profile.get(key)
+ extra[_snake_case(key)] = (
+ value.get("name") if isinstance(value, dict) else value
+ )
+
+ configuration = profile.get("userProConfiguration")
+ if isinstance(configuration, dict):
+ extra.update(
+ {
+ _snake_case(key): value
+ for key, value in configuration.items()
+ if not key.startswith("@")
+ }
+ )
+
+ interests = profile.get("interests") or []
+ extra["interests"] = [INTERESTS.get(str(value), str(value)) for value in interests]
+ extra = {key: value for key, value in extra.items() if value != []}
+ media = {"avatar": profile.get("avatar"), "banner": profile.get("userBanner")}
+ return extra, media, profile_url
+
+
+def _slugify(value: str) -> str:
+ value = unicodedata.normalize("NFKD", value).encode("ascii", "ignore").decode()
+ return re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
+
+
+def _snake_case(value: str) -> str:
+ return re.sub(r"(?<=[a-z0-9])(?=[A-Z])", "_", value).lower()