-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradiotroll
executable file
·131 lines (105 loc) · 2.54 KB
/
radiotroll
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# yeah this is extremely bad written code, ill improve it when i wont be that lazy xD
# UPDATE everything went into frikkin functions niice
# also theres sudo everywhere you should feel AAANNGGEERRYY
# also don't ask about the commands xD
# (c) 2069 Plasmoxy, get r3kt u hav no rghights
version=0.7
wpasup_prefix="ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\nupdate_config=1"
supaddr=/etc/wpa_supplicant/wpa_supplicant.conf
ssid=""
psk=""
infobox="
--- Radiotroll direct wpa_supplicant and networking config tool ---
--- by Plasmoxy ( Sebastian Petrik ) ---
--- v${version} ---
usage: radiotroll command networkstate ...
networkstate :
o - for open networks
<anything else> - for normal networks
commands : [ Extremely creative 11/10 ]
kiss - create wpa supplicant file with given wifi password and ssid
---- Kisses the supplicant, but its nothing serious.
love - same as kiss but also resets networking
---- There is actually something going on
fury - resets networking
---- AANNGGEERRYY
info - prints content of wpa_supplicant
Also theres a free ifconfig on end of each command just for you ;)
xD
"
function permReadError {
echo " ERROR : you must be root to read supplicant ( dude no hakermen here xD )"
exit 1
}
function trigifconfig {
echo -e "\n--- ifconfig ---"
ifconfig
echo -e "\nDONE"
}
function updateSupp {
wpasup_fulldat="${wpasup_prefix}\nnetwork={\nssid=\"${ssid}\"\npsk=\"${psk}\"\n}"
}
function updateSuppOpen {
wpasup_fulldat="${wpasup_prefix}\nnetwork={\nssid=\"${ssid}\"\nkey_mgmt=NONE\n}"
}
function writeSupp {
echo -e "\nWriting to wpa_supplicant ...\n--- NEW SUPPLICANT ---\n"
sudo echo -e ${wpasup_fulldat} | sudo tee ${supaddr} || exit 1
echo -e "\nDONE"
}
function resetNet {
echo -e "\nRestarting networking ..."
sudo service networking restart || exit 1
echo -e "\nDONE"
}
function readCredentials {
echo -e "\nSSID : "
read ssid
echo -e "Password (psk) : "
read psk
echo -e "\n"
}
function supplicant {
if [ "$1" = "o" ]; then
echo -e "\n Open network SSID :"
read ssid
echo -e "\n"
updateSuppOpen
else
readCredentials
updateSupp
fi
writeSupp
}
function printSupplicant {
echo -e "--- CURRENT SUPPLICANT ---"
sudo cat ${supaddr} || permReadError
}
# argument scan
case "$1" in
"kiss")
supplicant $2
trigifconfig
;;
"love")
supplicant $2
resetNet
trigifconfig
;;
"fury")
resetNet
trigifconfig
;;
"info")
printSupplicant
trigifconfig
;;
"")
echo -e "${infobox}"
;;
*)
echo "Unknown argument. Run without arguments for help."
;;
esac
#eof