tcp – How to capture UDP packets/ and send it back to destination

[ad_1]

Basically I’m trying to intercept traffic that happens between client and server for a game.

Client being my local computer/ server being some game server that I connect to.

I have the server IP/Port I was able to retrieve this information via Wireshark.

To be more specific, I am trying to connect to a socket of a game server that is hosted somewhere online.

After using wireshark, I was able to indentify that it uses both HTTP/TCP/ and UDP.

The flow is something like this on the server end, this was posted in the actual docs of the game and they explained this is the network mechanism of when a game player connects to the server.

Client retrieves general server metadata via a GET /info.json on the connect endpoint.
Client attempts an initConnect request to the connect endpoint's POST /client.
If server accepts client, it'll send a connection token to client.
Client requests getEndpoints on the connect endpoint, receiving one or more IP/port combos. If multiple are specified, it will pick one to use as the server endpoint.
Client requests getConfiguration on the server endpoint. This will then result in one or more requests to GET /files/* on either the server endpoint or a file server override.
Client sends a UDP info request to the server endpoint.
Client sends an ENet connect request, as well as a UDP handshake to the server endpoint. If accepted, the client now has an ENet peer.
Client starts loading the game.
Client potentially opens additional sideband TCP/UDP channels to the server endpoint, potentially using other protocols via the multiplex.

The first few requests has general meta data such as /info.json, and /client
^ I can replicate those requests via python-requests and am able to get this ” connection token”

I don’t have much context on how UDP/ TCP connection are handled.

What I essentially want to do is send some packet data to the UDP connection, I was able to get from wireshark.

I am not too familiar with wireshark, but the screenshot posted is essentially the request I am trying to replicate via client side.

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ip = '135.148.38.56'
port = 30120
sock.connect((ip, port))
test = sock.send(b"This is where I want to send the "token"")
output = sock.recv(1024)
print(output)

Here is the screenshot of the request I am trying to replicate:
enter image description here

My goal is to be able to intercept/ and manipulate the packets something like MiTM.

I suspect I can’t just intercept traffic, in the flow for the game docs, it says it does a UDP handshake to validate the request. Does it mean some sort of authentication?

[ad_2]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *