Rename test_warp.py to bot.py
Browse files- bot.py +63 -0
- test_warp.py +0 -43
bot.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import threading
|
| 4 |
+
import time
|
| 5 |
+
|
| 6 |
+
def jalankan_bot_anda():
|
| 7 |
+
# Ini adalah simulasi dari sistem bot Anda.
|
| 8 |
+
# Di sini kita buktikan bahwa Port 10801 s/d 10850 masing-masing
|
| 9 |
+
# tersambung secara persisten ke WARP yang berbeda.
|
| 10 |
+
|
| 11 |
+
hasil_log = []
|
| 12 |
+
print("\n[*] Bot mulai memeriksa 50 koneksi persisten...")
|
| 13 |
+
|
| 14 |
+
for i in range(1, 51):
|
| 15 |
+
port_persisten = 10800 + i
|
| 16 |
+
proxy = {
|
| 17 |
+
"http": f"socks5://127.0.0.1:{port_persisten}",
|
| 18 |
+
"https": f"socks5://127.0.0.1:{port_persisten}"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
try:
|
| 22 |
+
# Bot Anda melakukan request menggunakan port akun spesifik
|
| 23 |
+
res = requests.get("https://api.ipify.org?format=json", proxies=proxy, timeout=10)
|
| 24 |
+
ip_publik = res.json()['ip']
|
| 25 |
+
log_msg = f"[+] Bot Akun {i} (Via Port {port_persisten}) -> IP WARP Keluar: {ip_publik}"
|
| 26 |
+
print(log_msg)
|
| 27 |
+
hasil_log.append(log_msg)
|
| 28 |
+
except Exception as e:
|
| 29 |
+
log_msg = f"[-] Bot Akun {i} (Via Port {port_persisten}) -> Proxy Error/Timeout"
|
| 30 |
+
print(log_msg)
|
| 31 |
+
hasil_log.append(log_msg)
|
| 32 |
+
|
| 33 |
+
return "\n".join(hasil_log)
|
| 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 |
+
layar_log = gr.Textbox(label="Laporan IP Keluar per Akun", lines=25, value=output_layar)
|
| 58 |
+
btn_refresh = gr.Button("🔄 Cek Status IP Terkini", variant="primary")
|
| 59 |
+
|
| 60 |
+
btn_refresh.click(refresh_status, outputs=[layar_log])
|
| 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)
|
test_warp.py
DELETED
|
@@ -1,43 +0,0 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
|
| 3 |
-
# Menggunakan range untuk port 1081 sampai 1130
|
| 4 |
-
ports = range(1081, 1131)
|
| 5 |
-
|
| 6 |
-
# Dictionary untuk menyimpan hasil filter (IP sebagai key, list port sebagai value)
|
| 7 |
-
ip_dict = {}
|
| 8 |
-
|
| 9 |
-
print("\n[*] Memulai test pengecekan IP dari 50 port WARP...\n")
|
| 10 |
-
|
| 11 |
-
for port in ports:
|
| 12 |
-
proxy = {
|
| 13 |
-
"http": f"socks5://127.0.0.1:{port}",
|
| 14 |
-
"https": f"socks5://127.0.0.1:{port}"
|
| 15 |
-
}
|
| 16 |
-
try:
|
| 17 |
-
res = requests.get("https://api.ipify.org?format=json", proxies=proxy, timeout=10)
|
| 18 |
-
ip = res.json()['ip']
|
| 19 |
-
print(f"[+] Port {port} -> IP Keluar: {ip}")
|
| 20 |
-
|
| 21 |
-
# Logika penyaringan: Memasukkan IP ke dalam daftar
|
| 22 |
-
if ip not in ip_dict:
|
| 23 |
-
ip_dict[ip] = []
|
| 24 |
-
ip_dict[ip].append(port)
|
| 25 |
-
|
| 26 |
-
except Exception as e:
|
| 27 |
-
print(f"[-] Port {port} -> Gagal/Timeout")
|
| 28 |
-
|
| 29 |
-
# Menampilkan hasil filter IP Unik
|
| 30 |
-
print("\n" + "="*45)
|
| 31 |
-
print("[*] HASIL FILTERING IP UNIK UNTUK BOT")
|
| 32 |
-
print("="*45)
|
| 33 |
-
print(f"Total IP unik yang didapat: {len(ip_dict)} dari 50 port.\n")
|
| 34 |
-
|
| 35 |
-
# Menampilkan IP dan memilih port pertama dari IP tersebut
|
| 36 |
-
port_bot_tersedia = []
|
| 37 |
-
for ip, port_list in ip_dict.items():
|
| 38 |
-
print(f"- IP {ip} digunakan oleh {len(port_list)} port: {port_list}")
|
| 39 |
-
# Kita ambil 1 port per IP unik untuk digunakan bot
|
| 40 |
-
port_bot_tersedia.append(port_list[0])
|
| 41 |
-
|
| 42 |
-
print("\n[*] Rekomendasi Port untuk Bot Kamu (Hanya 1 Port per IP unik):")
|
| 43 |
-
print(port_bot_tersedia)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|