-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradius.sh
49 lines (40 loc) · 1018 Bytes
/
radius.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/ash
######## CONFIG SECTION BEGIN ########
RADIUS_SERVER=""
RADIUS_SECRET=""
RADIUS_PORT=1812
USERNAME=""
PASSWORD=""
AUTH_RATE=200 # Authentications per second
CONFIG_FILENAME="eapol_test.conf"
TIMEOUT=30 # Timeout in seconds
######## CONFIG SECTION END ########
generate_random_mac() {
od -An -N6 -tx1 /dev/urandom | tr ' ' '\n' | grep -v '^$' | paste -sd ':' -
}
create_eapol_test_config() {
cat <<EOF > $CONFIG_FILENAME
network={
ssid="ExampleSSID"
key_mgmt=WPA-EAP
eap=PEAP
identity="$USERNAME"
password="$PASSWORD"
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
}
EOF
}
send_eapol_test_request() {
local mac=$(generate_random_mac)
timeout $TIMEOUT eapol_test -t 30 -r 3 -c $CONFIG_FILENAME -s $RADIUS_SECRET -a $RADIUS_SERVER -p $RADIUS_PORT -M $mac /dev/null 2>&1 &
}
main() {
create_eapol_test_config
local delay=$(echo "scale=6; 1 / $AUTH_RATE" | bc)
while true; do
send_eapol_test_request
sleep $delay
done
}
main