1 year ago

#309629

test-img

FilthyNoob

Send UDP from .pcap to a non local server via Scapy

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!

sockets

udp

scapy

packet

0 Answers

Your Answer

Accepted video resources