Stone's PE-Encrypter 2.0

Usage: running stnpepak will pack input.exe and leave the resulting file in
	output.exe


Table of Contents
	1.1	Features
	2.1	Legal stuff
	3.1	Known bugs
	4.1	Story .. ;)
	5.1	Credits
	6.1	Contacting


Features 1.1
	- Import support
	- Relocation support
	- Packaging of DATA & CODE
	- Packing of RELOCS and IMPORTS 

Legal Stuff 2.1
	You're allowed to use this program and the associated sourcecodes
	for free in any non-revenue generating context provided that:
		- You acknowledge Jibz's aPlib copyrights
		- email me if you do use them
		- give me a beer if we ever meet
		- Do not strip the "2nd&mi" tag
		- credit me for my work in a loyal fashion
		- acknowledge that all damage are not my fault.

Known bugs 3.1
	There are a zillion bugs in this. Here are a few:

	The HandleImports cannot import by ORDINAL from kernel32.dll
		solution: Do code that can traverse export sections and find
		 the imports itself.

	The HandleReloc is buggy outside of the stardard relocitem (3).
		solution: recode

	The Encrypt/Not Encrypt decision is based on two weak critereas.
		solution: recode based on RVA's in header

	If output.exe exists it will not be overwritten and no error message
	will be generated.
		solution: recode with 10 additional instructions

	If the Pointer to the PE-header is invalid (possibly because it's not 
	a PE-file - but a MZ) then it'll chrash.

	.....

4.1 Story
	A while back I released the sourcecode for a PE-encrypter and there has
been quite a nice response on it. Most ask how they can do imports, some how
they can do relocations. I made sourcecodes that did this but I wasn't really
content with them in a degree where I'd want to release them to the public. 
Anyways Random has been teasing me with that I needed to include packaging and
then my cup ran over when I saw that Anakin DaVinci (Steffan Esser) added
packaging to his.. (No offense meant Steffan... I admire your work). 
I'm supposed to be the only one with a PE-encrypter that doesn't pack? I'm
supposed to let the users of my webnote be in the dark about how it's done?
No way! ;)

So one Saturday night I said to myself.. it's time.. To make it a bit more fun
I challenged myself to do it as quickly as I could. The time table in the 
sourcecode document my progress. Notice though that a lot of code has been
cut and pasted from previous works of mine. Also notice that this is by far not
the first time I mess around with the PE-format. Infact I knew every step prior
I had to go thru before I started coding. The structure of the program severely
suffers from my as-quick-as-possible-approach. Bughunting this program and 
making it compatible will take as long as it took to write it - if not longer.
I leave this exercise to you :O

As in the majority of sourcecodes I release I try to keep it simple. It's my
belief that the important message of this sourcecodes is not how you do a 
user-interface or error checking. The important message is HOW do you abuse
the PE-format and this message is better conveyed if only relevant code is 
included. Thus no user-interface and minimalistic error checking.

Btw. The last object isn't packed. This is only because of bad structure in
my code. Version 2.01 will do it right :)


5.1 Credits:
Maincode	    : Me! ;)
Joergen Ibsen (Jibz): for the awesome aPlib, and his kind permission to
		      distribute this. http://apack.home.ml.org
NetWalker	    : Debugging and suggestions on the HandleReloc & HandleImport 
		      routines. Also imghdr.inc is of his creation.

6.1 Contacting
	email:	stone@one.se
	Web  :  http://www.cracking.net
	
					2nd&mi 1998
					Stone