-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart-lab.sh
More file actions
executable file
·211 lines (197 loc) · 8.82 KB
/
start-lab.sh
File metadata and controls
executable file
·211 lines (197 loc) · 8.82 KB
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
#!/bin/bash
#
# ------------------------------------------------------------------------------------------------
#
# + Lab Virtual Wireless Hacking
#
# + Github: https://github.com/fixploit03/Lab-Virtual-Wireless-Hacking/
# + Dibuat oleh: Rofi (Fixploit03)
#
# ------------------------------------------------------------------------------------------------
v="v1.0.1"
# cek root
if [[ $EUID -ne 0 ]]; then
echo "Error: script ini harus dijalankan sebagai root!"
exit 1
fi
# banner
echo -e " ___ __ __ _ _ __ __ "
echo -e " | | | | | || | _ | || | | | "
echo -e " | | | |_| || || || || |_| | "
echo -e " | | | || || | "
echo -e " | |___ | || || | "
echo -e " | | | | | _ || _ | "
echo -e " |_______| |___| |__| |__||__| |__| ${v} "
echo -e ""
echo -e " Lab Virtual Wireless Hacking "
echo -e "https://github.com/fixploit03/Lab-Virtual-Wireless-Hacking"
echo -e ""
# lepas modul
if lsmod | grep -q mac80211_hwsim; then
modprobe -r mac80211_hwsim
fi
list_service=("hostapd" "dnsmasq" "wpa_supplicant" "dhclient" "freeradius" "NetworkManager")
# kill service
for service in "${list_service[@]}"; do
if pgrep -x "${service}" &>/dev/null; then
if [[ "${service}" == "NetworkManager" ]]; then
systemctl stop "${service}"
else
pkill -9 "${service}"
fi
fi
done
# ngaktifin modul
modprobe mac80211_hwsim radios=30
sleep 1
# ganti mac address
for i in $(seq 0 29); do
ip l set "wlan${i}" down
macchanger -r "wlan${i}"
ip l set "wlan${i}" up
done
# nama ns (network space)
network_space=(
"opn"
"wpa-personal"
"wpa2-personal"
"wpa-wpa2-personal"
"wpa2-enterprise"
"wpa3-transition"
"wpa3-sae"
)
# konfigurasi ns
for ns in "${network_space[@]}"; do
# hapus ns kalo udah ada
if ip netns l | grep -q "${ns}"; then
ip netns d "${ns}"
fi
# bikin ns
ip netns a "${ns}"
ip netns exec "${ns}" ip l set lo up
# wifi open
if [[ "${ns}" == "opn" ]]; then
for i in $(seq 2 5); do
interface="wlan${i}"
phy=$(iw dev "${interface}" info | grep wiphy | awk '{print "phy"$2}')
iw phy "${phy}" set netns name "${ns}"
done
ip netns exec "${ns}" ip a a 10.10.1.1/24 dev wlan2
ip netns exec "${ns}" hostapd -B conf/opn/hostapd.conf
sleep 1
ip netns exec "${ns}" dnsmasq -C conf/opn/dnsmasq.conf
for i in $(seq 3 5); do
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i "wlan${i}" -c conf/opn/wpa_supplicant.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient "wlan${i}"
done
# wifi wpa-personal
elif [[ "${ns}" == "wpa-personal" ]]; then
for i in $(seq 6 9); do
interface="wlan${i}"
phy=$(iw dev "${interface}" info | grep wiphy | awk '{print "phy"$2}')
iw phy "${phy}" set netns name "${ns}"
done
ip netns exec "${ns}" ip a a 10.10.10.1/24 dev wlan6
ip netns exec "${ns}" hostapd -B conf/wpa-personal/hostapd.conf
sleep 1
ip netns exec "${ns}" dnsmasq -C conf/wpa-personal/dnsmasq.conf
for i in $(seq 7 9); do
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i "wlan${i}" -c conf/wpa-personal/wpa_supplicant.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient "wlan${i}"
done
# wifi wpa2-personal
elif [[ "${ns}" == "wpa2-personal" ]]; then
for i in $(seq 10 13); do
interface="wlan${i}"
phy=$(iw dev "${interface}" info | grep wiphy | awk '{print "phy"$2}')
iw phy "${phy}" set netns name "${ns}"
done
ip netns exec "${ns}" ip a a 10.10.20.1/24 dev wlan10
ip netns exec "${ns}" hostapd -B conf/wpa2-personal/hostapd.conf
sleep 1
ip netns exec "${ns}" dnsmasq -C conf/wpa2-personal/dnsmasq.conf
for i in $(seq 11 13); do
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i "wlan${i}" -c conf/wpa2-personal/wpa_supplicant.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient "wlan${i}"
done
# wifi wpa/wpa2-personal
elif [[ "${ns}" == "wpa-wpa2-personal" ]]; then
for i in $(seq 14 17); do
interface="wlan${i}"
phy=$(iw dev "${interface}" info | grep wiphy | awk '{print "phy"$2}')
iw phy "${phy}" set netns name "${ns}"
done
ip netns exec "${ns}" ip a a 10.10.30.1/24 dev wlan14
ip netns exec "${ns}" hostapd -B conf/wpa2-mixed/hostapd.conf
sleep 1
ip netns exec "${ns}" dnsmasq -C conf/wpa2-mixed/dnsmasq.conf
for i in $(seq 15 17); do
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i "wlan${i}" -c conf/wpa2-mixed/wpa_supplicant.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient "wlan${i}"
done
# wifi wpa2-enterprise
elif [[ "${ns}" == "wpa2-enterprise" ]]; then
for i in $(seq 18 21); do
interface="wlan${i}"
phy=$(iw dev "${interface}" info | grep wiphy | awk '{print "phy"$2}')
iw phy "${phy}" set netns name "${ns}"
done
ip netns exec "${ns}" ip a a 10.10.40.1/24 dev wlan18
ip netns exec "${ns}" freeradius
ip netns exec "${ns}" hostapd -B conf/wpa2-enterprise/hostapd.conf
sleep 1
ip netns exec "${ns}" dnsmasq -C conf/wpa2-enterprise/dnsmasq.conf
# Ucup
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i wlan19 -c conf/wpa2-enterprise/ucup.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient wlan19
#
# Adit
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i wlan20 -c conf/wpa2-enterprise/adit.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient wlan20
#
# Juned
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i wlan21 -c conf/wpa2-enterprise/juned.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient wlan21
# wifi wpa3-transition
elif [[ "${ns}" == "wpa3-transition" ]]; then
for i in $(seq 22 25); do
interface="wlan${i}"
phy=$(iw dev "${interface}" info | grep wiphy | awk '{print "phy"$2}')
iw phy "${phy}" set netns name "${ns}"
done
ip netns exec "${ns}" ip a a 10.10.50.1/24 dev wlan22
ip netns exec "${ns}" hostapd -B conf/wpa3-transition/hostapd.conf
sleep 1
ip netns exec "${ns}" dnsmasq -C conf/wpa3-transition/dnsmasq.conf
for i in $(seq 23 25); do
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i "wlan${i}" -c conf/wpa3-transition/wpa_supplicant.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient "wlan${i}"
done
# wifi wpa3-sae
elif [[ "${ns}" == "wpa3-sae" ]]; then
for i in $(seq 26 29); do
interface="wlan${i}"
phy=$(iw dev "${interface}" info | grep wiphy | awk '{print "phy"$2}')
iw phy "${phy}" set netns name "${ns}"
done
ip netns exec "${ns}" ip a a 10.10.60.1/24 dev wlan26
ip netns exec "${ns}" hostapd -B conf/wpa3-sae/hostapd.conf
sleep 1
ip netns exec "${ns}" dnsmasq -C conf/wpa3-sae/dnsmasq.conf
for i in $(seq 27 29); do
ip netns exec "${ns}" wpa_supplicant -D nl80211 -i "wlan${i}" -c conf/wpa3-sae/wpa_supplicant.conf -B -q
sleep 1
ip netns exec "${ns}" dhclient "wlan${i}"
done
fi
done
echo -e "\n[+] OK."
exit 0