The UPX tool is a free, portable, extendable, high-performance executable packer for several executable formats.
The last released of UPX version is 3.95 and can be found at official webpage.
The description of this software tool comes with this info:
UPX is a versatile executable packer with the following features:
– excellent compression ratio: compresses better than zip/gzip,
use UPX to decrease the size of your distribution!
– very fast decompression: about 10 MiB/sec on an ancient Pentium 133,
about 200 MiB/sec on an Athlon XP 2000+.
– no memory overhead for your compressed executables for most of the
supported formats
– safe: you can list, test and unpack your executables
Also, a checksum of both the compressed and uncompressed file is
maintained internally.
– universal: UPX can pack a number of executable formats:
* Atari/tos
* bvmlinuz/386 [bootable Linux kernel]
* djgpp2/coff
* dos/com
* dos/exe
* dos/sys
* linux/386
* linux/elf386
* linux/sh386
* ps1/exe
* rtm32/pe
* tmt/adam
* vmlinuz/386 [bootable Linux kernel]
* vmlinux/386
* watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
* win32/pe (exe and dll)
* win64/pe (exe and dll)
* arm/pe (exe and dll)
* linux/elfamd64
* linux/elfppc32
* mach/elfppc32
– portable: UPX is written in portable endian-neutral C++
– extendable: because of the class layout it’s very easy to support
new executable formats or add new compression algorithms
– free: UPX can be distributed and used freely. And from version 0.99
the full source code of UPX is released under the GNU General Public
License (GPL)
Let’s see the help command:
1 | C:\BackUP\Tools\upx-3.95-win64>upx --help |
If you get the output the NotCompressibleException, the reason is the size of your binary is too small the tool cannot handle binaries under 40Kb.
Let’s test with a FASMW editor.
The reason I used the FASMW editor for testing is created with assembly language.
Most software created with advanced visual IDE can be optimized.
I copy the executable file to my UPX folder:
1 | 04/30/2018 06:26 PM 156,672 FASMW.EXE |
The command line for compression and output with this tool is:
1 2 3 4 5 6 7 8 9 10 | C:\BackUP\Tools\upx-3.95-win64>upx.exe --all-filters FASMW.EXE Ultimate Packer for eXecutables Copyright (C) 1996 - 2018 UPX 3.95w Markus Oberhumer, Laszlo Molnar & John Reiser Aug 26th 2018 File size Ratio Format Name -------------------- ------ ----------- ----------- 156672 -> 72704 46.41% win32/pe FASMW.EXE Packed 1 file. |
The result size is:
1 | 04/30/2018 06:26 PM 72,704 FASMW.EXE |