-
Notifications
You must be signed in to change notification settings - Fork 0
/
functorun
executable file
·92 lines (88 loc) · 2.09 KB
/
functorun
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
#!/bin/bash
setvarb() {
userid=$(awk -F: '!/root/ && /(\/bin\/bash)/ {print $1}' /etc/passwd)
#wlinterface=$(awk '/wifi/ {printf $1}' <<< "$(nmcli d)")
wlinterface=$(awk '!/mon/ && $1=="Interface" {printf $2}' <<< "$(iw dev)")
moninterface="mon0"
wpasupp="/etc/wpa_supplicant.conf"
userhomedir="/home/$userid"
echo "I am $userid"
popfn=""
startno="0"
wpscript="./2wpcommand"
extfunc="./functorun"
#2wpcommand
#wptooldir="$userhomedir/Documents/Docs/Linux/Kali/Tools"
#wptooldir="$userhomedir/Documents/Docs/mlinuxproject/wltools/wptools"
wptooldir="./wptools"
wp12dir="$wptooldir/wifiphisher-1.2"
wp12r2dir="$wptooldir/wifiphisher-1.2r2"
jaminterface=${wlinterface}mon3
macchanging="off"
jammode=2
stopaftertime=180
#extfunc2="./funcsh"
wptargnotes="./wptargnotes"
#4wpspintext
mc=on
ssidlog="./wps$ssid"
wpscript="./2wpcommand"
extfunc2="./func"
#4connectwifikey
#| head -2 | tail -1)
#nmcli c
#nmcli d wifi list
}
sourcefn() {
fntoadd=$1
refscript=$2
copiedto=$3
sed -rn "/(^$1\(\)[ ][{])/,/^}/p" $refscript | tee -a $copiedto
return 0
}
sourcescript() {
fntoadd=$1
refscript=$2
copiedto=$3
echo '#!/bin/bash' | tee "$copiedto"
sourcefn "(setvarb|sourcefn|sourcescript)" "./3callwlfunction" "$copiedto"
#sed -rn "/(^\#\#\#$1/,/^\#\#\#$1}/p" $refscript | tee -a $copiedto
sed -rn '/###'$1'/,/###'$1'/p' $refscript | tee -a "$copiedto"
#echo "setvarb" | tee -a $copiedto
return 0
}
setvarb
restartwlinterface() {
echo "$userid"
echo "$wlinterface"
sudo wpa_cli terminate ;
sudo killall python2 \
aircrack-ng \
wifiphisher \
dhclient \
wpa_supplicant \
NetworkManager ;\
#avahi-daemon
sudo airmon-ng stop mon0 ;\
sudo airmon-ng check kill ;\
allmon=($(awk '/mon/ {printf $1}' <<< "$(ifconfig)"))
if [[ -n $allmon ]] ; then
for f in ${#allmon[@]} ; do
sudo iw dev ${allmon[$[f]-1]} del
done
fi
#sudo iw dev $wlinterface del ;\
sudo ifconfig $wlinterface down ;\
sudo ifconfig $wlinterface up ;\
sudo modprobe b43 -r ;\
sudo modprobe b43 ;\
sleep 1
#rfkill unblock wlan wifi ;\
#sudo service network-manager restart ;\
sudo systemctl restart NetworkManager
sudo killall nm-applet ;\
nohup nm-applet &
sleep 3
return 0
}
restartwlinterface