Upload antidetect.py with huggingface_hub
Browse files- antidetect.py +64 -0
antidetect.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Anti-detect browser (Camoufox) - dung tay tren Windows
|
| 3 |
+
import os
|
| 4 |
+
from camoufox.sync_api import Camoufox
|
| 5 |
+
|
| 6 |
+
BASE = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
+
PROFILES = os.path.join(BASE, "profiles")
|
| 8 |
+
os.makedirs(PROFILES, exist_ok=True)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def ask(p, d=""):
|
| 12 |
+
try:
|
| 13 |
+
v = input(p).strip()
|
| 14 |
+
except EOFError:
|
| 15 |
+
v = ""
|
| 16 |
+
return v or d
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main():
|
| 20 |
+
print("=" * 52)
|
| 21 |
+
print(" ANTI-DETECT BROWSER (Camoufox) - dung tay")
|
| 22 |
+
print("=" * 52)
|
| 23 |
+
have = [d for d in os.listdir(PROFILES) if os.path.isdir(os.path.join(PROFILES, d))]
|
| 24 |
+
if have:
|
| 25 |
+
print("Profile da co:", ", ".join(have))
|
| 26 |
+
name = ask("Ten profile (moi cai = 1 danh tinh, giu dang nhap) [default]: ", "default")
|
| 27 |
+
udd = os.path.join(PROFILES, name)
|
| 28 |
+
|
| 29 |
+
proxy = None
|
| 30 |
+
geoip = False
|
| 31 |
+
if ask("Dung proxy? (y/N): ", "n").lower().startswith("y"):
|
| 32 |
+
server = ask(" Proxy (vd http://ip:port hoac socks5://ip:port): ")
|
| 33 |
+
user = ask(" User (Enter neu khong co): ")
|
| 34 |
+
pw = ask(" Pass (Enter neu khong co): ")
|
| 35 |
+
proxy = {"server": server}
|
| 36 |
+
if user:
|
| 37 |
+
proxy["username"] = user
|
| 38 |
+
if pw:
|
| 39 |
+
proxy["password"] = pw
|
| 40 |
+
geoip = True # tu khop timezone/ngon ngu theo IP proxy
|
| 41 |
+
|
| 42 |
+
url = ask("Mo trang nao truoc? [https://whoer.net]: ", "https://whoer.net")
|
| 43 |
+
|
| 44 |
+
kw = dict(headless=False, persistent_context=True, user_data_dir=udd,
|
| 45 |
+
os="windows", humanize=True)
|
| 46 |
+
if proxy:
|
| 47 |
+
kw["proxy"] = proxy
|
| 48 |
+
kw["geoip"] = geoip
|
| 49 |
+
|
| 50 |
+
print("\nDang mo trinh duyet Camoufox...")
|
| 51 |
+
with Camoufox(**kw) as ctx:
|
| 52 |
+
page = ctx.new_page()
|
| 53 |
+
try:
|
| 54 |
+
page.goto(url, timeout=60000)
|
| 55 |
+
except Exception as e:
|
| 56 |
+
print("Loi mo trang dau:", e)
|
| 57 |
+
print("\n>>> Duyet/dang ky bang TAY trong cua so vua mo.")
|
| 58 |
+
print(">>> Xong thi quay lai day nhan ENTER de dong & luu profile.\n")
|
| 59 |
+
ask("")
|
| 60 |
+
print("Da dong. Profile luu tai:", udd)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
if __name__ == "__main__":
|
| 64 |
+
main()
|