Valhalla Legends Forums Archive | General Programming | hooking into an existing TCP stream

AuthorMessageTime
Juniper
Hi,

I'd like to set a couple of facts before I actually ask my question.

Layout - I have a linux gateway that's connected to the internet, all the traffic goes through it.

Goal - A computer on my network will start D2-LoD and enter a game. I'd like to be able to build a valid packet on the linux gateway and send it to b.net.

Now, what do I mean when I say "valid packet"? As you're all probably well aware of, all the traffic to and from b.net is TCP (at least D2GS packets, which interest me), which means I can't just make up a D2GS packet and send it to b.net because there are things to consider. Things like sequence numbers, ack numbers and so on.

My question is - How can I "hook" onto the existing tcp stream that's comming from the computer running D2 and send packets from my gateway which will seem legit to b.net servers? is it even possible to do from that gateway, or do I have to do it from the computer actually running D2?

I'd like to code this in perl, but any help on this matter will be appreciated.

thanks,
J
June 22, 2006, 7:17 AM
St0rm.iD
iirc there are sequence numbers that will mess you up. You're going to want to hack the D2 application to do it via attaching to the process or something.
June 22, 2006, 8:30 PM
Juniper
[quote]You're going to want to hack the D2 application [/quote]
That's like telling me that all I need to do in order to be rich is to win the lottery :)

How do I go about hacking D2 that way? where do I even start?

J
June 22, 2006, 9:57 PM
Myndfyr
Well, to start, you'd probably want to get the process handle, and patch memory where there are calls to send()/recv().  These memory locations can be found in a disassembler.
June 22, 2006, 11:08 PM
Kp
You could run D2 through a proxy on the Linux system that plays with the message stream.  That'd be cleaner than injecting into D2.  If you're sitting inline, sequence numbers are handled automatically.  You'll end up with some very messy code if you try to do this in perl.
June 23, 2006, 4:08 AM

Search