我正在尝试修改下面的脚本,以便在检测到与特定格式匹配的探测器时能够在终端中发出警报。我要匹配的格式是“KD-??????????????”有人能帮我吗?你知道吗
#!/usr/bin/env python
# -- coding: utf-8 --
from scapy.all import *
unique_probe = []
def Handler(pkt):
if pkt.haslayer(Dot11): # 802.11
if pkt.type == 0 and pkt.subtype == 4: # mgmt, probe request
if pkt.addr2 not in unique_probe :
unique_probe.append(pkt.addr2)
#####need something here to match pkt.info to a condition e.g. if pkt.info=KD* then
print "MAC: %s probing for %s possible use of KarmaDetector" %(pkt.addr2, pkt.info)
sniff(iface="wla0mon", count=0, prn=Handler, store=0) # sudo rfkill unblock wifi && sudo airmon-ng start wlan0
你知道吗 首先,如果需要唯一的值,不要使用
list
对象。使用set
对象。你知道吗其次,您可以使用
Dot11 in pkt
而不是pkt.haslayer(Dot11)
。你知道吗然后,只需解析
Dot11Elt
层即可找到相关值:相关问题 更多 >
编程相关推荐