#!/usr/bin/env bash # Read-only: recent audit entries around site deletion. set -uo pipefail ENTRY="${1:-ipdduiyy}" BASE="http://127.0.0.1:8888/$ENTRY" PASS=$(awk -F': ' '/^password:/{print $2}' /www/server/panel/data/initial_password.txt) curl -s -c /tmp/ck.txt -H 'Content-Type: application/json' -H 'Origin: http://127.0.0.1:8888' \ -d "{\"username\":\"admin\",\"password\":\"$PASS\"}" "$BASE/api/v1/auth/login" >/dev/null curl -s -b /tmp/ck.txt "$BASE/api/v1/system/audit?limit=60" | python3 -c " import json, sys, datetime rows = json.load(sys.stdin)['data'] for r in rows: if r['module'] == 'site' or r['action'] in ('delete','create'): ts = datetime.datetime.fromtimestamp(r['created_at']).strftime('%m-%d %H:%M:%S') print('%s %-15s %-9s %-8s %-14s %s' % (ts, r['username'], r['module'], r['action'], r['target'], r['ip'])) "