-
Notifications
You must be signed in to change notification settings - Fork 2
/
connect_to_ssid
executable file
·70 lines (57 loc) · 1.63 KB
/
connect_to_ssid
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
#!/bin/bash
set -e
IFACE="wlan1"
SSID=$1
KEY=$2
WAN=$3
echo "connecting to ssid:\"$SSID\" key:\"$KEY\" wan:\"$WAN\"";
#NETWORK_IDX=`wpa_cli add_network | grep -v Selected`
#wpa_cli set_network $NETWORK_IDX ssid \"$SSID\"
#wpa_cli set_network $NETWORK_IDX psk \"$KEY\"
#wpa_cli select_network $NETWORK_IDX
wpa_cli -i$IFACE disconnect
for i in `wpa_cli list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan1 remove_network $i; done
wpa_cli -i$IFACE add_network
wpa_cli -i$IFACE set_network 0 auth_alg OPEN
# If no password is given then dont use WPA as it is an open network
if [ "$KEY" == "n0pass" ]
then
echo "OPEN NETWORK, no password needed..";
wpa_cli -i$IFACE set_network 0 key_mgmt NONE
else
echo "WPA detected and using password..";
wpa_cli -i$IFACE set_network 0 key_mgmt WPA-PSK
wpa_cli -i$IFACE set_network 0 psk \"$KEY\"
fi
wpa_cli -i$IFACE set_network 0 mode 0
wpa_cli -i$IFACE set_network 0 ssid \"$SSID\"
wpa_cli -i$IFACE select_network 0
wpa_cli -i$IFACE enable_network 0
wpa_cli -i$IFACE reassociate
# wait to establish the connection
sleep 5
wpa_cli -i$IFACE status
iw $IFACE link
#_ Operator please connect me to the right long distance provider
case $WAN in
tor)
echo "WAN transport selected: TOR";
/home/pi/NetBuster/bridge_tor
;;
i2p)
echo "WAN transport selected: I2P";
/home/pi/NetBuster/bridge_i2p
;;
vpn)
echo "WAN transport selected: VPN";
/home/pi/NetBuster/bridge_vpn
;;
none)
echo "WAN transport selected: NONE";
/home/pi/NetBuster/bridge_none
;;
default)
echo "WAN selected: TOR";
/home/pi/NetBuster/bridge_tor
;;
esac