本文整理汇总了Python中scapy.layers.dot11.RadioTap方法的典型用法代码示例。如果您正苦于以下问题:Python dot11.RadioTap方法的具体用法?Python dot11.RadioTap怎么用?Python dot11.RadioTap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scapy.layers.dot11
的用法示例。
在下文中一共展示了dot11.RadioTap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shoot
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def shoot(self, tgt, deauth, _phaz_instance):
self.__c_TGT = tgt
if not self.__SNIFFER_STATUS:
sniffer_thread = threading.Thread(target=self.start_eapol_sniffer)
sniffer_thread.daemon = True
sniffer_thread.start()
while not self.__SNIFFER_STATUS:
time.sleep(1)
__pkt_to_cl = RadioTap() / Dot11(addr1=tgt, addr2=self.bssid, addr3=self.bssid) / Dot11Deauth(reason=7)
__pkt_to_ap = RadioTap() / Dot11(addr1=self.bssid, addr2=tgt, addr3=tgt) / Dot11Deauth(reason=7)
for n in range(deauth * 1):
sendp(__pkt_to_cl, iface=self.iface, count=1, verbose=False)
sendp(__pkt_to_ap, iface=self.iface, count=1, verbose=False)
if self.verify_handshake(tgt):
_phaz_instance.THEPOL = tuple(self.__c_HANDSHAKE)
示例2: get_auth_resp
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def get_auth_resp(self, pkt):
if pkt.haslayer(RadioTap):
if pkt.haslayer(Dot11Auth):
sn = pkt.getlayer(Dot11).addr2.replace(':', '')
rc = pkt.getlayer(Dot11).addr1.replace(':', '')
if rc == self.cl.replace(':', '') and sn == self.ap.replace(':', ''):
if self.verbose:
self.pull.info("Received %s (%s) %s<%s %s (%s) %s[Open Authentication]%s" % \
(self.cl.replace(':', '').upper(), self.pull.DARKCYAN+org(self.cl).org+self.pull.END, self.pull.RED, self.pull.END, self.ap.replace(':', '').upper(),\
self.pull.DARKCYAN+org(self.ap).org+self.pull.END, self.pull.YELLOW, self.pull.END))
self.pull.info("Authentication %s (%s) %s>%s %s (%s) %s[SuccessFull]%s" % \
(self.ap.replace(':', '').upper(), self.pull.DARKCYAN+org(self.ap).org+self.pull.END, self.pull.RED, self.pull.END, self.cl.replace(':', '').upper(),\
self.pull.DARKCYAN+org(self.cl).org+self.pull.END, self.pull.GREEN, self.pull.END))
else:
self.pull.info("Received %s %s<%s %s %s[Open Authentication]%s" % (self.cl.replace(':', '').upper(), self.pull.RED, self.pull.END,\
self.ap.replace(':', '').upper(), self.pull.YELLOW, self.pull.END))
self.pull.info("Authentication %s %s>%s %s %s[SuccessFull]%s" % \
(self.ap.replace(':', '').upper(), self.pull.RED, self.pull.END, self.cl.replace(':', '').upper(),\
self.pull.GREEN, self.pull.END))
self.__AUTH_STEP = bool(1)
raise ValueError
示例3: _extract_bssid
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def _extract_bssid(packet):
"""
Return the bssid of access point based on the packet type
:param packet: A scapy.layers.RadioTap object
:type packet: scapy.layers.RadioTap
:return: bssid or None if it is WDS
:rtype: str or None
.. note: 0 0 -> IBBS
0 1 -> from AP
1 0 -> to AP
"""
ds_value = packet.FCfield & 3
to_ds = ds_value & 0x1 != 0
from_ds = ds_value & 0x2 != 0
# return the correct bssid based on the type
return ((not to_ds and not from_ds and packet.addr3)
or (not to_ds and from_ds and packet.addr2)
or (to_ds and not from_ds and packet.addr1) or None)
示例4: test_single_extension
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def test_single_extension(self):
# We need a NM to init EM
nm = interfaces.NetworkManager()
# Init an EM and pass some shared data
em = extensions.ExtensionManager(nm)
em.set_extensions(constants.DEFAULT_EXTENSIONS)
shared_data = {"one": 1, "two": 2, "is_freq_hop_allowed": True}
em.init_extensions(shared_data)
# A deauth packet appears in the air
packet = (
dot11.RadioTap() /
dot11.Dot11(
type=0,
subtype=12,
addr1="00:00:00:00:00:00",
addr2="00:00:00:00:00:00",
addr3="00:00:00:00:00:00") /
dot11.Dot11Deauth())
em._process_packet(packet)
# The extension1.py sent packet "1" and returned output
# "one", "two". Validate with get_packet(), send_output()
assert em._packets_to_send["1"] == [1]
assert em._packets_to_send["2"] == []
assert em.get_output() == ["one", "two"]
示例5: get_radiotap_header
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def get_radiotap_header(self):
radiotap_packet = RadioTap(len=18, present='Flags+Rate+Channel+dBm_AntSignal+Antenna', notdecoded='\x00\x6c' + get_frequency(self.channel) + '\xc0\x00\xc0\x01\x00\x00')
return radiotap_packet
示例6: __init__
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def __init__(self, interface, args):
self.interface = interface
self.args = args
## Create a header that works for encrypted wifi having FCS
### These bytes can be switched up, if memory serves, this is a channel 6 RadioTap()
rTap = '00 00 26 00 2f 40 00 a0 20 08 00 a0 20 08 00 00 20 c8 af c8 00 00 00 00 10 6c 85 09 c0 00 d3 00 00 00 d2 00 cd 01'
self.rTap = RadioTap(unhexlify(rTap.replace(' ', '')))
示例7: wpaEncrypt
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def wpaEncrypt(encKey, origPkt, decodedPkt, PN, genFCS = True):
"""Encompasses the steps needed to encrypt a WPA packet
No structure for TKIP has been done as of yet
"""
## Increment the PN positively per IEEE spec
PN[5] += 1
## Grab the payload of the decoded packet
dEverything = decodedPkt[LLC]
## Remove the FCS from the original packet
newPkt = RadioTap((pt.byteRip(origPkt.copy(),
chop = True,
order = 'last',
output = 'str',
qty = 4)))
del newPkt[Dot11WEP]
## The data is ready for encryption
newPkt = newPkt/dEverything
encodedPkt = ccmpCrypto.encryptCCMP(newPkt, encKey, PN, genFCS)
## Flip FCField bits accordingly
if encodedPkt[Dot11].FCfield == 1:
encodedPkt[Dot11].FCfield = 65
elif encodedPkt[Dot11].FCfield == 2:
encodedPkt[Dot11].FCfield = 66
return encodedPkt
### Instantiations
示例8: deBuilder
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def deBuilder(self, packet, stream, genFCS):
"""Take the pkt object and apply stream to [LLC]"""
## Remove the FCS from the old packet body
postPkt = RadioTap(self.pt.byteRip(packet.copy(),
chop = True,
order = 'last',
output = 'str',
qty = 4))
## Remove RadioTap() info if required
if genFCS is False:
postPkt = RadioTap()/postPkt[RadioTap].payload
## Rip off the Dot11WEP layer
del postPkt[Dot11WEP]
## Add the stream to LLC
decodedPkt = postPkt/LLC(str(stream))
## Flip FCField bits accordingly
if decodedPkt[Dot11].FCfield == 65:
decodedPkt[Dot11].FCfield = 1
elif decodedPkt[Dot11].FCfield == 66:
decodedPkt[Dot11].FCfield = 2
## Return the decoded packet with or without FCS
if genFCS is False:
return decodedPkt
else:
return decodedPkt/Padding(load = binascii.unhexlify(self.pt.endSwap(hex(crc32(str(decodedPkt[Dot11])) & 0xffffffff)).replace('0x', '')))
示例9: deBuilder
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def deBuilder(self, packet, stream, genFCS):
"""Return the decrypted packet"""
## Remove the FCS from the old packet body
postPkt = RadioTap(self.pt.byteRip(packet.copy(),
chop = True,
order = 'last',
output = 'str',
qty = 4))
## Remove RadioTap() info if required
if genFCS is False:
postPkt = RadioTap()/postPkt[RadioTap].payload
## Rip off the Dot11WEP layer
del postPkt[Dot11WEP]
## Add the stream to LLC
decodedPkt = postPkt/LLC(str(stream))
## Flip FCField bits accordingly
if decodedPkt[Dot11].FCfield == 65:
decodedPkt[Dot11].FCfield = 1
elif decodedPkt[Dot11].FCfield == 66:
decodedPkt[Dot11].FCfield = 2
## Return the decoded packet with or without FCS
if genFCS is False:
return decodedPkt
else:
return decodedPkt/Padding(load = binascii.unhexlify(self.pt.endSwap(hex(crc32(str(decodedPkt[Dot11])) & 0xffffffff)).replace('0x', '')))
示例10: pwrCall
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def pwrCall(pkt):
if pkt.haslayer(RadioTap):
extra = pkt.notdecoded
dbm_sig = -(256-ord(extra[-6:-5]))
if dbm_sig < -100 or dbm_sig > -10:
return '?'
return dbm_sig
示例11: dbM
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def dbM(self, pkt):
if pkt.haslayer(RadioTap):
extra = pkt.notdecoded
dbm_sig = -999
for p in extra:
if -(256-ord(p)) > -90 and -(256-ord(p)) < -20:
dbm_sig = -(256-ord(p))
break
return dbm_sig
示例12: forge_ap_cl
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def forge_ap_cl(self):
_pkt_ap = RadioTap() / Dot11(addr1=self.cl, addr2=self.ap, addr3=self.ap) / Dot11Deauth(reason=7)
_pkt_cl = RadioTap() / Dot11(addr1=self.ap, addr2=self.cl, addr3=self.cl) / Dot11Deauth(reason=7)
if self.unlimited:
while True:
self.flood_ap_cl(_pkt_ap, _pkt_cl)
else:
for _count in range(0, self.count):
self.flood_ap_cl(_pkt_ap, _pkt_cl)
示例13: forge_ap
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def forge_ap(self):
_broadct = "ff:ff:ff:ff:ff:ff"
_pkt_ap = RadioTap() / Dot11(addr1=_broadct, addr2=self.ap, addr3=self.ap) / Dot11Deauth(reason=7)
if self.unlimited:
while True:
self.flood_ap(_pkt_ap, _broadct)
else:
for _count in range(0, self.count):
self.flood_ap(_pkt_ap, _broadct)
示例14: shoot
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def shoot(self, _sn, _rc):
_pkt_ap_to_cl = RadioTap() / Dot11(addr1=_rc, addr2=_sn, addr3=_sn) / Dot11Deauth(reason=7)
_pkt_cl_to_ap = RadioTap() / Dot11(addr1=_sn, addr2=_rc, addr3=_rc) / Dot11Deauth(reason=7)
sendp(_pkt_ap_to_cl, iface=self.iface, count=self.deauth, verbose=False)
sendp(_pkt_cl_to_ap, iface=self.iface, count=self.deauth, verbose=False)
time.sleep(0.80)
示例15: asso_frame_blueprint
# 需要导入模块: from scapy.layers import dot11 [as 别名]
# 或者: from scapy.layers.dot11 import RadioTap [as 别名]
def asso_frame_blueprint(self, ap, cl):
capibility = self.beacon.sprintf("{Dot11Beacon:%Dot11Beacon.cap%}")
efields = self.enumerate_asso_fields(self.beacon)
_pkt = RadioTap() / Dot11(addr1=ap, addr2=cl, addr3=ap) / Dot11AssoReq(cap=capibility, listen_interval=3)
return self.form_asso_layers(efields, _pkt)