project: making your own executable

normally when making an executable, you have to use a compiler such as gnu (gnu's not unix) or microsoft's visual c++. we don't have to worry about compilers because for one, we're not really making a custom program, and two, windows has a built-in wizard to do it for us. what we're going to make is an installation program. you know when you download a new program how it goes through all that crap to install? yeah, that's what we're going to do only we're going to tell it what exactly to install.

with all these annoying scripts we can make, it sure would be nice to have an easy way to transfer them onto other computers, wouldn't it? via the approach we're going to take, you could simply give someone the installation file, tell them it's something else, have it output a fake error, and then say "oops, i sent you the wrong file." they wouldn't have the slightest idea that you now 0wnz0r their pc. it's that easy, and that's exactly what we'll do; create an install package that generates a fake error message.

first of all we need our files. you'll have to bear with me here as i'm going to use some visual basic code that i have yet to discuss (even though we don't need to) but you should be educated enough by now to at least follow along. you can come back to it after chapter 7 if you'd like to get a better grasp on things. the following script (name it error.vbs) generates a fake error popup window, and also gives an example of using visual basic's version of a "switch" statement; vb uses the name "select" in place of "switch." just type it in notepad along with other code discussed below and save these files in your "temp" folder as we have been doing, and ignore the line numbering.

[View full width]

1) dim wshshell, code 2) set wshshell = wscript.createobject("") 3) code = wshshell.popup("This file has been corrupted, would you like to proceed?", 0, "Error:", 2 + 48) 4) select case code 5) case 3 code = wshshell.popup("Installation has been aborted.", 0, "Error:", 0 + 64) 6) case 4 code = wshshell.popup("Installation failed.", 0, "Error:", 0 + 16) 7) end select

we can't launch a visual basic script from our install file, but we can launch a batch file; therefore we'll just create a batch file (named install.bat) which will execute our vb file for us, as follows.

 cscript //nologo c:\temp\error.vbs exit 

the "nologo" flag simply says not to display redundant information. you have the option of creating a fake license if you want to: just type out (or copy & paste) a bunch of legal information into a text file, but that's up to you. the last file that we need is an .inf file (or our "install" file), which is what the installation program needs to execute properly. the following code will create this file (name it setup.inf), and it will also act as a "template" for you to use for future packages.

 [Version] Signature="$Chicago$" AdvancedINF=2.0 [DefaultInstall] CopyFiles=install.files RunPostSetupCommands=RunPostSetupCommandsSection [DestinationDirs] ;Folder name install.files=30,Temp [install.files] ;Program1.Exe   ; example program #1 ;Program2.Exe   ; example program #2 ;Files to include in package install.bat error.vbs setup.inf [RunPostSetupCommandsSection] ;Program1.Exe ;Program2.Exe /argument1 /argument2 ;File to launch at install install.bat [SourceDisksNames] 1="default",,1 

commented lines in the above file begin with a semicolon, if you'd like to read through my notes. once you've got all the files saved and ready to go, the last part is pretty easy. all we have to do now is go through windows' built-in wizard, step by step. press win+r to run "iexpress" and this should launch the wizard.


select "create new self extraction directive file". click next.


select "extract files and run an installation command". click next.


type any title you want, such as "installation progress" and click next.


select "no prompt", unless you want a "yes or no" popup box to display when they first launch the file. click next.


select "do not display a license", unless you took the time to make one, and click next.


click the add button, find and select the three files we created above, and click next.


in the drop box for install program, select "setup.inf" and ignore the next box. click next.


select "default" and click next.


select "no message" and click next.


in the input box, type the path where you want the executable to be stored (this is not the same directory files are extracted to) along with the name of the executable, such as "c:\temp\aol.exe" and ignore the checkboxes. click next.


select "no restart", because i hate restarting, and click next.


select "don't save" and click next.


click next.


click finish; we're all done :-)

files should extract to the same location that you selected them from in step 6. if the installation needs to extract files to folders that do not exist, it will create them. since we selected the files from our "temp" folder, that is where they will be installed. if you go to your temp folder now you will see the aol.exe file we just created. before opening it, go ahead and delete the three files we created earlier. you will see that when you run the executable, it will replace the files you just deleted as well as give you an error message. to somebody who doesn't know what this thing is, they would have no idea you just slipped a couple of files onto their computer. before generating the fake error, what's to stop you from adding a scheduled task or changing a few registry values? that's right, nothing is stopping you. w00t!

Tapeworm - 1337 Hax or Handbook
Tapeworm - 1337 Hax or Handbook
Year: 2005
Pages: 74 © 2008-2017.
If you may any questions please contact us: