具体参见下面的idle
from scapy.all import *
WARNING: No route found for IPv6 destination :: (no default route?)
packet = IP(options='0x11')
packet.display()[ IP ]
version = 4
ihl = None
tos = 0x0
len = None
id = 1
flags =
frag = 0
ttl = 64
proto = ip
chksum = None
src = 127.0.0.1
dst = 127.0.0.1
\options \
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/scapy/packet.py", line 794, in display
self.show(args,*kargs)
File "/usr/lib/python2.7/site-packages/scapy/packet.py", line 816, in show
fvalue.show(indent=indent, labellvl=label_lvl+lvl+" |")
AttributeError: 'str' object has no attribute 'show'
send(packet)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/scapy/sendrecv.py", line 251, in send
__gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
File "/usr/lib/python2.7/site-packages/scapy/sendrecv.py", line 234, in __gen_send
s.send(p)
File "/usr/lib/python2.7/site-packages/scapy/arch/linux.py", line 387, in send
sx = str(ll(x))
File "/usr/lib/python2.7/site-packages/scapy/arch/linux.py", line 385, in <lambda>
ll = lambda x:conf.l2typessn[3]/x
File "/usr/lib/python2.7/site-packages/scapy/packet.py", line 267, in __div_
cloneB = other.copy()
File "/usr/lib/python2.7/site-packages/scapy/packet.py", line 147, in copy
clone.fields[k]=self.get_field(k).do_copy(clone.fields[k])
File "/usr/lib/python2.7/site-packages/scapy/fields.py", line 413, in do_copy
return map(lambda p:p.copy(), x)
File "/usr/lib/python2.7/site-packages/scapy/fields.py", line 413, in <lambda>
return map(lambda p:p.copy(), x)
AttributeError: 'str' object has no attribute 'copy'
1
weiyu OP 看来没有多少做网络的同学,此帖要沉~
还有,格式完全不对啊,新手表示略无力= = |
2
weiyu OP 问题解决了,感谢强大的google= =
options字段需要调用IPOption()方法进行封装,如下即可: packet.options = IPOption('\x83\x03\x10') |
3
paladin437 2017-03-21 14:50:54 +08:00
我想构造的是 loose_source_route 。这个地址怎么插入啊,这个貌似都搜索不到。
|