Update app.py
Browse files9 unmodified lines10111213131415161718181920212223212223242526252627282930312829323334313235363738394034354142434445464748495051522 unmodified lines555657585960525361626364656667685960697071727364747576676877787980819 unmodified lines self.hp = 100 self.resources = {"Wood": 0, "Stone": 0, "Food": 0} self.active = False self.last_log = "Waiting..." self.last_log = "Waiting for game start..."
state = BotState()
def run_bot_engine(): # Fix: Removed 'no_sandbox' from SB() and added it via browser arguments # 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 = "๐ Connection Stage..." sb.open("https://moomoo.io") sb.sleep(10) # Give ALTCHA time to compute (it's proof-of-work) 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 = "๐ก๏ธ Solving Security..." # Try to force solve the altcha/checkbox 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.uc_gui_handle_captcha() sb.click('div[class*="altcha"]') sb.solve_captcha() # Internal SeleniumBase magic for ALTCHA/Turnstile state.last_log = "Captcha bypassed successfully." except: pass # 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 = "๐ Entering Game..." sb.type("#nameInput", "Survival_Bot") 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,2 unmodified lines 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']} if state.hp < 80:
# Survival Logic if state.hp < 75: sb.press_keys("body", "q") time.sleep(0.1)
except Exception as e: state.status = "โ Engine Error" state.last_log = f"Error: {str(e)[:50]}" state.status = "โ Fatal Engine Error" state.last_log = f"Error: {str(e)[:100]}"
def get_stats(): res = state.resources return f"### ๐ Live Stats\n**Status:** {state.status}\n**HP:** {state.hp}%\n**Wood:** {res['Wood']} | **Stone:** {res['Stone']}\n\n**Action Log:** {state.last_log}" 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 Survival Bot") display = gr.Markdown("Connecting...") gr.Markdown("# ๐ฎ Moomoo AI - Force Bypass Edition") display = gr.Markdown("Engine booting...") gr.Timer(1.5).tick(get_stats, outputs=display)
if __name__ == "__main__":app.py+30-20