-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathu_systemcheck
More file actions
355 lines (298 loc) · 15.9 KB
/
u_systemcheck
File metadata and controls
355 lines (298 loc) · 15.9 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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#!/bin/bash
# Rainbow Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
ORANGE='\033[0;33m'
PINK='\033[1;35m'
NC='\033[0m' # No Color
# Background Colors
BG_RED='\033[41m'
BG_GREEN='\033[42m'
BG_YELLOW='\033[43m'
BG_BLUE='\033[44m'
BG_PURPLE='\033[45m'
BG_CYAN='\033[46m'
BG_WHITE='\033[47m'
# Bold and Effects
BOLD='\033[1m'
UNDERLINE='\033[4m'
BLINK='\033[5m'
REVERSE='\033[7m'
# Function to display rainbow banner
show_banner() {
clear
echo -e "${BOLD}"
echo -e " ${BLUE}╔══════════════════════════════════════════════════════════════════════════════════╗${NC}"
echo -e " ${PURPLE}║${NC}${BG_CYAN}${WHITE} 🛰️ WIFI ADAPTER COMPATIBILITY SCANNER 🛰️ ${NC}${PURPLE}║${NC}"
echo -e " ${BLUE}║${NC}${CYAN} Advanced Packet Injection & Monitor Mode Detection ${NC}${BLUE}║${NC}"
echo -e " ${PURPLE}║${NC}${YELLOW} Created for Pentesters & Researchers ${NC}${PURPLE}║${NC}"
echo -e " ${BLUE}╚══════════════════════════════════════════════════════════════════════════════════╝${NC}"
echo -e "${NC}"
}
# Function for animated loading
animated_loading() {
local text="$1"
local spin=('⣷' '⣯' '⣟' '⡿' '⢿' '⣻' '⣽' '⣾')
local i=0
for i in {1..10}; do
printf "\r${CYAN}${spin[i % 8]}${NC} ${text}..."
sleep 0.1
done
printf "\r${GREEN}✓${NC} ${text} completed! \n"
}
# Function to check root privileges
check_root() {
if [[ $EUID -eq 0 ]]; then
echo -e "${GREEN}✓${NC} Running with root privileges"
return 0
else
echo -e "${RED}✗${NC} This script requires root privileges."
echo -e "${YELLOW}Please run with: ${BOLD}sudo $0${NC}"
exit 1
fi
}
# Function to detect all wireless interfaces
detect_wireless_interfaces() {
echo -e "\n${PURPLE}📡 Scanning for wireless interfaces...${NC}"
# Get all wireless interfaces
INTERFACES=($(iw dev 2>/dev/null | grep -E "Interface [a-zA-Z0-9]+" | cut -d' ' -f2))
if [ ${#INTERFACES[@]} -eq 0 ]; then
echo -e "${YELLOW}⚠️ No wireless interfaces found via 'iw dev'${NC}"
# Alternative detection method
INTERFACES=($(ls /sys/class/net/ | grep -E "^(wlan|wlx|wlp|wifi)"))
fi
if [ ${#INTERFACES[@]} -eq 0 ]; then
echo -e "${RED}✗ No wireless interfaces detected${NC}"
return 1
fi
echo -e "${GREEN}✓ Found ${#INTERFACES[@]} wireless interface(s)${NC}"
return 0
}
# Function to check monitor mode support
check_monitor_mode() {
local interface="$1"
echo -e "${BLUE} Checking monitor mode...${NC}"
# Check via iw list
local phy=$(cat /sys/class/net/$interface/phy80211/name 2>/dev/null)
if [ -n "$phy" ]; then
if iw phy $phy info 2>/dev/null | grep -q "monitor"; then
echo -e "${GREEN} ✓ Monitor mode supported${NC}"
return 0
fi
fi
# Alternative check
if iw list 2>/dev/null | grep -A 20 "$interface" | grep -q "monitor"; then
echo -e "${GREEN} ✓ Monitor mode supported${NC}"
return 0
fi
echo -e "${RED} ✗ Monitor mode not supported${NC}"
return 1
}
# Function to check packet injection support
check_packet_injection() {
local interface="$1"
echo -e "${BLUE} Checking packet injection...${NC}"
# Method 1: Check via iw list
local phy=$(cat /sys/class/net/$interface/phy80211/name 2>/dev/null)
if [ -n "$phy" ]; then
if iw phy $phy info 2>/dev/null | grep -q "injection"; then
echo -e "${GREEN} ✓ Packet injection supported${NC}"
return 0
fi
fi
# Method 2: Check via modinfo
local driver=$(ethtool -i $interface 2>/dev/null | grep driver | cut -d: -f2 | tr -d ' ')
if [ -n "$driver" ]; then
if modinfo $driver 2>/dev/null | grep -q "injection"; then
echo -e "${GREEN} ✓ Packet injection supported (driver: $driver)${NC}"
return 0
fi
fi
# Method 3: Try to enable monitor mode and test
echo -e "${YELLOW} ⚠️ Performing injection test...${NC}"
# Kill conflicting processes
sudo airmon-ng check kill &>/dev/null
# Try to enable monitor mode
if sudo airmon-ng start $interface &>/dev/null; then
MONITOR_IFACE="${interface}mon"
sleep 2
# Test injection with aireplay-ng
if timeout 10 sudo aireplay-ng --test $MONITOR_IFACE &>/dev/null; then
echo -e "${GREEN} ✓ Packet injection TEST PASSED${NC}"
# Clean up
sudo airmon-ng stop $MONITOR_IFACE &>/dev/null
sudo systemctl restart NetworkManager &>/dev/null
return 0
fi
# Clean up
sudo airmon-ng stop $MONITOR_IFACE &>/dev/null
sudo systemctl restart NetworkManager &>/dev/null
fi
echo -e "${RED} ✗ Packet injection not supported${NC}"
return 1
}
# Function to check driver compatibility
check_driver_compatibility() {
local interface="$1"
echo -e "${BLUE} Checking driver compatibility...${NC}"
local driver=$(ethtool -i $interface 2>/dev/null | grep driver | cut -d: -f2 | tr -d ' ')
local known_good_drivers=("ath9k_htc" "rt2800usb" "rtl8187" "ath5k" "ath9k" "rt73usb" "rtl88xxau")
local known_bad_drivers=("iwlwifi" "b43" "brcmsmac" "wl")
if [ -z "$driver" ]; then
echo -e "${YELLOW} ⚠️ Driver information unavailable${NC}"
return 2
fi
for good_driver in "${known_good_drivers[@]}"; do
if [[ "$driver" == *"$good_driver"* ]]; then
echo -e "${GREEN} ✓ Compatible driver: $driver${NC}"
return 0
fi
done
for bad_driver in "${known_bad_drivers[@]}"; do
if [[ "$driver" == *"$bad_driver"* ]]; then
echo -e "${RED} ✗ Incompatible driver: $driver${NC}"
return 1
fi
done
echo -e "${YELLOW} ⚠️ Unknown driver: $driver${NC}"
return 2
}
# Function to display supported banner
show_supported_banner() {
echo -e "\n"
echo -e "${BOLD}${BG_GREEN}${WHITE} ${NC}"
echo -e "${BOLD}${BG_GREEN}${WHITE} 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 ${NC}"
echo -e "${BOLD}${BG_GREEN}${WHITE} 🎉 🎉 ${NC}"
echo -e "${BOLD}${BG_GREEN}${WHITE} 🎉 ${NC}${BOLD}${WHITE}YOUR WIFI CARD IS SUPPORTED! 🚀${NC}${BG_GREEN}${WHITE} 🎉 ${NC}"
echo -e "${BOLD}${BG_GREEN}${WHITE} 🎉 🎉 ${NC}"
echo -e "${BOLD}${BG_GREEN}${WHITE} 🎉 ${NC}${BOLD}${WHITE}Packet Injection & Monitor Mode Available${NC}${BG_GREEN}${WHITE} 🎉 ${NC}"
echo -e "${BOLD}${BG_GREEN}${WHITE} 🎉 🎉 ${NC}"
echo -e "${BOLD}${BG_GREEN}${WHITE} 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 ${NC}"
echo -e "\n"
echo -e "${GREEN}${BOLD}╔══════════════════════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}${BOLD}║ 🎯 READY FOR PENTESTING! 🎯 ║${NC}"
echo -e "${GREEN}${BOLD}║ Your adapter can perform ARP spoofing, packet injection, ║${NC}"
echo -e "${GREEN}${BOLD}║ monitor mode, and all advanced attacks! ║${NC}"
echo -e "${GREEN}${BOLD}╚══════════════════════════════════════════════════════════════════════════════════╝${NC}"
}
# Function to display not supported banner
show_not_supported_banner() {
echo -e "\n"
echo -e "${BOLD}${BG_RED}${WHITE} ${NC}"
echo -e "${BOLD}${BG_RED}${WHITE} 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 ${NC}"
echo -e "${BOLD}${BG_RED}${WHITE} 😞 😞 ${NC}"
echo -e "${BOLD}${BG_RED}${WHITE} 😞 ${NC}${BOLD}${WHITE}SORRY, YOUR WIFI CARD IS NOT SUPPORTED 😔${NC}${BG_RED}${WHITE} 😞 ${NC}"
echo -e "${BOLD}${BG_RED}${WHITE} 😞 😞 ${NC}"
echo -e "${BOLD}${BG_RED}${WHITE} 😞 ${NC}${BOLD}${WHITE}Missing Packet Injection or Monitor Mode${NC}${BG_RED}${WHITE} 😞 ${NC}"
echo -e "${BOLD}${BG_RED}${WHITE} 😞 😞 ${NC}"
echo -e "${BOLD}${BG_RED}${WHITE} 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 😞 ${NC}"
echo -e "\n"
echo -e "${RED}${BOLD}╔══════════════════════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${RED}${BOLD}║ ❌ RECOMMENDED ADAPTERS ❌ ║${NC}"
echo -e "${RED}${BOLD}║ ║${NC}"
echo -e "${RED}${BOLD}║ ${CYAN}• Alfa AWUS036ACH ${YELLOW}(AC1200) ${GREEN}- HIGHLY RECOMMENDED 🏆${NC}${RED}${BOLD} ║${NC}"
echo -e "${RED}${BOLD}║ ${CYAN}• Alfa AWUS036NHA ${YELLOW}(N300) ${GREEN}- Good budget option${NC}${RED}${BOLD} ║${NC}"
echo -e "${RED}${BOLD}║ ${CYAN}• Panda PAU09 ${YELLOW}(AC1200) ${GREEN}- Reliable performance${NC}${RED}${BOLD} ║${NC}"
echo -e "${RED}${BOLD}║ ${CYAN}• TP-Link TL-WN722N v1 ${YELLOW}(N150) ${GREEN}- Cheap but works${NC}${RED}${BOLD} ║${NC}"
echo -e "${RED}${BOLD}║ ║${NC}"
echo -e "${RED}${BOLD}╚══════════════════════════════════════════════════════════════════════════════════╝${NC}"
}
# Function to display interface details
display_interface_details() {
local interface="$1"
local monitor_support="$2"
local injection_support="$3"
local driver_status="$4"
echo -e "\n${PURPLE}🔍 Interface: ${BOLD}$interface${NC}"
echo -e "${BLUE}────────────────────────────────────────────────────────────────────────────────${NC}"
# Get interface details
local mac=$(cat /sys/class/net/$interface/address 2>/dev/null || echo "Unknown")
local driver=$(ethtool -i $interface 2>/dev/null | grep driver | cut -d: -f2 | tr -d ' ' || echo "Unknown")
local bus=$(udevadm info --query=property --path=/sys/class/net/$interface 2>/dev/null | grep ID_BUS | cut -d= -f2 || echo "Unknown")
echo -e " ${CYAN}📟 MAC Address:${NC} $mac"
echo -e " ${CYAN}⚙️ Driver:${NC} $driver"
echo -e " ${CYAN}🔌 Bus:${NC} $bus"
# Display capabilities
echo -e " ${CYAN}🎯 Capabilities:${NC}"
if [ "$monitor_support" -eq 0 ]; then
echo -e " ${GREEN}✅ Monitor Mode: SUPPORTED${NC}"
else
echo -e " ${RED}❌ Monitor Mode: NOT SUPPORTED${NC}"
fi
if [ "$injection_support" -eq 0 ]; then
echo -e " ${GREEN}✅ Packet Injection: SUPPORTED${NC}"
else
echo -e " ${RED}❌ Packet Injection: NOT SUPPORTED${NC}"
fi
case $driver_status in
0) echo -e " ${GREEN}✅ Driver: COMPATIBLE${NC}" ;;
1) echo -e " ${RED}❌ Driver: INCOMPATIBLE${NC}" ;;
*) echo -e " ${YELLOW}⚠️ Driver: UNKNOWN${NC}" ;;
esac
}
# Main scanning function
main_scan() {
local overall_supported=1
local supported_interfaces=()
show_banner
check_root
echo -e "${CYAN}🚀 Starting comprehensive WiFi adapter scan...${NC}"
animated_loading "Initializing scanner"
if ! detect_wireless_interfaces; then
show_not_supported_banner
exit 1
fi
echo -e "\n${YELLOW}🔎 Scanning ${#INTERFACES[@]} wireless interface(s)...${NC}"
for interface in "${INTERFACES[@]}"; do
echo -e "\n${PURPLE}────────────────────────────────────────────────────────────────────────────────${NC}"
# Check if interface exists and is wireless
if [ ! -d "/sys/class/net/$interface" ]; then
echo -e "${RED}✗ Interface $interface not found${NC}"
continue
fi
if [ ! -d "/sys/class/net/$interface/phy80211" ]; then
echo -e "${YELLOW}⚠️ $interface is not a wireless interface${NC}"
continue
fi
# Perform checks
check_monitor_mode "$interface"
local monitor_result=$?
check_packet_injection "$interface"
local injection_result=$?
check_driver_compatibility "$interface"
local driver_result=$?
# Display detailed results
display_interface_details "$interface" "$monitor_result" "$injection_result" "$driver_result"
# Check if this interface is fully supported
if [ $monitor_result -eq 0 ] && [ $injection_result -eq 0 ]; then
supported_interfaces+=("$interface")
overall_supported=0
fi
done
echo -e "\n${PURPLE}────────────────────────────────────────────────────────────────────────────────${NC}"
echo -e "${CYAN}📊 SCAN SUMMARY:${NC}"
echo -e " ${GREEN}✅ Supported interfaces: ${#supported_interfaces[@]}${NC}"
echo -e " ${RED}❌ Unsupported interfaces: $((${#INTERFACES[@]} - ${#supported_interfaces[@]}))${NC}"
# Display final result
if [ $overall_supported -eq 0 ]; then
show_supported_banner
echo -e "\n${GREEN}🎉 Supported Interfaces: ${supported_interfaces[*]}${NC}"
else
show_not_supported_banner
fi
# Additional recommendations
echo -e "\n${YELLOW}💡 TIPS:${NC}"
echo -e " ${WHITE}• USB adapters generally work better than built-in WiFi${NC}"
echo -e " ${WHITE}• Look for adapters with Atheros or Ralink chipsets${NC}"
echo -e " ${WHITE}• Avoid Intel and Broadcom built-in WiFi for packet injection${NC}"
}
# Run the main function
main_scan
# Wait for user input before exiting
echo -e "\n${CYAN}Press any key to exit...${NC}"
read -n 1 -s