-
Notifications
You must be signed in to change notification settings - Fork 0
/
wifix.sh
281 lines (267 loc) · 8.18 KB
/
wifix.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#!/bin/bash
# wifix
# Versión: 1.1
# Licencia: GPLv3
# Copyright 2018, AnonymousWebHacker
# for internal use only
# Valor de colores de baner
export BLUE='\033[1;94m'
export GREEN='\033[1;92m'
export RED='\033[1;91m'
export RESETCOLOR='\033[1;00m'
export SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
# Baner del programa
function print_banner() {
reset # reset terminal
echo -e "$BLUE
||============================||
||$RED WIFIX $BLUE ||
|| By AnonmousWebHacker ||
||----------------------------|| $BLUE
|| wifix.sh v 1.1 ||
||============================||
$GREEN Create Wifix GNU/Linux #$RESETCOLOR
" >&2
}
# Comprobar existencia de adaptadores de red. Wifi/Ethernet
function network_interfaces(){
#wireless_interface=`ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//"`;
wireless_interface=$(ls /sys/class/net | grep w);
ethernet_interface=$(ls /sys/class/net | grep e);
clear;
}
# Menu principal
function menu(){
centralize;
title="====================== [ WIFI AP MENU ] ======================"
prompt="Selection :"
# Si existe el adaptador wifi
# if [ wireless_interface= ls /sys/class/net | grep w ] && [ ethernet_interface= ls /sys/class/net | grep e ]; then
options=("[] Create_AP" "[] Share_Ethernet" "[] More")
echo "$title"
PS3="$prompt"
select opt in "${options[@]}" "[] Quit/Cancel"; do
case "$REPLY" in
1 ) clear;
#AP;
print;;
2 ) clear;
Share_Ethernet;;
3 ) echo "Menu en desarrollo";;
$(( ${#options[@]}+1 )) ) clear; echo "Tnks by AnonymousWebHacker"; exit;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
return
}
# Menu Configuracion AP Wifi
function Share_Wifi(){
#print_banner
title="=========== [ SHARE WIFI ] ==========="
prompt="Select:"
options=("[] Default" "[] Channger SSID/Pass" "[] Back to Menu")
echo "$title"
PS3="$prompt"
select opt in "${options[@]}" "[] Quit/Cancel"; do
case "$REPLY" in
1 ) echo "You picked $opt which is option $REPLY";
WifiDefault;;
2 ) echo "You picked $opt which is option $REPLY";
clear;
ChanngerConfig;;
3 ) echo "You picked $opt which is option $REPLY";
clear;
menu;;
4 ) echo "You picked $opt which is option $REPLY";
clear;
echo "By AnonmousWebHacker";
exit;;
$(( ${#options[@]}+1 )) ) clear; echo "AnonymousWebHacker"; exit;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
return
}
# Menu despues de AP Wifi Creada
function wifiUp(){
#print_banner
title="======= [ WIFI AP MENU ] ======="
prompt="Selection :"
options=("[] Stop_Share_Wifi" "[] Changer SSID\Pass" "[] More")
echo "$title"
PS3="$prompt"
select opt in "${options[@]}" "[] Quit/Cancel"; do
case "$REPLY" in
1 ) echo "You picked $opt which is option $REPLY";
clear;
echo ifconfig ap1 stop;
menu;
clear;;
2 ) echo "You picked $opt which is option $REPLY"; #cambiar este
clear;
ChanngerConfig;;
3 ) echo "You picked $opt which is option $REPLY"; #revisar
clear;
echo ifconfig ap1 stop;
menu;
clear;;
$(( ${#options[@]}+1 )) ) clear; echo "AnonymousWebHacker"; exit;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
return
}
# Menu Configuracion AP Share_Ethernet
function Share_Ethernet(){
#print_banner
title="=========== [ SHARE ETHERNET ] ==========="
prompt="Select:"
options=("[] Default" "[] Channger SSID/Pass" "[] Back to Menu")
echo "$title"
PS3="$prompt"
select opt in "${options[@]}" "[] Quit/Cancel"; do
case "$REPLY" in
1 ) echo "You picked $opt which is option $REPLY";
WifiDefault;;
2 ) echo "You picked $opt which is option $REPLY";
ChanngerConfig;;
3 ) echo "You picked $opt which is option $REPLY";
clear;
menu;;
4 ) echo "You picked $opt which is option $REPLY";;
# exit;;
$(( ${#options[@]}+1 )) ) clear; echo "AnonymousWebHacker"; exit;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
return
}
function ChanngerConfig(){
clear;
#print_banner
echo " [** Introduzca el nombre del SSID **] "
echo -n "SSID : "
read SSID
clear
echo $SSID > //tmp/wifix.look;
confirpass;
# if [ ${#string} -ge 8 ]; then
# echo ">= 12 characters. too long"
# exit
# else
# echo "under 12 characters, not too long."
# fi
}
function WifiDefault(){
#print_banner
SSID="wifi";
PASS=123456789;
clear;
sudo create_ap $wireless_interface $ethernet_interface $SSID $PASS;
if [ $? -eq 0 ]; then
echo "AP Creado correctamente";
echo "[ SSID: ] $SSID"
echo "[Password]: $PASS"
wifiUp;
else
echo "A ocurrido un error, revise los logs en //tmp/wifix.log "
# Guardar logs
sudo create_ap $wireless_interface $ethernet_interface $SSID $PASS > //tmp/wifix.logs;
fi
}
# Validar Caracteristicas Password
function confirpass(){
#print_banner
echo " [** Establezca el password del SSID **] "
echo -n "Password : "
read PASS
let longpass=$(echo ${#PASS});
if [ "$PASS" = '' ]; then
#echo "Su pass no Cumple con las condiciones";
clear;
echo "**********[ El campo pass no pude estar vacio ] **********";
confirpass;
fi
# menor de 8 y mayor q 63
if [[ $longpass -lt 8 ]]; then
clear;
echo "***[ Su password debe de tener de 8-63 caracteres ] ***";
confirpass;
elif [[ $longpass -gt 63 ]]; then
echo "***[ Su password debe de tener de 8-63 caracteres ] ***";
confirpass;
fi
clear;
echo $PASS >> //tmp/wifix.look;
if [ $noAP = "true" ];
then
ap_without_Internet_sharing;
fi
sudo create_ap $wireless_interface $wireless_interface $SSID $PASS;
echo "AP Creado [SSID: $SSID] [Password: $PASS]";
wifiUp;
}
function Open_Wifi(){
clear;
#print_banner
echo " [** Introduzca el nombre del SSID **] "
echo -n "SSID : "
read SSID
clear
echo $SSID > //tmp/wifix.look;
sudo create_ap $wireless_interface $ethernet_interface $SSID;
wifiUp;
}
function ap_without_Internet_sharing(){
noAP="true";
ChanngerConfig;
clear;
echo create_ap -n $wireless_interface MyAccessPoint MyPassPhrase
}
function AP(){
#print_banner
title="=========== [ ACCESS POINT ] ==========="
prompt="Select:"
options=("[] AP_Open" "[] AP_No_Sharing" "[] Back to Menu")
echo "$title"
PS3="$prompt"
select opt in "${options[@]}" "[] Quit/Cancel"; do
case "$REPLY" in
1 ) echo "You picked $opt which is option $REPLY";
Open_Wifi;;
2 ) echo "You picked $opt which is option $REPLY";
ap_without_Internet_sharing;;
3 ) echo "You picked $opt which is option $REPLY";
clear;
menu;;
$(( ${#options[@]}+1 )) ) clear; echo "AnonymousWebHacker"; exit;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
return
}
get_root_access()
{
if [ $USER != "root" ]; then
clear;
i=8; centralize;
echo " ...You need root privileges...."
sudo -s ./ap-configuration-script
else
verify_ap_support;
initializations;
init_program;
fi
}
centralize()
{
while [ $i -ne 0 ]; do
echo " ";
((i-=1));
done
}
# Comienzo del script
get_root_access;
network_interfaces
print_banner
menu