通过 Scapy 将 UDP 从 .pcap 发送到非本地服务器
我正在尝试通过 Scapy 将我用 Wireshark 捕获的 UDP 数据包发送到我的私人游戏服务器,以便我可以触发 modded 事件发生。最终,我想对此进行扩展,并创建一些使这些事件具有交互性的东西,或者可能做一些事情,例如在比赛期间的某个时刻显示本周的最佳球员,但目前我还没有完全做到这一点。
这是一款非常非常古老的游戏,仅通过 UDP 进行通信,并且很少考虑修改/反作弊实现,因此我非常有信心,如果我收到我想要的数据包到服务器,我的游戏服务器应该按预期做出反应(或者至少我希望如此)。
问题:
当涉及到这类事情时,我几乎是绿色的。
在过去的 2-3 周里,我花了 2-3 周的时间阅读 Stackoverflow 和 Scapy 文档,并且抓狂了。
我尝试过:
读取和编辑我的 .pcap 文件以获取源/目标信息,打开套接字并以各种不同的方式发送。不幸的是,我没有遇到任何人提出与我的问题足够相似的问题...
我不确定它是否应该像我正在尝试的那样完成,但是这是到目前为止我的代码:
>>> from scapy.all import *
>>> from scapy.utils import rdpcap
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> pkts=rdpcap("/home/Kali/Desktop/Packet.pcap")
>>> for pkt in pkts:
...: pkt[Ether].src= "xx:xx:xx:xx:xx:xx:"
...: pkt[Ether].dst= "xx:xx:xx:xx:xx:xx"
...: pkt[IP].src= "192.168.1.1"
...: pkt[IP].dst= "xxx.x.xxx.xx" >>I read somewhere that I didn't need ports to be updated from the pcap? But that was a local example so not sure.
...: del pkt.chksum
...: s.send(bytes(pkt))
任何帮助将不胜感激。感谢您花时间阅读本文!
I am trying to send a UDP packet that I captured with Wireshark to my private game server through Scapy so that I can trigger a modded event to occur. Eventually I would like to expand on this and create something that makes these events interactive or maybe do something like display the top player of the week at some point during the games, but at this point I am not quite there.
It's a very, very old game that communicates via UDP only and has taken very little modding/anti-cheat implementation into consideration so I feel pretty confident that if I get the packet I want to the server, my game server should react as intended (or atleast I am hoping).
The problem:
I am about as green as it gets when it comes to this sort of thing.
I have spent the past 2-3 weeks reading through Stackoverflow and the Scapy documentations and pulling my hair out.
I have tried:
Reading and editing my .pcap file for the source/destination information, opening up a socket and sending in various different ways. I have unfortunately just not come across anyone with a question that I found similar enough to mine to go off of...
I am not sure it should even be done like I am trying, but here is my code so far:
>>> from scapy.all import *
>>> from scapy.utils import rdpcap
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> pkts=rdpcap("/home/Kali/Desktop/Packet.pcap")
>>> for pkt in pkts:
...: pkt[Ether].src= "xx:xx:xx:xx:xx:xx:"
...: pkt[Ether].dst= "xx:xx:xx:xx:xx:xx"
...: pkt[IP].src= "192.168.1.1"
...: pkt[IP].dst= "xxx.x.xxx.xx" >>I read somewhere that I didn't need ports to be updated from the pcap? But that was a local example so not sure.
...: del pkt.chksum
...: s.send(bytes(pkt))
Any help would be greatly appreciated. Thanks for taking the time to read this!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论