34 lines
1.4 KiB
Bash
34 lines
1.4 KiB
Bash
#!/bin/bash
|
|
cd /var/www/onebot
|
|
JAR=/tmp/ob64.txt
|
|
rm -f $JAR
|
|
BODY=$(curl -s -c $JAR http://127.0.0.1:8081/auth/login)
|
|
CSRF=$(echo "$BODY" | grep -oE 'name="csrf-token" content="[^"]*"' | sed 's/.*content="//;s/"//')
|
|
curl -s -b $JAR -c $JAR -X POST http://127.0.0.1:8081/auth/login \
|
|
-d "username=ruiguo_wang@163.com" -d "password=wrg521113.." -d "_token=$CSRF" \
|
|
-H "X-CSRF-TOKEN: $CSRF" -o /dev/null
|
|
curl -s -b $JAR "http://127.0.0.1:8081/bom/show/1" -o /tmp/ob64.html
|
|
|
|
php -r '
|
|
$h = file_get_contents("/tmp/ob64.html");
|
|
if (preg_match("/var RAW_ITEMS = (\[.*?\]);/s", $h, $m)) {
|
|
$items = json_decode($m[1], true);
|
|
echo "RAW_ITEMS 元素数: " . (is_array($items) ? count($items) : "解析失败") . "\n";
|
|
if (is_array($items) && isset($items[0])) {
|
|
echo "第1行完整: " . json_encode($items[0], JSON_UNESCAPED_UNICODE) . "\n";
|
|
echo "第1行字段数: " . count($items[0]) . "\n";
|
|
}
|
|
} else {
|
|
echo "未匹配 RAW_ITEMS\n";
|
|
}
|
|
if (preg_match("/var COLUMNS = (\[.*?\]);/s", $h, $m)) {
|
|
$cols = json_decode($m[1], true);
|
|
echo "COLUMNS 数: " . (is_array($cols) ? count($cols) : "解析失败") . "\n";
|
|
if (is_array($cols)) echo "COLUMNS keys: " . implode(",", array_column($cols, "key")) . "\n";
|
|
}
|
|
if (preg_match("/var FIXED = (\[.*?\]);/s", $h, $m)) {
|
|
$fixed = json_decode($m[1], true);
|
|
echo "FIXED keys: " . implode(",", $fixed) . "\n";
|
|
}
|
|
'
|