#!/bin/bash
sleep 5
echo "  --- HTML server phục vụ (phải là action=\"dang-nhap\" tương đối):"
curl -s -m 15 "http://127.0.0.1:8097/" | grep -oE 'action="[^"]*"|location.pathname.endsWith' | head -3 | sed 's/^/    /'
echo "  --- qua funnel:"
curl -s -m 20 "https://desktop-9gsdkd2.tail0ffe94.ts.net/dashboard/" | grep -oE 'action="[^"]*"' | head -1 | sed 's/^/    /'
echo "  --- đăng nhập bằng mật khẩu mới (curl):"
T="$LOCALAPPDATA/Temp"; rm -f "$T/ck2.txt"
curl -s -c "$T/ck2.txt" -o /dev/null -w "    POST -> %{http_code} | chuyển tới: %{redirect_url}\n" -m 25 -X POST -d "mat_khau=btchem2026" "https://desktop-9gsdkd2.tail0ffe94.ts.net/dashboard/dang-nhap"
curl -s -b "$T/ck2.txt" -m 25 "https://desktop-9gsdkd2.tail0ffe94.ts.net/dashboard/api/data" | head -c 100 | sed 's/^/    api/data: /'
echo
echo "  --- mật khẩu sai:"
curl -s -m 25 -X POST -d "mat_khau=abc" "https://desktop-9gsdkd2.tail0ffe94.ts.net/dashboard/dang-nhap" | grep -o 'Sai mật khẩu[^<]*' | head -1 | sed 's/^/    /'
