Using byte-based packets o_O?

Everything else that doesn't fall into one of the other PB categories.
Kaiser
Enthusiast
Enthusiast
Posts: 118
Joined: Tue Jan 11, 2005 8:36 am

Using byte-based packets o_O?

Post by Kaiser »

Yeah... the title might be something unrelated to this, but couldn't think on anything else...

Well, there's an online game I'm playing but due to some exploited bugs out there being used by script kiddies, I want to do something about it.

Now this goes like this, I'm not very good explaining myself sometimes but I hope you can bear with me :) : Two players join a game and then one of them throws an item to the ground (using a cheat program), the other player sees the item and his game crashes the hell outta Windows. Internally, I guess it's a malformed packet which is filtered by the cheat program so the one who uses it doesn't get the crash, but the other people do, logically.

My idea is to make a kind of proxy (I've done such before for two games - personal stuff, learning how it works and doing funny things xD) that can filter such malformed packet and thus, the cheat made unworkable. The game would connect to the local IP, and my program would send the stuff in/out the server/client, BUT filtering the malformed packet.

The idea's not bad and I've progressed a bit... the thing is, I've only worked with proxies sending and receiving stuff through PeekS after a ReceiveNetworkData (basically, strings), but this game deals with byte stuff - all I need to do is to do the same, but with bytes (or packets, whatever works).

Adapting what I used to do, this time using PeekB, came around to this...

Code: Select all

InitNetwork()
c2=OpenNetworkConnection("<server IP goes here>",<server port goes here>)
c=CreateNetworkServer(<any port here>)
Repeat
  a2=NetworkClientEvent(c2)
  If a2=2
    *buffer2=AllocateMemory(1024)
    ReceiveNetworkData(c2,*buffer2,1024)
    *sendbuf2=AllocateMemory(1024)
    For a=0 To 1024
      If PeekB(*buffer2+a)<>0
        Debug "Received=" + Str(PeekB(*buffer2+a))+" "+Chr(PeekB(*buffer2+a))
      EndIf 
      PokeB(*sendbuf2,PeekB(*buffer2+a))
    Next a 
    SendNetworkData(c,*sendbuf2,1024)
  EndIf 
  
  a=NetworkServerEvent()
  If a=2
    *buffer=AllocateMemory(1024)
    ReceiveNetworkData(NetworkClientID(),*buffer,1024)
    *sendbuf=AllocateMemory(1024)
    For a=0 To 1024
      If PeekB(*buffer+a)<>0
        Debug "Sent: " + Str(PeekB(*buffer+a))+" "+Chr(PeekB(*buffer+a))
      EndIf 
      PokeB(*sendbuf,PeekB(*buffer+a))
    Next a 
    SendNetworkData(c2,*sendbuf,1024)
  EndIf 
  Delay(1)
  
ForEver
My idea was to, once getting the data, read it byte by byte, but I can't seem to get the packet's size, its start, end, structure... etc. I don't need that though, as you can see, it's simply a "packet-forwarding" system what I'm trying to make - my program should not care what the data is, as long as I can receive the data correctly and send it correctly (the game server doesn't answers me like it should, so I guess I'm making the packet wrong, or something, as I know it works), but there should be a way to read the data inside it (so I can find the cheat packet and block it).

With the program there I can get the correct packet stuff, but as I said, I can't get the start and/or end of it so I can send it to the game server like the real game does...

By the way, I've searched the forums, google, and stuff, but all that advanced winsock packet-like stuff confuses me LOTS :? so I hoped my method (easier) worked... guess not - yet.

If anybody could give me a hand, it would be a great help :D!
Kaiser
Enthusiast
Enthusiast
Posts: 118
Joined: Tue Jan 11, 2005 8:36 am

Post by Kaiser »

...anyone? :(
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

I see that you're code isn't checking how much data is recieved? You need to do something like the line below to get this info:

Code: Select all

length.l = ReceiveNetworkData(c2,*buffer2,1024)
Kaiser
Enthusiast
Enthusiast
Posts: 118
Joined: Tue Jan 11, 2005 8:36 am

Post by Kaiser »

MAAAAAAAAAAN you're like, my savior XD!!!!!!!!

it worked perfectly, WOOT!!!! :D :D :D :D thanks a BUNCH!!!!! :D it was that, thanks!!!!!!! ^^!!!!!!
Amundo
Enthusiast
Enthusiast
Posts: 200
Joined: Thu Feb 16, 2006 1:41 am
Location: New Zealand

Post by Amundo »

Hi Kaiser,

I have PM'd you, hope you read this...

Regards,
Amundo
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Such exploits should really be reported to the game developer so they can patch the game client to prevent this.

If they keep ignoring such a issue or is "unable" to fix it, they don't deserve your money and you should cancel the subscription. (if it's a MMO)
If it's one of the free mmo's, the devs usually are quick to fix such issues as well.

If it's not a MMO, you should still contact the developer to see if they can release a fix/patch for the game.
Post Reply