python - Scapy - Creating a packet and showing it leads to >NoneType object has no attribute 'route'< -


i have discovered curious. doing following

>>> scapy.layers.inet import ether,ip,udp >>> e=ether() >>> i=ip() >>> u=udp() >>> p=e/i/u >>> p.show() 

results in error

###[ ethernet ]### traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "/home/lk/virtualenvs/fuzzingenv/local/lib/python2.7/site-packages/scapy/packet.py", line 838, in show     reprval = f.i2repr(self,fvalue)   file "/home/lk/virtualenvs/fuzzingenv/local/lib/python2.7/site-packages/scapy/fields.py", line 191, in i2repr     x = self.i2h(pkt, x)   file "/home/lk/virtualenvs/fuzzingenv/local/lib/python2.7/site-packages/scapy/layers/l2.py", line 89, in i2h     x = conf.neighbor.resolve(pkt,pkt.payload)   file "/home/lk/virtualenvs/fuzzingenv/local/lib/python2.7/site-packages/scapy/layers/l2.py", line 38, in resolve     return self.resolvers[k](l2inst,l3inst)   file "/home/lk/virtualenvs/fuzzingenv/local/lib/python2.7/site-packages/scapy/layers/inet.py", line 732, in <lambda>     conf.neighbor.register_l3(ether, ip, lambda l2,l3: getmacbyip(l3.dst))   file "/home/lk/virtualenvs/fuzzingenv/local/lib/python2.7/site-packages/scapy/layers/l2.py", line 57, in getmacbyip     iff,a,gw = conf.route.route(ip) attributeerror: 'nonetype' object has no attribute 'route' >>> ... 

but importing scapy right afer error this

>>> ... >>> scapy.all import * warning: no route found ipv6 destination :: (no default route?) >>> p.show() ###[ ethernet ]###   dst       = ff:ff:ff:ff:ff:ff   src       = 00:00:00:00:00:00   type      = 0x800 ###[ ip ]###      version   = 4      ihl       = none      tos       = 0x0      len       = none      id        = 1      flags     =       frag      = 0      ttl       = 64      proto     = udp      chksum    = none      src       = 127.0.0.1      dst       = 127.0.0.1      \options   \ ###[ udp ]###         sport     = domain         dport     = domain         len       = none         chksum    = none >>>  

somehow seems fix it. how can be? there special module need import?

you need import scapy route module well.

from scapy import route scapy.layers.inet import ether,ip,udp e=ether() i=ip() u=udp() p=e/i/u p.show() 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -