Python 2.7 + Scapy 2.3.1 -
i'm trying using scapy
don't know why functions don't work:
from scapy.layers.inet import * = ether() / ip(dst='192.168.1.1') / icmp() a.show()
results in:
traceback (most recent call last): file "/home/user/pycharmprojects/untitled/main.py", line 7, in <module> a.show() file "/usr/lib/python2.7/dist-packages/scapy/packet.py", line 819, in show ###[ ethernet ]### reprval = f.i2repr(self,fvalue) file "/usr/lib/python2.7/dist-packages/scapy/fields.py", line 191, in i2repr x = self.i2h(pkt, x) file "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 88, in i2h x = conf.neighbor.resolve(pkt,pkt.payload) file "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 38, in resolve return self.resolvers[k](l2inst,l3inst) file "/usr/lib/python2.7/dist-packages/scapy/layers/inet.py", line 727, in <lambda> conf.neighbor.register_l3(ether, ip, lambda l2,l3: getmacbyip(l3.dst)) file "/usr/lib/python2.7/dist-packages/scapy/layers/l2.py", line 56, in getmacbyip iff,a,gw = conf.route.route(ip) attributeerror: 'nonetype' object has no attribute 'route'
without .show()
works , :
pck = ether() pck.show()
works too.
i tried other functions .show
, error. why?
you need import everything, try changing import statement shown below:
$ sudo python python 2.7.6 (default, jun 22 2015, 17:58:13) [gcc 4.8.2] on linux2 type "help", "copyright", "credits" or "license" more information. >>> scapy.all import * warning: no route found ipv6 destination :: (no default route?) >>> = ether() / ip(dst='192.168.1.1') / icmp() >>> a.show() ###[ ethernet ]### dst = 74:11:d5:04:1b:82 src = 80:f6:df:59:3d:35 type = 0x800 ###[ ip ]### version = 4 ihl = none tos = 0x0 len = none id = 1 flags = frag = 0 ttl = 64 proto = icmp chksum = none src = 192.168.0.5 dst = 192.168.1.1 \options \ ###[ icmp ]### type = echo-request code = 0 chksum = none id = 0x0 seq = 0x0 >>>
Comments
Post a Comment