Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import time
|
| 2 |
-
import random
|
| 3 |
import threading
|
| 4 |
from datetime import datetime
|
| 5 |
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
@@ -19,28 +18,35 @@ def log(acao, status="INFO"):
|
|
| 19 |
class ServidorFalso(BaseHTTPRequestHandler):
|
| 20 |
def do_GET(self):
|
| 21 |
self.send_response(200); self.end_headers()
|
| 22 |
-
self.wfile.write(b"Bot Torn City v1.
|
| 23 |
def log_message(self, format, *args): pass
|
| 24 |
|
| 25 |
def realizar_login(driver):
|
| 26 |
-
log("
|
| 27 |
|
| 28 |
-
#
|
| 29 |
driver.uc_open_with_reconnect("https://www.torn.com/login.php", 6)
|
| 30 |
-
time.sleep(10)
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
time.sleep(5)
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
try:
|
| 40 |
-
|
| 41 |
-
log(f"Barreira ultrapassada. Título atual: {titulo}", "SISTEMA")
|
| 42 |
-
|
| 43 |
-
# Injeção de Código Blindada
|
| 44 |
sucesso = driver.execute_script(f"""
|
| 45 |
var userField = document.querySelector('input[placeholder*="Email"], input[type="email"], input[type="text"]');
|
| 46 |
var passField = document.querySelector('input[placeholder*="Password"], input[type="password"]');
|
|
@@ -54,18 +60,18 @@ def realizar_login(driver):
|
|
| 54 |
""")
|
| 55 |
|
| 56 |
if not sucesso:
|
| 57 |
-
log("
|
| 58 |
return False
|
| 59 |
|
| 60 |
-
log("Credenciais inseridas!
|
| 61 |
-
time.sleep(
|
| 62 |
|
| 63 |
driver.execute_script("""
|
| 64 |
var btn = document.querySelector('button[type="submit"], input[value*="Log In"], .login-btn');
|
| 65 |
if(btn) btn.click();
|
| 66 |
""")
|
| 67 |
|
| 68 |
-
log("Aguardando
|
| 69 |
time.sleep(15)
|
| 70 |
|
| 71 |
if "logout" in driver.page_source.lower() or driver.is_element_visible('a[href*="logout"]'):
|
|
@@ -75,11 +81,10 @@ def realizar_login(driver):
|
|
| 75 |
return False
|
| 76 |
|
| 77 |
except Exception as e:
|
| 78 |
-
log(f"
|
| 79 |
return False
|
| 80 |
|
| 81 |
def executar_farm(driver):
|
| 82 |
-
# Usa o mesmo método seguro para navegar
|
| 83 |
driver.uc_open_with_reconnect("https://www.torn.com/index.php", 4)
|
| 84 |
time.sleep(7)
|
| 85 |
|
|
@@ -101,7 +106,7 @@ def executar_farm(driver):
|
|
| 101 |
log("Treino de Força executado.", "SUCESSO")
|
| 102 |
|
| 103 |
except:
|
| 104 |
-
log("
|
| 105 |
|
| 106 |
def iniciar():
|
| 107 |
display = Display(visible=0, size=(1920, 1080)); display.start()
|
|
@@ -115,8 +120,8 @@ def iniciar():
|
|
| 115 |
time.sleep(300)
|
| 116 |
if "login" in driver.current_url: break
|
| 117 |
else:
|
| 118 |
-
log("
|
| 119 |
-
time.sleep(
|
| 120 |
except Exception as e: log(f"Erro fatal: {e}", "ALERTA")
|
| 121 |
finally: driver.quit(); display.stop()
|
| 122 |
|
|
|
|
| 1 |
import time
|
|
|
|
| 2 |
import threading
|
| 3 |
from datetime import datetime
|
| 4 |
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
|
|
| 18 |
class ServidorFalso(BaseHTTPRequestHandler):
|
| 19 |
def do_GET(self):
|
| 20 |
self.send_response(200); self.end_headers()
|
| 21 |
+
self.wfile.write(b"Bot Torn City v1.9 - Cloudflare Wait Loop")
|
| 22 |
def log_message(self, format, *args): pass
|
| 23 |
|
| 24 |
def realizar_login(driver):
|
| 25 |
+
log("A iniciar combate com o Cloudflare...", "HACK")
|
| 26 |
|
| 27 |
+
# Abre a página com reconexão para disfarçar o bot
|
| 28 |
driver.uc_open_with_reconnect("https://www.torn.com/login.php", 6)
|
|
|
|
| 29 |
|
| 30 |
+
# ⏳ LOOP DE ESPERA DO CLOUDFLARE
|
| 31 |
+
tentativas = 0
|
| 32 |
+
while "Just a moment" in driver.title and tentativas < 12:
|
| 33 |
+
log(f"Cloudflare a processar (Aguardando {(tentativas+1)*5}s)...", "WAIT")
|
| 34 |
+
try:
|
| 35 |
+
# Tenta clicar no widget do Cloudflare se ele aparecer
|
| 36 |
+
driver.uc_gui_click_captcha()
|
| 37 |
+
except: pass
|
| 38 |
time.sleep(5)
|
| 39 |
+
tentativas += 1
|
| 40 |
+
|
| 41 |
+
titulo = driver.title
|
| 42 |
+
log(f"Estado pós-barreira: {titulo}", "SISTEMA")
|
| 43 |
+
|
| 44 |
+
if "Just a moment" in titulo:
|
| 45 |
+
log("O Cloudflare não cedeu (IP do Datacenter bloqueado).", "ALERTA")
|
| 46 |
+
return False
|
| 47 |
|
| 48 |
try:
|
| 49 |
+
# Se passou, injeta as credenciais
|
|
|
|
|
|
|
|
|
|
| 50 |
sucesso = driver.execute_script(f"""
|
| 51 |
var userField = document.querySelector('input[placeholder*="Email"], input[type="email"], input[type="text"]');
|
| 52 |
var passField = document.querySelector('input[placeholder*="Password"], input[type="password"]');
|
|
|
|
| 60 |
""")
|
| 61 |
|
| 62 |
if not sucesso:
|
| 63 |
+
log("Site carregou, mas campos não foram encontrados.", "ALERTA")
|
| 64 |
return False
|
| 65 |
|
| 66 |
+
log("Credenciais inseridas! A entrar...", "SUCESSO")
|
| 67 |
+
time.sleep(2)
|
| 68 |
|
| 69 |
driver.execute_script("""
|
| 70 |
var btn = document.querySelector('button[type="submit"], input[value*="Log In"], .login-btn');
|
| 71 |
if(btn) btn.click();
|
| 72 |
""")
|
| 73 |
|
| 74 |
+
log("Aguardando resposta do servidor...", "WAIT")
|
| 75 |
time.sleep(15)
|
| 76 |
|
| 77 |
if "logout" in driver.page_source.lower() or driver.is_element_visible('a[href*="logout"]'):
|
|
|
|
| 81 |
return False
|
| 82 |
|
| 83 |
except Exception as e:
|
| 84 |
+
log(f"Erro na fase de injeção: {str(e)[:50]}", "ALERTA")
|
| 85 |
return False
|
| 86 |
|
| 87 |
def executar_farm(driver):
|
|
|
|
| 88 |
driver.uc_open_with_reconnect("https://www.torn.com/index.php", 4)
|
| 89 |
time.sleep(7)
|
| 90 |
|
|
|
|
| 106 |
log("Treino de Força executado.", "SUCESSO")
|
| 107 |
|
| 108 |
except:
|
| 109 |
+
log("Aguardando sincronização de dados...", "SISTEMA")
|
| 110 |
|
| 111 |
def iniciar():
|
| 112 |
display = Display(visible=0, size=(1920, 1080)); display.start()
|
|
|
|
| 120 |
time.sleep(300)
|
| 121 |
if "login" in driver.current_url: break
|
| 122 |
else:
|
| 123 |
+
log("Tentando nova rota em 30s...", "WAIT")
|
| 124 |
+
time.sleep(30)
|
| 125 |
except Exception as e: log(f"Erro fatal: {e}", "ALERTA")
|
| 126 |
finally: driver.quit(); display.stop()
|
| 127 |
|