Sign in to follow this  
Followers 0
Battery

Patching a File

12 posts in this topic

Alright, I want to patch a file (.exe) and add to it whatever I want, for example:

Add to a file a messagebox, like, everytime you open the file, you have to click OK on the message box and then it opens.

Sorry if it's hard to understand, but I really need your help here, thanks guys.

Share this post


Link to post
Share on other sites



You can't just add code to an arbitrary executable file. You need the the source code of the compiled executable in order to modify it in the way you are suggesting.

Share this post


Link to post
Share on other sites

So how come some programs can patch a file and add their splash screen into it?

Share this post


Link to post
Share on other sites

Because they have the source code! You can do anything if you have the source code.

Share this post


Link to post
Share on other sites

I know, I'm not an idiot, I mean like:

WinLicense, this program's demo will patch any file, when you open the file, it will make a short splash screen of WinLicense and then the program opens.

Share this post


Link to post
Share on other sites

You will need to know some assembler/reversing to inject code into executables. Here's a beginners tute; http://home.inf.fh-rhein-sieg.de/~ikarim2s/how2injectcode/code_inject.html

This forum might not be the right place for such things..

Joakim

Share this post


Link to post
Share on other sites

Yeah well, that's what I want, but I wonder if can I do it with autoit?

Share this post


Link to post
Share on other sites

Yeas it's psooible, but there is other software more suitable to do so.

If you require help doing it in autoit it might be hard for the following reasons:

1. Most people on the forum don't know the first thing about this kind of code injection. (I know I don't)

2. The potential for malicious use is probably rather high.

Share this post


Link to post
Share on other sites

Well, can you explain more about the "other software more suitable to do so"?

Share this post


Link to post
Share on other sites

I only tried this type of thing once a long time ago, but the software shown in the link seems to do exactly what you want and I believe it can also be done using Cheatengine.

Share this post


Link to post
Share on other sites

I don't think there exist a simple solution to code injection. The tools you need are;

1. Hex editor (WinHex)

2. Disassembler (IDA)

3. Debugger (Ollydbg, IDA)

4. PE editor (PEiD)

5. Knowledge of assembler/reversing and the win api.

Some of the above are not freeware though.

Actually the patcher itself can be written in autoit, but figuring out the patch must be done through either or all of the above-mentioned tools.

Joakim

Share this post


Link to post
Share on other sites

I'm not an expert with AutoIT, but I would think this would depend mainly upon the executable you're wanting to "add" to. If it is a commonly installed windows app (Notepad for example), that you expect to already be on the system, you could simply write the script to do what you want, and then call the executable. Something like:

$message = "Loading... "

SplashTextOn("Starting Application", $message, 500, 50)

For $x = 1 to 10

$message = $message & $x & " "

ControlSetText("Starting Application", "", "Static1", $message)

sleep(300)

Next

$var = Msgbox(262144+4, "Accept", "This application is only for company employees. Click Yes if you wish to continue or no to exit.")

If $var = 6 Then

Run( "Notepad" )

Else

Exit

EndIf

If, however, it is an executable you are delivering with the splash screen/msgbox, etc., you might try an open source wrapper utility such as QuickBFC. With that, you can launch your first executable, and then whenever the conditions are met, use it to call the second. QuickBFC (I know there are others, but it is what I use) will wrap both executables into a single .exe for you. Hope this helps.


√-1 2^3 ∑ π, and it was delicious!

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  
Followers 0