Packing is compressing a software in a way that is more or less invisible to the end user. Most of the time the result will be a single executable smaller in size than the original executable, but that takes longer to start. Common techniques are either using a tool to do the job or craft the thing by hand.

Packer and Compressor

A packer combines a really small program (stub) with specially compressed data. The stub decompresses the data, which is the original GPE, and then runs it. The GPE is often decompressed directly into ram, which makes the whole process 100% invisible. Current packers

  • UPX which have been ported to GP2X
  • Rlyeh's GPECompressor, for which the minimal size after compression is around 60k to 70k.

File Dropping

File dropping is about the same as the above, but instead of deflating to the RAM it drops the file somewhere on the disk, hence the name. Furthermore, it relies on the system to do the compression/decompression rather than using a custom-made decompressor. A fast way to do it is as follows:

  • compress the GPE with gzip
  • create a file with the following commandline (be sure it ends with a CF, 0x0A)
tail -n+3 $0|zcat>$b;$b;rm $b;exit
  • append the previously made .gz to the the previous file.

The code will create a file named B on the current directory, execute it and return. One could replace ./B by /tmp/B to get it cleaner. Also, before executing the file, one could add chmod +x $b; to make sure the file is seen as executable. However it has been tested and works fine without it. An advantage of this technique is that the final .GPE can be crafted on any platform as it only needs an hexadecimal editor, while the other way around needs more development time.

See Also

UPX, Demoscene

Personal tools