feat: exhaustive feature expansion — cookie modes, DNS/WebRTC testers, map, Firefox fix
Cookie system: - Expand from 5 to 12 fully-specified CookiePolicy modes in browser_identity.py - Add CookiePolicy dataclass: behavior, lifetime, TCP partitioning, clearOnShutdown.* - browser_profile.py emits full cookie pref set from policy object - UI dropdown widened to 680px with live description label per mode Firefox launch fix: - Detect Firefox via Windows registry, AppData, and shutil.which - Use DETACHED_PROCESS|CREATE_NO_WINDOW|CREATE_NEW_PROCESS_GROUP flags - Wait up to 3s for firefox.exe in tasklist instead of polling parent pid - taskkill on stop() to terminate all firefox.exe processes DNS leak tester: - dns_leak.py: FullDnsLeakReport dataclass, run_dns_leak_test comparing proxy DoH resolution vs direct system DNS WebRTC tester: - webrtc_check.py: STUN UDP probe, registry policy check, user.js pref check Ban tester: - Added SITES_SHOPPING, SITES_CRYPTO, SITES_DNS categories - Parallel execution via ThreadPoolExecutor - Expanded banned-text hint keywords Fingerprint audit: - OS identity checks: hostname, MAC, GUID, OS version, timezone, screen res - Browser consistency analysis of user.js Neon world map: - world_map.png bundled; chain_map.py renders hop arcs over it with glow effect Signup prep: - Auto-save account on Open & Autofill; Copy Email / Copy Pass buttons - Auto-fill custom URL when preset site selected - PyInstaller-safe path resolution for signup_extension Spec: - Bundle signup_extension dir and world_map.png as PyInstaller data files Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,9 +4,11 @@ from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
from .browser_identity import (
|
||||
CookiePolicy,
|
||||
Persona,
|
||||
cookie_behavior_value,
|
||||
cookie_session_only,
|
||||
get_cookie_policy,
|
||||
get_persona,
|
||||
is_blend_persona,
|
||||
)
|
||||
@@ -180,28 +182,62 @@ def build_user_js(
|
||||
f'user_pref("general.useragent.override", "{hard.user_agent_override}");'
|
||||
)
|
||||
|
||||
# Cookie policy (persona-independent)
|
||||
behavior = cookie_behavior_value(hard.cookie_mode)
|
||||
lines.extend(
|
||||
[
|
||||
f'user_pref("network.cookie.cookieBehavior", {behavior});',
|
||||
# 0 = expire normally, 2 = current session only
|
||||
f'user_pref("network.cookie.lifetimePolicy", {2 if cookie_session_only(hard.cookie_mode) else 0});',
|
||||
]
|
||||
)
|
||||
# ── Cookie policy ────────────────────────────────────────────────────────
|
||||
cp: CookiePolicy = get_cookie_policy(hard.cookie_mode)
|
||||
|
||||
if hard.clear_on_shutdown:
|
||||
lines.extend(
|
||||
[
|
||||
'user_pref("privacy.sanitize.sanitizeOnShutdown", true);',
|
||||
'user_pref("privacy.clearOnShutdown.history", true);',
|
||||
'user_pref("privacy.clearOnShutdown.cookies", true);',
|
||||
'user_pref("privacy.clearOnShutdown.cache", true);',
|
||||
'user_pref("privacy.clearOnShutdown.downloads", true);',
|
||||
'user_pref("privacy.clearOnShutdown.formdata", true);',
|
||||
'user_pref("privacy.clearOnShutdown.sessions", true);',
|
||||
]
|
||||
)
|
||||
lines.extend([
|
||||
f'user_pref("network.cookie.cookieBehavior", {cp.behavior});',
|
||||
# pbmode = private-browsing mode uses same behavior
|
||||
f'user_pref("network.cookie.cookieBehavior.pbmode", {cp.behavior});',
|
||||
# lifetime: 0 = normal, 2 = session-only
|
||||
f'user_pref("network.cookie.lifetimePolicy", {cp.lifetime});',
|
||||
])
|
||||
|
||||
# Total Cookie Protection (TCP / Firefox partitioning)
|
||||
if cp.partition:
|
||||
lines.extend([
|
||||
'user_pref("network.cookie.cookieBehavior.optInPartitioning", true);',
|
||||
# Also isolate cache, localStorage, IndexedDB per top-level site
|
||||
'user_pref("privacy.partition.serviceWorkers", true);',
|
||||
'user_pref("privacy.partition.network_state", true);',
|
||||
'user_pref("privacy.partition.bloburl_by_default", true);',
|
||||
])
|
||||
else:
|
||||
lines.extend([
|
||||
'user_pref("network.cookie.cookieBehavior.optInPartitioning", false);',
|
||||
])
|
||||
|
||||
# SameSite=None cookies must be Secure (good hygiene regardless of mode)
|
||||
lines.append('user_pref("network.cookie.sameSite.noneRequiresSecure", true);')
|
||||
|
||||
# ── Sanitize-on-shutdown ─────────────────────────────────────────────────
|
||||
# The CookiePolicy sanitize flag takes priority; the hard.clear_on_shutdown
|
||||
# toggle acts as an additional override for cookies+cache even when the
|
||||
# cookie mode doesn't request it.
|
||||
do_sanitize = cp.sanitize or hard.clear_on_shutdown
|
||||
if do_sanitize:
|
||||
lines.append('user_pref("privacy.sanitize.sanitizeOnShutdown", true);')
|
||||
# Cookies
|
||||
lines.append(f'user_pref("privacy.clearOnShutdown.cookies", {_bool(cp.clear_cookies or hard.clear_on_shutdown)});')
|
||||
# Cache
|
||||
lines.append(f'user_pref("privacy.clearOnShutdown.cache", {_bool(cp.clear_cache or hard.clear_on_shutdown)});')
|
||||
# History
|
||||
lines.append(f'user_pref("privacy.clearOnShutdown.history", {_bool(cp.clear_history or hard.clear_on_shutdown)});')
|
||||
# Downloads list
|
||||
lines.append('user_pref("privacy.clearOnShutdown.downloads", true);')
|
||||
# Form / search bar autofill data
|
||||
lines.append(f'user_pref("privacy.clearOnShutdown.formdata", {_bool(cp.clear_formdata or hard.clear_on_shutdown)});')
|
||||
# Active sessions (HTTP auth, logged-in sites)
|
||||
lines.append('user_pref("privacy.clearOnShutdown.sessions", true);')
|
||||
# localStorage + IndexedDB
|
||||
lines.append(f'user_pref("privacy.clearOnShutdown.localStorage", {_bool(cp.clear_ls or hard.clear_on_shutdown)});')
|
||||
lines.append(f'user_pref("privacy.clearOnShutdown.indexedDB", {_bool(cp.clear_ls or hard.clear_on_shutdown)});')
|
||||
# Service worker registrations
|
||||
lines.append('user_pref("privacy.clearOnShutdown.serviceWorkers", true);')
|
||||
# Offline web app cache
|
||||
lines.append('user_pref("privacy.clearOnShutdown.offlineApps", true);')
|
||||
else:
|
||||
lines.append('user_pref("privacy.sanitize.sanitizeOnShutdown", false);')
|
||||
|
||||
if hard.timezone_utc:
|
||||
lines.append('user_pref("privacy.resistFingerprinting.reduceTimerPrecision", true);')
|
||||
|
||||
Reference in New Issue
Block a user