Timeline

2025-10-09

init


First enable wlan, then connect to the campus network. For Raspberry Pi:

1
sudo raspi-config

Then under System Option, Wireless LAN, enter the ssid and passphrase.

Or write to /etc/wpa_supplicant/wpa_supplicant.conf:

1
2
3
4
5
6
7
8
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
country=CN

network={
ssid="HNU"
key_mgmt=NONE
}

Then restart the wpa_supplicant service:

1
sudo systemctl restart wpa_supplicant

After the above steps, use ifconfig to check whether wlan’s inet has an IP address. If so, you are connected to the campus network, and the next step is authentication.

If it didn’t work, run the following command to check the logs:

1
journalctl -u wpa_supplicant -n 50 --no-pager

Packet capture:

fiddler packet capture

From the packet capture, the following script can be written:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# First get wlan0's IPv4 and MAC
IP=$(ip -4 -o addr show wlan0 | awk '{print $4}' | cut -d/ -f1)
MAC=$(cat /sys/class/net/wlan0/address)


USER=",0,your_student_number"
PASS="your_password"

curl -s --get "https://web.hnu.edu.cn:802/eportal/portal/login" \
--data-urlencode "callback=dr1003" \
--data-urlencode "login_method=1" \
--data-urlencode "user_account=${USER}" \
--data-urlencode "user_password=${PASS}" \
--data-urlencode "wlan_user_ip=${IP}" \
--data-urlencode "wlan_user_mac=${MAC}" \
--data-urlencode "terminal_type=1" \
--insecure \
-D - \
| sed -n '1,200p'

After running the above script, test whether the connection is successful:

1
ping www.baidu.com