diff --git a/bwifi.sh b/bwifi.sh index ca58e45..7d276ee 100755 --- a/bwifi.sh +++ b/bwifi.sh @@ -30,6 +30,17 @@ echo auth host: $auth_host # for wireless, which will be redirected to this location, a "@bistu" is required, if [ "$auth_host" == *"10.1.206.13"* ] ; then username="${username}@bistu" + + declare -a cookie_opt + declare -a header_opt + + cookie_opt+=("--cookie" "program=beijing-information") + cookie_opt+=("--cookie" "md5_login2=$username|$password") + + header_opt+=("--header" "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8") + header_opt+=("--header" "Accept-Language: en-US,zh-CN;q=0.5") + header_opt+=("--header" "Accept-Encoding: gzip, deflate") + header_opt+=("--header" "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0") fi # Note that the encoding of response is gb2312, so we need to transcode @@ -51,6 +62,8 @@ title=$(curl --no-progress-meter --include \ --data-urlencode "user=" \ --data-urlencode "cmd=" \ --data-urlencode "Login=" \ + "${cookie_opt[@]}" \ + "${header_opt[@]}" \ $auth_host | iconv --from-code=gb2312 --to-code=utf-8 | sed -n -E 's#(.*)#\1#p') echo auth result page title: $title