Jump to content

TCPSend and TCPRecv to edit Variable Data, How?


SXGuy
 Share

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>
TCPStartup()
Global $szIPADDRESS = "192.168.1.100";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
    ProcessWait("Game.exe")
    $proc = ProcessExists("Game.exe")
    $ID = _MemoryOpen($proc)
    Do
        $szData = _MemoryRead($HackedAddress, $ID, "char[64]")
    Until $szData <> ""
    _MemoryClose($ID)
    $ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT)
    
    If $ConnectedSocket = -1 Then Sleep(200)
    TCPSend($ConnectedSocket, $szData)
    Call("_Next")
    ExitLoop
    If @error Then Sleep(200);ExitLoop
WEnd

Func _Next()
    While 1
        Sleep(200)
    WEnd
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 = "192.168.1.100" 
Dim $nPORT = 33891
Dim $GOOEY = GUICreate("My Server (IP: " & $szIPADDRESS & ")",300,200)
Global $edit = GUICtrlCreateEdit("",10,10,280,180)
GUISetState()
TCPStartUp()
While 1
$MainSocket = TCPListen($szIPADDRESS, $nPORT,100)
Dim $ConnectedSocket = -1

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

Func Check()
Dim $recv
    $recv = TCPRecv( $ConnectedSocket, 2048 )
    GUICtrlSetData($edit, _
           $recv)
           TCPShutdown()
           FileOpen ( "Test.txt", 16 )
           Sleep(1000)
           FileWrite("Test.txt",guiCtrlRead($edit))
           Exit
EndFunc

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...