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.
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.
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! |