#!/usr/bin/env python3
import paramiko

HOST = "135.125.102.180"
USER = "ubuntu"
PASS = "BotPascal2026!"

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(HOST, username=USER, password=PASS)

print("🛑 Force killing all scan processes with -9...")

# Kill with -9 (force kill)
stdin, stdout, stderr = ssh.exec_command("sudo pkill -9 -f 'scan.php' 2>&1")
out = stdout.read().decode()
print(f"scan.php: {out if out else 'killed'}")

stdin2, stdout2, stderr2 = ssh.exec_command("sudo pkill -9 -f 'scan_loop.php' 2>&1")
out2 = stdout2.read().decode()
print(f"scan_loop.php: {out2 if out2 else 'killed'}")

# Double check
print("\n✅ Verification...")
stdin3, stdout3, stderr3 = ssh.exec_command("ps aux | grep scan | grep -v grep")
processes = stdout3.read().decode()

if processes.strip():
    print(f"⚠️  Still running:\n{processes}")
else:
    print("✅ All scan processes stopped!")

ssh.close()
