File size: 3,381 Bytes
f44eac3 7496171 f44eac3 dee3bbf f44eac3 dee3bbf d0f21f1 7496171 dee3bbf 7496171 dee3bbf d0f21f1 c44abae 56e34ab d0f21f1 56e34ab d0f21f1 a6cc7d9 d0f21f1 a6cc7d9 d0f21f1 c44abae d0f21f1 dee3bbf db442fb dee3bbf 1ee4162 dee3bbf d0f21f1 dee3bbf d0f21f1 dee3bbf d0f21f1 a6cc7d9 dee3bbf 1ee4162 56e34ab d0f21f1 7496171 dee3bbf d0f21f1 7496171 a6cc7d9 d0f21f1 a6cc7d9 7496171 dee3bbf | 1 2 3 4 5 6 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | import os
import time
import threading
import gradio as gr
from seleniumbase import SB
class BotState:
def __init__(self):
self.status = "Initializing..."
self.hp = 100
self.resources = {"Wood": 0, "Stone": 0, "Food": 0}
self.active = False
self.last_log = "Waiting for game start..."
state = BotState()
def run_bot_engine():
# Use CDP Mode (Chrome DevTools Protocol) for maximum stealth
with SB(uc=True, xvfb=True, chromium_arg="--no-sandbox,--disable-dev-shm-usage") as sb:
try:
state.status = "๐ Phase 1: Stealth Connection"
# Open with a long reconnect to bake the session
sb.uc_open_with_reconnect("https://moomoo.io", reconnect_time=8)
state.status = "๐ก๏ธ Phase 2: Solving Proof-of-Work"
# Activate CDP mode - this is the "Force" button
sb.activate_cdp_mode("https://moomoo.io")
sb.sleep(12) # MANDATORY: ALTCHA needs time to compute the puzzle
# This handles the click using human-like mouse curves
try:
sb.solve_captcha() # Internal SeleniumBase magic for ALTCHA/Turnstile
state.last_log = "Captcha bypassed successfully."
except:
# Manual fallback: click the center of the ALTCHA widget
sb.click('div[class*="altcha"]')
state.last_log = "Manual captcha click attempted."
sb.sleep(5)
state.status = "๐ Phase 3: Joining Game"
sb.type("#nameInput", "AI_Force_Bot")
sb.click("#enterGame")
state.active = True
state.status = "๐ข SURVIVING"
while True:
# Using CDP-safe script execution
game_data = sb.execute_script("""
return {
hp: parseInt(document.getElementById('healthBar')?.style.width) || 100,
food: parseInt(document.getElementById('foodDisplay')?.innerText) || 0,
wood: parseInt(document.getElementById('woodDisplay')?.innerText) || 0,
stone: parseInt(document.getElementById('stoneDisplay')?.innerText) || 0
}
""")
state.hp = game_data['hp']
state.resources = {"Wood": game_data['wood'], "Stone": game_data['stone'], "Food": game_data['food']}
# Survival Logic
if state.hp < 75:
sb.press_keys("body", "q")
time.sleep(0.1)
except Exception as e:
state.status = "โ Fatal Engine Error"
state.last_log = f"Error: {str(e)[:100]}"
def get_stats():
res = state.resources
return f"### ๐ Bot Intelligence\n**Status:** {state.status}\n**HP:** {state.hp}%\n**Resources:** ๐ชต {res['Wood']} | ๐ชจ {res['Stone']} | ๐ {res['Food']}\n\n**Log:** {state.last_log}"
with gr.Blocks() as demo:
gr.Markdown("# ๐ฎ Moomoo AI - Force Bypass Edition")
display = gr.Markdown("Engine booting...")
gr.Timer(1.5).tick(get_stats, outputs=display)
if __name__ == "__main__":
threading.Thread(target=run_bot_engine, daemon=True).start()
demo.launch(server_name="0.0.0.0", server_port=7860)
|