🕵️♂️ (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.
Python cybersecuritycybersecurity-toolsemail-osintethical-hackingethical-hacking-toolsidentificationinfosecosintosint-emailosint-toolosint-toolsosint-usernamepentestingpythonredteam-toolsredteamingthreat-intelligence
feat(user_scan): add Creative Market username modules (#680)
Kristo Isberg1d8df7cfb540
diff --git a/tests/test_impersonate.py b/tests/test_impersonate.pyindex a0d755f..7b1c73a 100644--- a/tests/test_impersonate.py+++ b/tests/test_impersonate.py@@ -75,6 +75,25 @@ def test_request_reuses_warm_session(monkeypatch):assert urls == ["https://site/", "https://site/a", "https://site/graphql"]+def test_each_origin_gets_its_own_warmup(monkeypatch):+ _reset(monkeypatch)++ impersonate.impersonate_validate(+ "https://one.test/profile", _process, warmup_url="https://one.test/"+ )+ impersonate.impersonate_validate(+ "https://two.test/profile", _process, warmup_url="https://two.test/"+ )++ urls = [call[0] for call in FakeSession.instances[0].calls]+ assert urls == [+ "https://one.test/",+ "https://one.test/profile",+ "https://two.test/",+ "https://two.test/profile",+ ]++def test_exception_becomes_error_result(monkeypatch):_reset(monkeypatch)@@ -99,4 +118,3 @@ def test_get_warm_session_and_timeout(monkeypatch):timeout = impersonate.get_impersonate_timeout()assert timeout == impersonate.DEFAULT_TIMEOUT-diff --git a/user_scanner/core/impersonate.py b/user_scanner/core/impersonate.pyindex 5b97a97..823eea5 100644--- a/user_scanner/core/impersonate.py+++ b/user_scanner/core/impersonate.py@@ -97,6 +97,7 @@ def _get_warm_session(impersonate: str, proxy: Optional[str], warmup_url: Optional[str]) -> cffi.Session:key = (impersonate, proxy)+ warmup_key = (*key, warmup_url)with _lock:session = _sessions.get(key)if session is None:@@ -114,13 +115,13 @@ def _get_warm_session(key_lock = threading.Lock()_key_locks[key] = key_lock- if warmup_url and key not in _warmed:+ if warmup_url and warmup_key not in _warmed:with key_lock:- if key not in _warmed:+ if warmup_key not in _warmed:# A blocked (403) warm-up still returns normally and sets the cookie;# only a network error leaves the session unwarmed for a later retry.session.get(warmup_url, timeout=_timeout())- _warmed.add(key)+ _warmed.add(warmup_key)return sessiondiff --git a/user_scanner/user_scan/creative/creativemarket.py b/user_scanner/user_scan/creative/creativemarket.pynew file mode 100644index 0000000..149d9b7--- /dev/null+++ b/user_scanner/user_scan/creative/creativemarket.py@@ -0,0 +1,83 @@+import json+import re+from html import unescape+from urllib.parse import quote++from user_scanner.core.impersonate import impersonate_validate+from user_scanner.core.result import Result+++BASE_URL = "https://creativemarket.com/"+NOT_FOUND_MARKER = "Whoomp, there it isn't!"+++def validate_creativemarket(user: str) -> Result:+ url = f"{BASE_URL}users/{quote(user, safe='')}"++ def process(response) -> Result:+ if response.status_code == 404:+ if NOT_FOUND_MARKER in response.text:+ return Result.available()+ return Result.error("Creative Market 404 response missing not-found marker")++ if response.status_code != 200:+ return Result.error(f"Unexpected status code: {response.status_code}")++ match = re.search(+ r"var _jsConfig = (\{.*?\});\s*var APP", response.text, re.DOTALL+ )+ if not match:+ return Result.error("Creative Market profile data not found")++ try:+ config = json.loads(match.group(1))+ except json.JSONDecodeError:+ return Result.error("Invalid Creative Market profile data")++ profile = config.get("pageData")+ if not isinstance(profile, dict) or config.get("page_type") != "user_activity":+ return Result.error("Unexpected Creative Market profile payload")++ username = profile.get("username")+ if not isinstance(username, str) or username.casefold() != user.casefold():+ return Result.error("Creative Market returned a different user")++ is_private = profile.get("isPrivate")+ extra = {+ "name": _profile_name(response.text, username),+ "bio": unescape(profile.get("userBio") or ""),+ "location": profile.get("userLocation"),+ "created": profile.get("userCreatedDate"),+ "followers": profile.get("numFollowers"),+ "following": profile.get("numFollowing"),+ "id": profile.get("userID"),+ "activity_public": not is_private if isinstance(is_private, bool) else None,+ "shop_owner": profile.get("shopExists"),+ "shop_title": profile.get("shopTitle"),+ "shop_rating": profile.get("shopReviewRating"),+ "shop_sales": profile.get("shopNumSales"),+ }+ for social in profile.get("socialLinks") or []:+ if isinstance(social, dict) and social.get("platform") and social.get("link"):+ extra[str(social["platform"]).lower()] = social["link"]++ return Result.taken(+ extra=extra,+ media={"avatar": profile.get("avatarUrl")},+ )++ return impersonate_validate(+ url,+ process,+ warmup_url=BASE_URL,+ allow_redirects=True,+ )+++def _profile_name(document: str, username: str) -> str | None:+ match = re.search(+ rf"<title[^>]*>(.*?) \({re.escape(username)}\)\s*</title>",+ document,+ re.DOTALL | re.IGNORECASE,+ )+ return unescape(match.group(1)).strip() if match else Nonediff --git a/user_scanner/user_scan/creative/creativemarket_shop.py b/user_scanner/user_scan/creative/creativemarket_shop.pynew file mode 100644index 0000000..99f6b0e--- /dev/null+++ b/user_scanner/user_scan/creative/creativemarket_shop.py@@ -0,0 +1,123 @@+import json+import re+from html import unescape+from urllib.parse import quote, urlparse++from user_scanner.core.impersonate import impersonate_validate+from user_scanner.core.result import Result+++BASE_URL = "https://creativemarket.com/"+NOT_FOUND_MARKER = "<title>Resource no longer available</title>"+++def validate_creativemarket_shop(user: str) -> Result:+ url = f"{BASE_URL}{quote(user, safe='')}"++ def process(response) -> Result:+ if response.status_code == 410:+ if NOT_FOUND_MARKER in response.text:+ return Result.available()+ return Result.error("Creative Market 410 response missing not-found marker")++ if response.status_code != 200:+ return Result.error(f"Unexpected status code: {response.status_code}")++ match = re.search(+ r"var _jsConfig = (\{.*?\});\s*var APP", response.text, re.DOTALL+ )+ if not match:+ return Result.error("Creative Market shop data not found")++ try:+ config = json.loads(match.group(1))+ except json.JSONDecodeError:+ return Result.error("Invalid Creative Market shop data")++ shop = config.get("pageData")+ if not isinstance(shop, dict):+ return Result.error("Unexpected Creative Market shop payload")++ username = shop.get("username")+ if not isinstance(username, str) or username.casefold() != user.casefold():+ return Result.error("Creative Market returned a different user")++ if config.get("page_type") == "user_activity":+ if shop.get("shopExists") is False:+ return Result.available()+ return Result.error("Creative Market account has an inconsistent shop state")++ if config.get("page_type") != "user_shop" or shop.get("shopExists") is not True:+ return Result.error("Unexpected Creative Market shop payload")++ extra = {+ "name": shop.get("shopTitle"),+ "description": unescape(shop.get("userBio") or ""),+ "location": shop.get("userLocation"),+ "created": shop.get("shopCreatedDate"),+ "account_created": shop.get("userCreatedDate"),+ "id": shop.get("shopID"),+ "owner_id": shop.get("userID"),+ "followers": shop.get("numFollowers"),+ "following": shop.get("numFollowing"),+ "rating": shop.get("shopReviewRating"),+ "sales": shop.get("shopNumSales"),+ "featured": shop.get("isFeaturedBadgeEnabled"),+ }++ website = _url(shop.get("shopWebsite"))+ if website:+ extra["website"] = website++ for key, value in (+ ("products", shop.get("productResultData")),+ ("reviews", shop.get("shopReviews")),+ ("updates", shop.get("shopUpdates")),+ ):+ if isinstance(value, dict) and isinstance(value.get("pagination"), dict):+ extra[key] = value["pagination"].get("totalResults")++ product_data = shop.get("productResultData")+ products = product_data.get("products") if isinstance(product_data, dict) else None+ product_shop = (+ products[0].get("shop")+ if products and isinstance(products[0], dict)+ else None+ )+ if isinstance(product_shop, dict):+ extra.update(+ active=product_shop.get("is_active"),+ recommendation_percent=product_shop.get("recommendation_percent"),+ recommendations_up=product_shop.get("recommendations_up"),+ recommendations_down=product_shop.get("recommendations_down"),+ )++ for social in shop.get("socialLinks") or []:+ if not isinstance(social, dict) or not social.get("platform"):+ continue+ if link := _url(social.get("link")):+ extra[str(social["platform"]).lower()] = link++ return Result.taken(+ extra=extra,+ media={+ "avatar": shop.get("avatarUrl"),+ "banner": shop.get("bannerImage"),+ "about": shop.get("aboutImageUrl"),+ },+ )++ return impersonate_validate(+ url,+ process,+ warmup_url=BASE_URL,+ impersonate="chrome120",+ allow_redirects=True,+ )+++def _url(value) -> str | None:+ if not isinstance(value, str):+ return None+ parsed = urlparse(value)+ return value if parsed.scheme in {"http", "https"} and parsed.netloc else None