-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapd-tty.clean
executable file
·83 lines (76 loc) · 2.3 KB
/
apd-tty.clean
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh -x
# Shell to start programs needed to demonstrate EAP-SIM
# authentication on simulated PHONE and HLR AUC env.
# All used programs are from wpa (v2.3) reference package
# - wpa-supplicant
# - RADIUS-server
# - HLR-AuC
# External WPA2-RADIUS AP hardware is used
#
# options:
# -t more timestamps to xxx...
# -K include keydata to debug
# -dddd more debug
#
# usage:
# ./apd [OPTION]...
# Variables
BASE=$HOME/gitdocs/di/testit
WPASUPPLICANT=$BASE/wpa_supplicant
HOSTAPD=$BASE/hostapd
HLR=$BASE/hlr_auc_gw
WPASUPPLICANTCONF=$BASE/wpa-simtest-owrt2.conf
# sim triplets, when EAP-SIM used
SIM=$BASE/hostapd.sim_db
# Milenage parameters, when AKA used
MILENAGE=$BASE/hlr_auc_gw.milenage_db
# HOSTAPD parameters
# settings for hostapd include wired, eap_server, eap-handler
HOSTAPDCONF=$BASE/hostapd-jmdemo.conf
# timestamped logs and confs
TIMESTAMP=`date +s%y%m%d-%H%M%S`
TARGET=$BASE/demot/ap-$TIMESTAMP
mkdir $TARGET
cp $0 $HOSTAPDCONF $SIM $MILENAGE $TARGET
# reset and cleanup locks and sockets
pkill hlr_auc_gw; pkill wpa_supplicant; pkill hostapd
if [ -S /tmp/hlr_auc_gw.sock ] ; then
rm -f /tmp/hlr_auc_gw.sock
fi
if [ -S ./eth0 ] ; then
rm -f ./eth0
fi
### 1. HLR_AUC
# startup using SIM-triplet
# $HLR -g $SIM > $TARGET/hlr-debug &
# startup using MILENAGE. Works also with SIM
$HLR -m $MILENAGE > $TARGET/hlr-debug &
### 2. HOSTAP (in RADIUS-EAP-handler mode)
ifconfig wlan0 up
# captures for RADIUS (wired, AP-RADIUS) and
# EAP (wireless, client-AP)
tshark -i eth0 -w $TARGET/eth0-pcap &
tshark -i wlan0 -w $TARGET/wlan0-pcap &
echo start hostapd
# start RADIUS in background
$HOSTAPD -Kdt $HOSTAPDCONF > $TARGET/hostapdwired-debug &
echo "if $? == 0 then RADIUS server started ok"
sleep 1
### 3. WPA_SUPPLICANT
echo starting supplicant..
$WPASUPPLICANT -dK -iwlan0 -c $WPASUPPLICANTCONF \
-D nl80211 > $TARGET/wpasupp-extapradius-debug &
### Live analysing
echo starting analyze..
cd $BASE/demot
cd `ls -d ap-*|tail -1`/
sleep 1
# follow 3 log files, with color coding set in multitail.conf
multitail -F ../multitail.conf -N 10000 -CS eap-sim -ts host*debug -i wpa*debug
# alternatively, start this in own window
# xterm -e $BASE/demot/anamulti &
# if tests take over 15 mins, user had fallen in sleep. Commit logs.
sleep 900
pkill tshark
git add $TARGET
git commit -m "apd-tty tests $TIMESTAMP "