import paramiko

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

def main():
    try:
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(HOST, username=USER, password=PASS)
        
        # Get current cron
        stdin, stdout, stderr = ssh.exec_command("crontab -l")
        current_cron = stdout.read().decode()
        
        # Remove scan.php line
        new_cron = []
        for line in current_cron.splitlines():
            if "scan.php" not in line:
                new_cron.append(line)
        
        new_cron_str = "\n".join(new_cron) + "\n"
        
        # Write new cron
        stdin, stdout, stderr = ssh.exec_command("crontab -")
        stdin.write(new_cron_str)
        stdin.channel.shutdown_write()
        
        print("Updated crontab:")
        print(new_cron_str)
        
        ssh.close()
    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    main()
