Update bot.py
Browse files
bot.py
CHANGED
|
@@ -1,63 +1,112 @@
|
|
| 1 |
-
import requests
|
| 2 |
import gradio as gr
|
| 3 |
-
import
|
|
|
|
| 4 |
import time
|
|
|
|
| 5 |
|
| 6 |
-
def
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
# Variabel penyimpan hasil sementara
|
| 36 |
-
output_layar = "Tunggu sekitar 5-10 menit saat booting awal (Anti Rate-Limit sedang bekerja merakit 50 akun)...\n\nSilakan refresh tombol di bawah nanti."
|
| 37 |
-
|
| 38 |
-
def proses_background():
|
| 39 |
-
global output_layar
|
| 40 |
-
# Beri jeda 10 detik agar wireproxy di bash stabil, lalu jalankan bot
|
| 41 |
-
time.sleep(10)
|
| 42 |
-
output_layar = jalankan_bot_anda()
|
| 43 |
-
|
| 44 |
-
# Jalankan bot di latar belakang agar antarmuka web Hugging Face tidak freeze
|
| 45 |
-
threading.Thread(target=proses_background, daemon=True).start()
|
| 46 |
-
|
| 47 |
-
def refresh_status():
|
| 48 |
-
return output_layar
|
| 49 |
-
|
| 50 |
-
# ========================================================
|
| 51 |
-
# WAJIB ADA UNTUK HUGGING FACE (Dummy Web Server Port 7860)
|
| 52 |
-
# ========================================================
|
| 53 |
-
with gr.Blocks(title="Status Bot Persistent") as demo:
|
| 54 |
-
gr.Markdown("# 🤖 Status 50 SOCKS5 Persistent Port")
|
| 55 |
-
gr.Markdown("Bot berjalan mandiri di background. 1 Port didedikasikan untuk 1 Akun tanpa rotasi.")
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
# Launch di 0.0.0.0 agar Hugging Face bisa mem-passing health check
|
| 63 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import subprocess
|
| 3 |
+
import os
|
| 4 |
import time
|
| 5 |
+
import requests
|
| 6 |
|
| 7 |
+
def uji_warp_via_rotator(tipe_proxy, host, port, user, password):
|
| 8 |
+
log = []
|
| 9 |
+
log.append("==========================================")
|
| 10 |
+
log.append(f"[*] MEMULAI EKSPERIMEN: WARP -> ROTATOR {host}")
|
| 11 |
+
log.append("==========================================")
|
| 12 |
+
|
| 13 |
+
# 1. Bersihkan file lama
|
| 14 |
+
for f in ["proxychains.conf", "wgcf-account.toml", "wgcf-profile.conf", "wireproxy.conf"]:
|
| 15 |
+
if os.path.exists(f):
|
| 16 |
+
os.remove(f)
|
| 17 |
+
|
| 18 |
+
# 2. Merakit proxychains.conf dengan proxy Dataheaven Anda
|
| 19 |
+
tipe = "socks5" if tipe_proxy == "SOCKS5" else "http"
|
| 20 |
+
auth = f"{user} {password}" if user and password else ""
|
| 21 |
+
conf_str = f"""strict_chain
|
| 22 |
+
proxy_dns
|
| 23 |
+
remote_dns_subnet 224
|
| 24 |
+
tcp_read_time_out 15000
|
| 25 |
+
tcp_connect_time_out 8000
|
| 26 |
+
[ProxyList]
|
| 27 |
+
{tipe} {host} {port} {auth}
|
| 28 |
+
"""
|
| 29 |
+
with open("proxychains.conf", "w") as f:
|
| 30 |
+
f.write(conf_str)
|
| 31 |
+
|
| 32 |
+
log.append(f"[*] Proxychains Siap! Jalur: VPS HF -> {tipe.upper()} {host}:{port} -> Cloudflare")
|
| 33 |
+
|
| 34 |
+
# 3. Mendaftar ke Cloudflare
|
| 35 |
+
log.append("[*] Meminta konfigurasi WARP ke Cloudflare...")
|
| 36 |
+
subprocess.run(["wgcf", "register", "--accept-tos"], capture_output=True)
|
| 37 |
+
subprocess.run(["wgcf", "generate"], capture_output=True)
|
| 38 |
+
|
| 39 |
+
if not os.path.exists("wgcf-profile.conf"):
|
| 40 |
+
log.append("[-] GAGAL: Terkena Rate Limit Cloudflare (Atau Rotator gagal tembus).")
|
| 41 |
+
return "\n".join(log)
|
| 42 |
+
|
| 43 |
+
# 4. Set local port untuk bot Python
|
| 44 |
+
with open("wgcf-profile.conf", "r") as f:
|
| 45 |
+
warp_conf = f.read()
|
| 46 |
+
with open("wireproxy.conf", "w") as f:
|
| 47 |
+
f.write(warp_conf)
|
| 48 |
+
f.write("\n[Socks5]\nBindAddress = 127.0.0.1:10888\n")
|
| 49 |
+
|
| 50 |
+
# 5. MENJALANKAN EKSPERIMEN
|
| 51 |
+
log.append("[*] Mengeksekusi WARP (UDP) dibungkus menembus Rotator Dataheaven...")
|
| 52 |
+
process = subprocess.Popen(
|
| 53 |
+
["proxychains4", "-f", "proxychains.conf", "wireproxy", "-c", "wireproxy.conf"],
|
| 54 |
+
stdout=subprocess.PIPE,
|
| 55 |
+
stderr=subprocess.PIPE,
|
| 56 |
+
text=True
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
log.append("[*] Menunggu 15 detik agar terowongan Handshake terbentuk...")
|
| 60 |
+
time.sleep(15)
|
| 61 |
+
|
| 62 |
+
# 6. Test Koneksi Bot
|
| 63 |
+
log.append("[*] Bot Python mencoba menembus koneksi...")
|
| 64 |
+
proxies = {
|
| 65 |
+
"http": "socks5://127.0.0.1:10888",
|
| 66 |
+
"https": "socks5://127.0.0.1:10888"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
try:
|
| 70 |
+
# Tembak IP Checker
|
| 71 |
+
res = requests.get("https://api.ipify.org?format=json", proxies=proxies, timeout=15)
|
| 72 |
+
log.append("\n[+++] HASIL EKSPERIMEN: BERHASIL SANGAT SEMPURNA! [+++]")
|
| 73 |
+
log.append(f" IP Keluar Anda: {res.json()['ip']}")
|
| 74 |
+
log.append(" Teori Anda terbukti bisa diimplementasikan!")
|
| 75 |
+
except Exception as e:
|
| 76 |
+
log.append("\n[---] HASIL EKSPERIMEN: GAGAL / TIMEOUT [---]")
|
| 77 |
+
log.append(f" Error Bot: {str(e)}")
|
| 78 |
+
log.append("\n[!] KESIMPULAN TEKNIS:")
|
| 79 |
+
log.append(" Ini membuktikan bahwa Rotator Proxy Dataheaven memblokir/mengabaikan")
|
| 80 |
+
log.append(" paket UDP yang dibutuhkan oleh protokol WireGuard Cloudflare.")
|
| 81 |
|
| 82 |
+
# Ambil log asli dari terminal proxychains
|
| 83 |
+
process.terminate()
|
| 84 |
+
out, err = process.communicate()
|
| 85 |
+
log.append("\n--- Log Asli Terminal Proxychains ---")
|
| 86 |
+
log.append(err[-600:] if err else "Tidak ada output error spesifik dari proxychains.")
|
| 87 |
+
|
| 88 |
+
if process.poll() is None:
|
| 89 |
+
process.terminate()
|
| 90 |
+
|
| 91 |
+
return "\n".join(log)
|
| 92 |
+
|
| 93 |
+
with gr.Blocks(title="Lab Uji Coba: WARP via Rotator") as demo:
|
| 94 |
+
gr.Markdown("# 🧪 Lab Uji Coba: WARP via Proxy Dataheaven")
|
| 95 |
+
gr.Markdown("Kredensial sudah terisi otomatis. Langsung klik eksekusi untuk membuktikan!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
+
with gr.Row():
|
| 98 |
+
# Secara default biasanya rotator premium mendukung SOCKS5, tapi bisa diubah ke HTTP di UI jika SOCKS5 gagal.
|
| 99 |
+
tipe = gr.Radio(["SOCKS5", "HTTP"], label="Tipe Proxy", value="SOCKS5")
|
| 100 |
+
host = gr.Textbox(label="IP / Host Rotator", value="edge1-us.dataheaven.ai")
|
| 101 |
+
port = gr.Textbox(label="Port Rotator", value="8888")
|
| 102 |
+
|
| 103 |
+
with gr.Row():
|
| 104 |
+
user = gr.Textbox(label="Username Proxy", value="oy9jb-id")
|
| 105 |
+
pwd = gr.Textbox(label="Password Proxy", value="e8ij1r8u", type="password")
|
| 106 |
+
|
| 107 |
+
btn = gr.Button("🚀 Eksekusi Uji Coba Sekarang!", variant="primary")
|
| 108 |
+
layar_log = gr.Textbox(label="Terminal Hasil Eksperimen", lines=25)
|
| 109 |
|
| 110 |
+
btn.click(uji_warp_via_rotator, inputs=[tipe, host, port, user, pwd], outputs=[layar_log])
|
| 111 |
|
|
|
|
| 112 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|