-
Notifications
You must be signed in to change notification settings - Fork 1
/
WiFi-scanner.sh
136 lines (116 loc) · 4.11 KB
/
WiFi-scanner.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
#!/bin/bash
clear
# Text colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo "
█░█░█ █ █▀▀ █ █▀ █▀▀ ▄▀█ █▄░█ █▄░█ █▀▀ █▀█
▀▄▀▄▀ █ █▀░ █ ▄█ █▄▄ █▀█ █░▀█ █░▀█ ██▄ █▀▄
"
echo -e "${BLUE}- - - - - - - - - - - - - - - - - - by Ludde${NC}"
sleep 2
echo
# Installing the tools if they are not installed
if ! command -v hcxdumptool > /dev/null; then
echo -e "${YELLOW}[!] hcxdumptool not found. Installing...${NC}"
sudo apt update
sudo apt install hcxdumptool -y
echo -e "${GREEN}[*] hcxdumptool installed.${NC}"
echo
fi
if ! command -v hcxpcapngtool > /dev/null; then
echo -e "${YELLOW}[!] hcxpcapngtool not found. Installing...${NC}"
sudo apt update
sudo apt install hcxtools -y
echo -e "${GREEN}[*] hcxpcapngtool installed.${NC}"
echo
fi
if ! command -v xterm > /dev/null; then
echo -e "${YELLOW}[!] xterm not found. Installing...${NC}"
sudo apt update
sudo apt install xterm -y
echo -e "${GREEN}[*] xterm installed.${NC}"
echo
fi
echo -e "${BLUE}[*] ${GREEN}All tools required are installed.${NC}"
echo
# Stopping services that may cause issues
sudo systemctl stop wpa_supplicant.service
sudo systemctl stop NetworkManager.service
# List adapters
echo -e "${BLUE}[*] ${GREEN}List of available WiFi adapters:${NC}"
adapters=$(iwconfig 2>/dev/null | grep -oP '^[^\s]+')
counter=1
while read -r adapter; do
echo "$counter. $adapter"
counter=$((counter + 1))
done <<< "$adapters"
echo
# Ask user for the wlan they want to use
read -p "[-] Enter the WLAN you wish to use (example: wlan0): " wlan
echo
if ! iwconfig "$wlan" > /dev/null 2>&1; then
echo -e "${YELLOW}[!] Invalid WLAN name. Please enter a valid WLAN name.${NC}"
sudo systemctl start wpa_supplicant.service
sudo systemctl start NetworkManager.service
exit 1
fi
# Ask user for the output pcapng file name
read -p "[-] Enter the pcapng output filename (without extension): " pcapngfile
output="${pcapngfile}.pcapng"
echo
# Choose a mode
read -p "[-] Choose a mode:
1. Timer mode
2. Manual mode
Enter your choice (1 or 2): " mode
echo
case $mode in
1)
read -p "[-] Enter the duration (in seconds) to run the command: " duration
echo
echo -e "${BLUE}[*] Running hcxdumptool command in timer mode...${NC}"
xterm -T "hcxdumptool" -e sudo hcxdumptool -i "$wlan" -o "$output" --active_beacon --enable_status=63 &
pid=$!
sleep "$duration"
sudo kill "$pid"
;;
2)
# Running the hcxdumptool in manual mode
echo -e "${BLUE}[*] Running hcxdumptool command in manual mode. Press Ctrl+C to stop.${NC}"
xterm -T "hcxdumptool" -e sudo hcxdumptool -i "$wlan" -o "$output" --active_beacon --enable_status=63
;;
*)
echo -e "${YELLOW}[!] Invalid choice. Please choose 1 or 2.${NC}"
sudo systemctl start wpa_supplicant.service
sudo systemctl start NetworkManager.service
exit 1
;;
esac
# Starting the services we stopped earlier
sudo systemctl start wpa_supplicant.service
sudo systemctl start NetworkManager.service
echo
echo
# Ask the user to enter a filename for the hc22000 file
read -p "[-] Enter the hashcat file name (without extension): " hcfile
hashcatFile="${hcfile}.hc22000"
echo
# Ask the user for a name for the ESSID list
read -p "[-] Enter the ESSID list name: " essidList
echo
# Convert the pcapng file to a hc22000 file and create a ESSID list
echo -e "${BLUE}[*] Running hcxpcapngtool command...${NC}"
xterm -T "hcxpcapngtool" -e hcxpcapngtool -o "$hashcatFile" -E "$essidList" "$output"
clear
sleep 1
# Message when finished
echo "
█░█░█ █ █▀▀ █ █▀ █▀▀ ▄▀█ █▄░█ █▄░█ █▀▀ █▀█
▀▄▀▄▀ █ █▀░ █ ▄█ █▄▄ █▀█ █░▀█ █░▀█ ██▄ █▀▄
"
echo -e "${BLUE}- - - - - - - - - - - - - - - - - - by Ludde${NC}"
echo
echo -e "${YELLOW}[*] WiFi scanner completed.${NC}"