douyinWEB/scripts/_forensics_success_ips2.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

46 lines
2.4 KiB
Python

# -*- coding: utf-8 -*-
"""Confirm: failed attempts from success IPs? session duration stats; Aug15 Vultr context."""
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False)
cmd = r"""
echo '=== Failed from these IPs? (should be 0 if own password) ==='
grep -E 'Failed password.*(45\.134\.95\.113|45\.32\.89\.58)' /var/log/auth.log /var/log/auth.log.1 2>/dev/null | wc -l
grep -E 'Failed password.*(45\.134\.95\.113|45\.32\.89\.58)' /var/log/auth.log /var/log/auth.log.1 2>/dev/null | head
echo '=== Session duration seconds for 45.134.95.113 (last sample) ==='
last -F | grep '45.134.95.113' | awk '{
# duration in (HH:MM) or (00:00)
} END{}'
last -F | grep '45.134.95.113' | sed -n 's/.*(\([0-9]*\):\([0-9]*\)).*/\1 \2/p' | awk '{s=$1*60+$2; n++; t+=s; if(s>max)max=s} END{print "sessions",n,"avg_sec", (n?t/n:0), "max_sec", max}'
echo '=== Aug 15 around Vultr 45.32.89.58 - what else happened ==='
grep -E '2026-08-15T12:5|2026-08-15T13:0' /var/log/auth.log.1 2>/dev/null | grep -E 'Accepted|Failed|Invalid' | head -40
echo '=== first/last 45.134 ==='
grep 'Accepted password for root from 45.134.95.113' /var/log/auth.log.1 | head -1
grep 'Accepted password for root from 45.134.95.113' /var/log/auth.log.1 | tail -1
echo '=== first/last 45.32 ==='
grep 'Accepted password for root from 45.32.89.58' /var/log/auth.log.1 | head -1
grep 'Accepted password for root from 45.32.89.58' /var/log/auth.log.1 | tail -1
echo '=== hidden files in /root /etc/cron* created Aug9-15 ==='
find /root /etc/cron.d /etc/cron.daily /var/spool/cron -type f -newermt '2026-08-09' ! -newermt '2026-08-16' 2>/dev/null
find /root -name '.*' -type f -newermt '2026-08-09' ! -newermt '2026-08-16' 2>/dev/null
echo '=== ld.so preload / suspicious libs ==='
cat /etc/ld.so.preload 2>/dev/null || echo 'no ld.so.preload'
ls -la /etc/ld.so.preload 2>/dev/null
echo '=== check for common backdoor names ==='
ls -la /tmp/.ICE-unix /dev/shm/* /usr/bin/.* /root/.* 2>/dev/null | head -30
find /usr/bin /usr/sbin /bin /sbin -type f -newermt '2026-08-09' ! -newermt '2026-08-16' 2>/dev/null | head -20
"""
_, o, e = c.exec_command(cmd, timeout=90)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()