简体   繁体   English

Scapy无法对IPv6数据包进行分段

[英]Scapy unable to fragment IPv6 packet

I am currently working on a project regarding IPv6 security. 我目前正在从事有关IPv6安全性的项目。 I'm trying to replicate the results found in this document found here: https://www.tno.nl/downloads/testing_the_security_of_IPv6_implementations.pdf 我正在尝试复制在以下文档中找到的结果: https : //www.tno.nl/downloads/testing_the_security_of_IPv6_implementations.pdf

Scroll down to section 4.4, page 29. 向下滚动至第29页的4.4节。

I want to test whether creating packets with unlimited extension headers will in fact be able to crash a system. 我想测试是否创建具有无限扩展头的数据包是否实际上会使系统崩溃。 The problem I run in to again and again is that when running the script based on the documentation I keep getting the error: 我一次又一次遇到的问题是,基于文档运行脚本时,我不断收到错误消息:

File "/usr/lib/python2.7/dist-packages/scapy/packet.py", line 787, in fragment
   return Scapy_Exception("cannot fragment this packet")
scapy.error.Scapy_Exception: cannot fragment this packet

And I need the packets to be fragmented. 我需要将数据包分段。 Otherwise I will not be able to create this endless stream of extension headers. 否则,我将无法创建无休止的扩展头流。 I am testing this on a Debian 7 Wheezy system and using Python 2.7. 我正在Debian 7 Wheezy系统上并使用Python 2.7对此进行测试。

Here is the script I'm running: 这是我正在运行的脚本:

from scapy.all import *

packet = IPv6(src="scrIP",dst="dstIP")
for x in range (0,100):
    packet = packet/IPv6ExtHdrDestOpt()/IPv6ExtHdrRouting()/IPv6ExtHdrHopByHop()

    send(packet)

I have been searching around but I cannot find anything with the same error. 我一直在搜索,但是找不到相同错误的任何内容。 I hope someone can help. 我希望有人能帮帮忙。

You should check the version of scapy. 您应该检查Scapy的版本。 The code work on my system (Ubuntu 14.04, scapy 2.2.0). 该代码可在我的系统上运行(Ubuntu 14.04,Scapy 2.2.0)。 Also try to run the code in the scapy shell as root: 还尝试以root用户身份在scapy shell中运行代码:

$ sudo scapy 
Welcome to Scapy (2.2.0)
>>> p = IPv6(src='::1', dst='::1')
>>> for x in range(100): p = p/IPv6ExtHdrDestOpt()/IPv6ExtHdrRouting()/IPv6ExtHdrHopByHop()
... 
>>> send(p)
.
Sent 1 packets.

And of cause you have to replace scrIP and dstIP with real IPv6 adresses as strings. 因此,您必须用实际的IPv6地址作为字符串替换scrIPdstIP

There is something called scapy6: 有一种叫做scapy6的东西:

http://www.secdev.org/conf/scapy-IPv6_HITB06.pdf http://www.secdev.org/conf/scapy-IPv6_HITB06.pdf

Try taking a look at page 128 and forward to see if you can get it to work, it should support IPv6. 尝试看一下第128页,然后向前看是否可以使它正常工作,它应该支持IPv6。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM