Harakiri
April 3rd, 2006, 14:04
Hello,
i dont know if this belongs to here but i figured those in-the-known could probably help.
Problem
I need to manipulate a precompiled win32.exe on a *nix system - the tools i have is just byte wise manipulation (no recompile, no c or anything). I want to dynamically change one data field (variable) of the win32 executeable - however the pitfall i currently face is that the data length i change is dynamically too.
Failed Theoretical Example
I created a simple hello world C program with a global var data as char. I preset the value of the variable as "hello world" - after compiling i open up a hex editor found the offset and could dynamically change the string - however i could only replace the string with a value that has the same length (and bit wise) size.
Therefor i made the variable static and said lets allocate 1000000000 bytes - well now my exe is always that big (tons of zeroes) so this aint an option too.
Question
Anyone has a good idea how i can dynamically change my data variable using byte manipulation ?
Background
The win32 exe will implement some sort of symmetric encryption - i will use one precompiled template for the exe file without any encrypted data - after that i will move it to a *nix server and dynamically manipulate the data of the encrypted content using Java. After the change a win32 user should be able to just execute this file and enter a password and will receive my dynamically generated data (decrypted).
i dont know if this belongs to here but i figured those in-the-known could probably help.
Problem
I need to manipulate a precompiled win32.exe on a *nix system - the tools i have is just byte wise manipulation (no recompile, no c or anything). I want to dynamically change one data field (variable) of the win32 executeable - however the pitfall i currently face is that the data length i change is dynamically too.
Failed Theoretical Example
I created a simple hello world C program with a global var data as char. I preset the value of the variable as "hello world" - after compiling i open up a hex editor found the offset and could dynamically change the string - however i could only replace the string with a value that has the same length (and bit wise) size.
Therefor i made the variable static and said lets allocate 1000000000 bytes - well now my exe is always that big (tons of zeroes) so this aint an option too.
Question
Anyone has a good idea how i can dynamically change my data variable using byte manipulation ?
Background
The win32 exe will implement some sort of symmetric encryption - i will use one precompiled template for the exe file without any encrypted data - after that i will move it to a *nix server and dynamically manipulate the data of the encrypted content using Java. After the change a win32 user should be able to just execute this file and enter a password and will receive my dynamically generated data (decrypted).