[Request]C++ Bot Source Code/Example Code

07/19/2008 03:50 Iktov#1
Please someone direct me to anywhere that might have any sort of information and resources on the construction of a bot, preferably in C++. Looking for any Reverse engineering information(finding the Base addr for say player) and locating the offsets ptrs for Cur health etc. I would also love to see a simple example source in C++ of putting those addresses and offsets into action. I'm sure I have the basic idea down on how to do this but I'm not 100% sure how to get it setup correctly.

If someone that has a good understanding off C++ could just post a simple example of something along the lines of: Reading from a the addr + offset of say the current health or something else useful, into a pointer and using that pointer to simply log the current health into a log txt file that example would help me out a lot to get started.

My basic idea of what to do here is this:
Setup an empty variable that will hold the currenthealth value later. Using ReadProcessMemory and reading from the PlayerPtrAddr + CurHealthOffset(450?) and store that into currenthealth variable. Then just setup a log that will log what the value of the currenthealth variable is. I have a basic idea of what this would like but I have limited knowledge of C++ and coding and it has been a while Since I have done anything like this. I used to use this type of setup in a lot of FPS games I played but I have since lost all sources and documents that I had regarding this and can't seem to fully remember how to set it all up correctly.

Just need a detailed example of how to setup the empty currenthealth variable and then reading the value from the baseaddr + offset into that variable and then executing the log of that into a .txt log file.

Thanks for any information you can give me.
07/19/2008 04:22 Iktov#2
/add

Ok well here is what I put together so far, Hopefully someone with some C++ knowledge can help to perfect it/and or confirm weather it would work correctly or not:

CODE:

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windows.h>
#include <iostream>
#include <time.h>

HANDLE iSRO = GetCurrentProcess();

#define FILELOCATION "C:\\SRO_log.txt"

void __cdecl add_log(const char * fmt, ...)
{
#ifndef _NO_ADD
va_list va_alist;
char logbuf[256];
FILE * fp;
struct tm * current_tm;
time_t current_time;

time (&current_time);
current_tm = localtime (&current_time);

sprintf (logbuf, "[%02d:%02d:%02d] ", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec);

va_start (va_alist, fmt);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
va_end (va_alist);

if ( (fp = fopen ( FILELOCATION , "a")) != NULL )
{
fprintf ( fp, "%s\n", logbuf );
fclose (fp);
}
#endif _NO_ADD
}
BOOL WINAPI DllMain (HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
{
if (dwAttached == DLL_PROCESS_ATTACH)
{
add_log("DLL Attatched to SRO Client");
DWORD dwBytesread;
DWORD dwCurHealth;
DWORD dwPlayerBase;

ReadProcessMemory(iSRO, (void*)(0xCEBB4C), &dwPlayerBase, sizeof(dwPlayerBase), &dwBytesread);
ReadProcessMemory(iSRO, (void*)(dwPlayerBase+0x450), &dwCurHealth, sizeof(dwCurHealth), &dwBytesread);
add_log("CurrentHealth = 0x%.8x", (DWORD)dwCurHealth);
}

return 1;
}


Assuming everything is done correctly the variable dwCurHealth should hold the value of the current health of my character? At least that is what I am going for anyways. At this point however I am unsure how to test it as I don't know how to set it up the log the Value of my Variable dwCurHealth. Can anybody help me here and also confirm my addresses by chance. Thanks
07/19/2008 15:07 royalblade#3
btw have u ever thought of using search?

look for and bot sourcecode... or if invincible is still here ask him he was part of team offset ( or still is ) and they had a post with and bot source code, whcih was also posted here.....