Loading Dumpfile into Memory via Script?

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

Loading Dumpfile into Memory via Script?

Postby Tender » Mon Jan 19, 2009 7:55 pm

Hi,

i'd like to know if it's possible with the actual version of MHS to load memory exports into memory again via scripting.

I've changed several memory blocks (with hex editor), exported them and need them to be loaded again to a known address offset when a specific process starts. Doing this manually takes some time and i would like to fasten this process ...


thanks & regards,

Tender

8)
Tender
I Have A Few Questions
 
Posts: 8
Joined: Mon Jan 19, 2009 7:50 pm

Postby L. Spiro » Tue Jan 20, 2009 7:35 am

Code: Select all
// Load a file to RAM.
BOOL LoadFileToRam( const CHAR * pcPath, BYTE ** ppbBuffer, DWORD * pdwSize ) {
   // There must be a buffer into which to store the loaded file.
   if ( !ppbBuffer ) {
      PrintF( "ppbBuffer must not be NULL." );
      return FALSE;
   }
   // Attempt to open the file.
   FILE * pfThis = FOpen( pcPath, "rb" );
   if ( !pfThis ) { return FALSE; }
   
   // Get the file size.
   FSeek( pfThis, 0, SEEK_END );
   DWORD dwSize = FTell( pfThis );
   FSeek( pfThis, 0, SEEK_SET );
   
   // Allocate a buffer large enough.
   (*ppbBuffer) = ReAlloc( (*ppbBuffer), dwSize );
   if ( !(*ppbBuffer) ) {
      FClose( pfThis );
      return FALSE;
   }
   
   // Read the whole file into the buffer.
   if ( !FRead( (*ppbBuffer), dwSize, 1, pfThis ) ) {
      FClose( pfThis );
      Free( (*ppbBuffer) );
      return FALSE;
   }
   
   // The file is loaded.  Close the file pointer and
   //   apply the size.
   FClose( pfThis );
   if ( pdwSize ) {
      (*pdwSize) = dwSize;
   }
   
   return TRUE;
}


// Load a file and apply it RAM in the target address.
BOOL ApplyFileToAddress( const CHAR * pcPath, MHS_ADDRESS aAddress ) {
   if ( !GetCurProcessHandle() ) { return FALSE; }
   DWORD dwSize;
   BYTE * pbBuffer = NULL;
   // Load the requested file.
   if ( !LoadFileToRam( pcPath, &pbBuffer, &dwSize ) ) { return FALSE; }
   
   // Apply it to the RAM of the target process.
   BOOL bRet = WriteProcessMemory( GetCurProcessHandle(),
      (LPVOID)aAddress, pbBuffer, dwSize, NULL );
   Free( pbBuffer );
   return bRet;
}



If you want to prompt yourself for the address, use InputNumber().
If you want to prompt yourself for the file, use InputString().


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3122
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby Tender » Tue Jan 20, 2009 7:08 pm

:shock:

Wow, that was quick.

I've to say that i just found your software 3 days before and am very impressed what it can & does. We use it for injecting a statistics routines code extension into CoD4 & CoD5 ranked servers during runtime without directly, officially modding them - This would result in the servers not beeing ranked anymore although our extension just collects large amounts of statistic data. (At www.finalstats.net you can see the first public display of our SQL2005 clusters data). We'er planning to implement our stats engines into several script based gameengines and think that direct injection is the only way (unless the developer implements our code directly) to do this on ranked machines.

I read in the help, that you plan to make the scripts be directly executable as standalone - Are there any timeframes for that? This would even make it easier to let our public servers just start by mouseclick, the .exe script would then start the server, inject the code & keep it up to date ...


Anyway, thanks alot for your great work & keep on improving this great software!


regards,

Tender
Tender
I Have A Few Questions
 
Posts: 8
Joined: Mon Jan 19, 2009 7:50 pm

Postby L. Spiro » Wed Jan 21, 2009 5:44 am

I have indefinitely postponed my plans for making scripts into stand-alone executables.

Although I may decided to pick it up again, in order to facilitate many of the functions in scripts (all debugging functions including InjectDll(), search functions, disassembler/assembler functions, etc.) the .EXE file would end up containing most of the entire core of MHS anyway minus the main dialog.

For going that extreme it is better to simply make MHS run scripts via command line, not showing the main dialog unless enforced by the script itself.

Command line execution is something I have been planning and should be available soon.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3122
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby Tender » Wed Jan 21, 2009 4:20 pm

Ok, in that case we will encrypt & compress MHS + the commandline tool into a (maybe python) .exe pack that can be executed directly and needs no installing or special GUI to start the games & do the injections ...


Thanks again & regards,

Tender
Tender
I Have A Few Questions
 
Posts: 8
Joined: Mon Jan 19, 2009 7:50 pm

Postby lxcid » Thu Jan 22, 2009 12:29 am

Why not use batch file instead? Python would require the user to install Python. Kinda defeat your goal of no installing. Just my 2 cents. :)

Oops, I miss out the point you wanted to encrypt the lss source... :X Well, then python seems like an option.
lxcid
I Ask A Lot Of Questions
 
Posts: 13
Joined: Tue Jan 20, 2009 2:07 am

Postby Tender » Thu Jan 22, 2009 8:44 pm

... and you can use pyinstaller 1.2 to build a standalone .exe package based on python that decrypts & deflates all neccessary files (stored in the package itself) into memory, runs those .exes and disappear again ...
Tender
I Have A Few Questions
 
Posts: 8
Joined: Mon Jan 19, 2009 7:50 pm

Postby Tender » Wed Feb 04, 2009 11:16 pm

:arrow: Any news about the Command line execution?

Thanks & regards,

Tender
Tender
I Have A Few Questions
 
Posts: 8
Joined: Mon Jan 19, 2009 7:50 pm

Postby L. Spiro » Thu Feb 05, 2009 7:48 am

No.
Frankly I find it difficult to get motivated to work on MHS while my engine is coming along so smoothly.
But I still force myself to work on MHS sometimes.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3122
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron