Jump to content
Sign in to follow this  

TCPSend and TCPRecv to edit Variable Data, How?

Recommended Posts


I have written a Game Trainer that is distributed between friends.

I have written inside the trainer the ability to send myself data stored at a certain address inside the process of the game the trainer uses.

This data is then sent to my recv console which dumps it into a text file.

However, i want to use this data, and read it, then decide on what to do next based on the result.

For example, if the recv console brings back valid data, do nothing but store it, if it brings back 0x00000000 (i.e the game has updated and the data has changed to another addresses) then i want the recv console to be able to send back "updates" to my variables, such as, Addresses in the game process to change to read from.

For Example. the address to read from is a variable i.e

Global $HackedAddress = "0x12345678"

My question is, how can i use TCPSend to update this variable with a new address that i set in an ini file or txt file, or whatever i decide to use to store it in.

Heres an example of my send function.

#include <NomadMemory.au3>
Global $szIPADDRESS = "";my router address, can be changed to Global i.p when sharing
Global $nPORT = 33891
Global $ConnectedSocket = -1
Global $proc = ProcessExists("Game.exe")
Global $HackedAddress = "0x12345678"
Global $ID = _MemoryOpen($proc)
Global $szData
While 1
    $proc = ProcessExists("Game.exe")
    $ID = _MemoryOpen($proc)
        $szData = _MemoryRead($HackedAddress, $ID, "char[64]")
    Until $szData <> ""
    $ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT)
    If $ConnectedSocket = -1 Then Sleep(200)
    TCPSend($ConnectedSocket, $szData)
    If @error Then Sleep(200);ExitLoop

Func _Next()
    While 1
EndFunc  ;==>_Next

As you can see $HackedAddress is the address the Trainer Reads from, and then sends the data at that address to my recv console.

Heres a basic example of how my recv console works..

#include <GUIConstants.au3>
Dim $szIPADDRESS = "" 
Dim $nPORT = 33891
Dim $GOOEY = GUICreate("My Server (IP: " & $szIPADDRESS & ")",300,200)
Global $edit = GUICtrlCreateEdit("",10,10,280,180)
While 1
$MainSocket = TCPListen($szIPADDRESS, $nPORT,100)
Dim $ConnectedSocket = -1

    $ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1
Call ("Check")

Func Check()
Dim $recv
    $recv = TCPRecv( $ConnectedSocket, 2048 )
    GUICtrlSetData($edit, _
           FileOpen ( "Test.txt", 16 )

So what i want to do from here, is check the info sent to my recv console from $HackedAddress, if the data is 0x00000000 (meaning the game has updated and the address has changed, send back a new address to replace the one in my trainer.

I already know, it would be easy to create an ini and store any new addresses i want there, then have my recv console read from it, but i want to then send the new address back to my trainer and update $HackedAddress, save any changes and close the socket.

Another problem i sometimes find is, the data sent back is abit buggy, id say, 1 outta 10 times im actually able to grab the data, any advice on tidying up this to work better would be greatful also.

Share this post

Link to post
Share on other sites

Sorry to bump, but does anyone have an answer?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this