48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
import paramiko
|
|
import sys
|
|
import time
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
key_path = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
|
|
|
|
print("=== 1. Probing OpenCanary decoy IP 14.4.4.99 from Spaceport (140.44.4.41) ===")
|
|
sp = paramiko.SSHClient()
|
|
sp.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
sp.connect("140.44.4.41", username="root", key_filename=key_path, timeout=10)
|
|
|
|
def sp_run(cmd):
|
|
stdin, stdout, stderr = sp.exec_command(cmd)
|
|
return stdout.read().decode('utf-8', errors='ignore').strip()
|
|
|
|
print("Pinging 14.4.4.99:")
|
|
print(sp_run("ping -c 2 14.4.4.99"))
|
|
|
|
print("\nProbing HTTP (port 80) on 14.4.4.99:")
|
|
print(sp_run("curl -s -i http://14.4.4.99/admin/login.php | head -n 12"))
|
|
|
|
print("\nProbing SSH banner (port 22) on 14.4.4.99:")
|
|
print(sp_run("nc -z -v -w 2 14.4.4.99 22 2>&1 || curl -s telnet://14.4.4.99:22 --max-time 2 2>&1 | head -n 3"))
|
|
|
|
sp.close()
|
|
|
|
time.sleep(2)
|
|
|
|
print("\n=== 2. Checking OpenCanary Log on Swarm (140.44.4.71) ===")
|
|
sw = paramiko.SSHClient()
|
|
sw.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
sw.connect("140.44.4.71", username="root", key_filename=key_path, timeout=10)
|
|
|
|
stdin, stdout, stderr = sw.exec_command("tail -n 10 /opt/opencanary/logs/opencanary.log")
|
|
print(stdout.read().decode('utf-8', errors='ignore'))
|
|
|
|
print("\n=== 3. Checking Gotify Alert Watcher Log ===")
|
|
stdin, stdout, stderr = sw.exec_command("journalctl -u opencanary-watcher.service -n 15 --no-pager")
|
|
print(stdout.read().decode('utf-8', errors='ignore'))
|
|
|
|
print("\n=== 4. Checking Latest Messages in Gotify Database ===")
|
|
stdin, stdout, stderr = sw.exec_command("sqlite3 /var/lib/docker/volumes/gotify_gotify_data/_data/gotify.db 'SELECT id, appid, title, message, date FROM messages ORDER BY id DESC LIMIT 3;'")
|
|
print(stdout.read().decode('utf-8', errors='ignore'))
|
|
|
|
sw.close()
|
|
|