Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
557 views
in Technique[技术] by (71.8m points)

python - 我尝试通过scapy发送UDP程序包,但失败了,为什么?(I try to send UDP package by scapy but failed,Why?)

I setup my UDP server by python code below.

(我通过下面的python代码设置了UDP服务器。)

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('192.168.8.104', 9999))

print('Bind UDP on 9999...')

while True:
    data, addr = s.recvfrom(1024)
    print('Received from %s ---> %s' % (addr, data.decode("utf-8")))

and then,I try to send UPD package by scapy.

(然后,我尝试通过Scapy发送UPD软件包。)

send(IP(src="192.168.8.110",dst="192.168.8.104")/UDP(dport=9999,sport=5678)/"Hello scapy udp")

result is Sent 1 packets.

(结果是已Sent 1 packets.)

in terminal.But I can't see anything in my udp server logout.

(在终端中。但是我在udp服务器注销中什么都看不到。)

and then,I try to use another way to send UPD package like this:

(然后,我尝试使用另一种方式发送UPD软件包,如下所示:)

sr1(IP(src="192.168.8.110",dst="192.168.8.104")/UDP(dport=9999,sport=5678)/"Hello scapy udp")

IT WORKED(I mean that i can see logout in my UDP server)!!!WHY?????Can somebody answer for me.

(它工作(我的意思是我可以在UDP服务器中看到注销)!为什么????有人可以回答我。)

  ask by user7078144 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...