Files

17 lines
1.3 KiB
Bash
Raw Permalink Normal View History

set -u
sleep 5
echo "=== 47 中继:w-106 端点在线态 ==="
curl -s --max-time 8 http://127.0.0.1:20080/status | /usr/local/bin/node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>{const j=JSON.parse(d);console.log("endpoints:",JSON.stringify(j.endpoints));console.log("online:",JSON.stringify(j.online??null));})'
echo
TOKEN=$(/usr/local/bin/node /opt/dshs/mksess.cjs guest 2>&1 | tail -1)
echo "=== 验收:guest.ai1net.com(带会话)==="
curl -sk -o /tmp/_v -w "code=%{http_code} size=%{size_download} loc=%{redirect_url}\n" --max-time 25 \
--resolve guest.ai1net.com:443:127.0.0.1 -H "Accept: text/html" -H "Cookie: sid=$TOKEN" https://guest.ai1net.com/
head -c 260 /tmp/_v | tr -d '\n'; echo
sudo -u postgres psql -p 15432 -d dshs -Atc "DELETE FROM sessions WHERE user_agent='poc-curl2'" 2>&1 | grep -v 'could not change'
echo "=== 管理员用户对照(w-47 归属)==="
TOKEN2=$(/usr/local/bin/node /opt/dshs/mksess.cjs admin 2>&1 | tail -1)
curl -sk -o /tmp/_w -w "code=%{http_code} size=%{size_download} loc=%{redirect_url}\n" --max-time 25 \
--resolve admin.ai1net.com:443:127.0.0.1 -H "Accept: text/html" -H "Cookie: sid=$TOKEN2" https://admin.ai1net.com/
head -c 160 /tmp/_w | tr -d '\n'; echo
sudo -u postgres psql -p 15432 -d dshs -Atc "DELETE FROM sessions WHERE user_agent='poc-curl2'" 2>&1 | grep -v 'could not change'