diff --git a/bwifi.sh b/bwifi.sh index aaa3ba8..00d2329 100755 --- a/bwifi.sh +++ b/bwifi.sh @@ -1,16 +1,21 @@ #!/usr/bin/env bash +# Change the following variable to your username and password for school network authorization. username=1970111222 password=123123321 -# get authorizing location from 302 response header -# use an IP address to bypass the DNS lookup +# Get authorizing location from 302 response header. +# Since sometimes the school network don't hijack DNS lookup query, and it may take such a long time +# during DNS lookup. So we use an IP address to bypass the DNS lookup. Any fixed IP address providing +# HTTP service can take place of the "119.29.29.29". echo 'sending a http request...' res_headers=$(curl --request GET --head --no-progress-meter http://119.29.29.29/) echo 'response received' +# If authorizing is requested, school network will respond any HTTP (not HTTPS) request with an 302 +# response and its "Server" field is "DrcomServer" if ! grep "Server: DrcomServer" <<< $res_headers ; then - echo "didn't receive a response from DrcomServer, you may be online now." + echo "didn't receive a response from DrcomServer, you may already be online." exit 1 fi