Nmap Development mailing list archives

Re: compressing nmap executables and dlls with upx


From: "Guilherme Polo" <ggpolo () gmail com>
Date: Tue, 5 Feb 2008 09:25:40 -0200

2008/2/5, Dario Ciccarone (dciccaro) <dciccaro () cisco com>:
Ahem. Have we gone back to using 20 Mb hard disks ? :)

 * "We should forget about small efficiencies, say about 97% of the time:
 premature optimization is the root of all evil." (Knuth, Donald.
 Structured Programming with go to Statements, ACM Journal Computing
 Surveys, Vol 6, No. 4, Dec. 1974. p.268.)

Just a correction, Hoare is the author of that quote.


 I think that going from 16Mb to 6.5 Mb (while an interesting reduction
 in size), doesn't make much sense. Even if people thinks about having
 nmap on an U3 drive - I just bought a 4Gb one for less than $30.

 And there's a good reason NOT to do it, IMHO - AVs get antsy now and
 then, and start flagging everything, good or bad, that has gone thru UPX
 and derivatives as "suspicious". The garden variety nmap user would
 probably ignore the alarm - knowing or suspecting it has been
 UPX-or-similar compressed. But God forbids the AV (as TrendMicro used to
 do) has a "run weekly, erase suspected" job pre-configured.

 Happened to me once.

 I mean - Fyodor's call. But I see it as bringing more headaches than
 real benefits. Unless, of course, we consider those poor souls still
 accessing the Internet over 2400Bps modems . . . ;)


 Dario



 > -----Original Message-----
 > From: nmap-dev-bounces () insecure org
 > [mailto:nmap-dev-bounces () insecure org] On Behalf Of DePriest, Jason R.
 > Sent: Tuesday, February 05, 2008 12:54 AM
 > To: nmap-dev () insecure org
 > Subject: compressing nmap executables and dlls with upx
 >
 > You can get some pretty impressive compression ratios.  I just
 > compressed the files for my Windows installation.
 >
 > Any possibility this could be used for the official Windows installer
 > to make it quite a bit smaller?  I don't know if NSIS uses LZMA or
 > not, but that is what I asked UPX to use.
 >
 > The dlls went from 16,084,480 bytes to 6,462,976 bytes.
 >
 > The exes went from 2,469,724 bytes to 1,531,228 bytes.  Not as
 > impressive as the dlls, but still not bad.
 >
 > Just a thought... anyway, here are the compression details.
 >
 > Jason@FROG-POND /cygdrive/c/Program Files/Nmap
 > $ find . -type f -name '*.dll' -print0 | xargs -0
 > /cygdrive/f/Tools/upx/3.02/upx -9 -v --lzma
 >                        Ultimate Packer for eXecutables
 >   Copyright (C)
 > 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
 > UPX 3.02w       Markus Oberhumer, Laszlo Molnar & John Reiser
 >   Dec 16th 2007
 >
 >         File size         Ratio      Format      Name
 >    --------------------   ------   -----------   -----------
 >      57344 ->     23552   41.07%    win32/pe     bit.dll
 >      28672 ->     10752   37.50%    win32/pe     asprintf.dll
 >      67584 ->     36864   54.55%    win32/pe     bzip2.dll
 >      24576 ->      7168   29.17%    win32/pe     charset.dll
 >     443904 ->    195584   44.06%    win32/pe     freetype6.dll
 >      69632 ->     25600   36.76%    win32/pe     gettextlib.dll
 >      24576 ->      8192   33.33%    win32/pe     gettextpo.dll
 >     114688 ->     50688   44.20%    win32/pe     gettextsrc.dll
 >     892928 ->    475136   53.21%    win32/pe     iconv.dll
 >      45056 ->     21504   47.73%    win32/pe     intl.dll
 >     128512 ->     66560   51.79%    win32/pe     jpeg62.dll
 >      30720 ->     16384   53.33%    win32/pe     libpixmap.dll
 >      30208 ->     15872   52.54%    win32/pe     libsvg.dll
 >      59904 ->     26112   43.59%    win32/pe     libwimp.dll
 >      19968 ->      8704   43.59%    win32/pe     im-am-et.dll
 > upx: ./zenmap/lib/gtk-2.0/2.10.0/immodules/im-cedilla.dll:
 > NotCompressibleException
 >       8192 ->      7168   87.50%    win32/pe
 > im-cyrillic-translit.dll
 >      16896 ->     10752   63.64%    win32/pe     im-ime.dll
 >       8704 ->      7168   82.35%    win32/pe     im-inuktitut.dll
 > upx: ./zenmap/lib/gtk-2.0/2.10.0/immodules/im-ipa.dll:
 > NotCompressibleException
 >      11776 ->      8704   73.91%    win32/pe     im-thai.dll
 >      19968 ->      8704   43.59%    win32/pe     im-ti-er.dll
 >      19968 ->      8704   43.59%    win32/pe     im-ti-et.dll
 >       8192 ->      7168   87.50%    win32/pe     im-viqr.dll
 >      14848 ->     10752   72.41%    win32/pe
 > libpixbufloader-ani.dll
 >      15360 ->     11776   76.67%    win32/pe
 > libpixbufloader-bmp.dll
 >      26112 ->     15360   58.82%    win32/pe
 > libpixbufloader-gif.dll
 >      13312 ->     10752   80.77%    win32/pe
 > libpixbufloader-ico.dll
 >      14848 ->     10752   72.41%    win32/pe
 > libpixbufloader-jpeg.dll
 >      12288 ->      9216   75.00%    win32/pe
 > libpixbufloader-pcx.dll
 >      15360 ->     10752   70.00%    win32/pe
 > libpixbufloader-png.dll
 >      12800 ->     10240   80.00%    win32/pe
 > libpixbufloader-pnm.dll
 > upx: ./zenmap/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-ras.dll:
 > NotCompressibleException
 >      13312 ->     10752   80.77%    win32/pe
 > libpixbufloader-tga.dll
 >      14336 ->      9728   67.86%    win32/pe
 > libpixbufloader-tiff.dll
 > upx: ./zenmap/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-wbmp.dll:
 > NotCompressibleException
 >      10752 ->      8704   80.95%    win32/pe
 > libpixbufloader-xbm.dll
 >      25088 ->     14848   59.18%    win32/pe
 > libpixbufloader-xpm.dll
 > upx: ./zenmap/lib/gtk-2.0/2.10.0/loaders/svg_loader.dll:
 > NotCompressibleException
 >      33792 ->     17408   51.52%    win32/pe     libmetal.dll
 >      29696 ->     15872   53.45%    win32/pe     libpixmap.dll
 >      11776 ->      9216   78.26%    win32/pe     libredmond95.dll
 >      49664 ->     22528   45.36%    win32/pe     libwimp.dll
 >      19968 ->      8704   43.59%    win32/pe     im-am-et.dll
 > upx: ./zenmap/lib/gtk-2.0/2.4.0/immodules/im-cedilla.dll:
 > NotCompressibleException
 >       8192 ->      7168   87.50%    win32/pe
 > im-cyrillic-translit.dll
 >      16896 ->     10752   63.64%    win32/pe     im-ime.dll
 >       8704 ->      7168   82.35%    win32/pe     im-inuktitut.dll
 > upx: ./zenmap/lib/gtk-2.0/2.4.0/immodules/im-ipa.dll:
 > NotCompressibleException
 >       7680 ->      7168   93.33%    win32/pe     im-thai-broken.dll
 >      19968 ->      8704   43.59%    win32/pe     im-ti-er.dll
 >      19968 ->      8704   43.59%    win32/pe     im-ti-et.dll
 >       8192 ->      7168   87.50%    win32/pe     im-viqr.dll
 >      14848 ->     10752   72.41%    win32/pe
 > libpixbufloader-ani.dll
 >      13824 ->     10752   77.78%    win32/pe
 > libpixbufloader-bmp.dll
 >      26112 ->     15360   58.82%    win32/pe
 > libpixbufloader-gif.dll
 >      13824 ->     10752   77.78%    win32/pe
 > libpixbufloader-ico.dll
 >      14848 ->     10752   72.41%    win32/pe
 > libpixbufloader-jpeg.dll
 >      12288 ->      9216   75.00%    win32/pe
 > libpixbufloader-pcx.dll
 >      15360 ->     10752   70.00%    win32/pe
 > libpixbufloader-png.dll
 >      13824 ->     10240   74.07%    win32/pe
 > libpixbufloader-pnm.dll
 > upx: ./zenmap/lib/gtk-2.0/2.4.0/loaders/libpixbufloader-ras.dll:
 > NotCompressibleException
 >      13312 ->     10752   80.77%    win32/pe
 > libpixbufloader-tga.dll
 >      11776 ->      9216   78.26%    win32/pe
 > libpixbufloader-tiff.dll
 >       8704 ->      7680   88.24%    win32/pe
 > libpixbufloader-wbmp.dll
 >      10752 ->      8704   80.95%    win32/pe
 > libpixbufloader-xbm.dll
 >      25600 ->     14848   58.00%    win32/pe
 > libpixbufloader-xpm.dll
 >      12800 ->      9216   72.00%    win32/pe     pango-arabic-fc.dll
 >      10752 ->      8704   80.95%    win32/pe     pango-basic-fc.dll
 >       8704 ->      7680   88.24%    win32/pe     pango-basic-win32.dll
 >      13312 ->      9728   73.08%    win32/pe     pango-hangul-fc.dll
 >      13824 ->      9728   70.37%    win32/pe     pango-hebrew-fc.dll
 >      25600 ->     13312   52.00%    win32/pe     pango-indic-fc.dll
 >      11264 ->      8704   77.27%    win32/pe     pango-khmer-fc.dll
 >      12288 ->      9216   75.00%    win32/pe     pango-syriac-fc.dll
 >      19456 ->     10752   55.26%    win32/pe     pango-thai-fc.dll
 >      10752 ->      8192   76.19%    win32/pe     pango-tibetan-fc.dll
 >      12288 ->      9216   75.00%    win32/pe     pango-arabic-fc.dll
 > upx: ./zenmap/lib/pango/1.6.0/modules/pango-arabic-lang.dll:
 > NotCompressibleException
 >      10240 ->      8704   85.00%    win32/pe     pango-basic-fc.dll
 >      16384 ->     11264   68.75%    win32/pe     pango-basic-win32.dll
 >      14336 ->     10240   71.43%    win32/pe     pango-hangul-fc.dll
 >      13312 ->      9728   73.08%    win32/pe     pango-hebrew-fc.dll
 >      26624 ->     13824   51.92%    win32/pe     pango-indic-fc.dll
 >       7680 ->      7168   93.33%    win32/pe     pango-indic-lang.dll
 >      11776 ->      8704   73.91%    win32/pe     pango-khmer-fc.dll
 >      12288 ->      9216   75.00%    win32/pe     pango-syriac-fc.dll
 >      19456 ->     10752   55.26%    win32/pe     pango-thai-fc.dll
 >      11264 ->      8192   72.73%    win32/pe     pango-tibetan-fc.dll
 >      91648 ->     50688   55.31%    win32/pe     libart_lgpl_2-2.dll
 >     112640 ->     37888   33.64%    win32/pe     libatk-1.0-0.dll
 >     412672 ->    178176   43.18%    win32/pe     libcairo-2.dll
 >     214528 ->     79872   37.23%    win32/pe     libcroco-0.6-3.dll
 >     194048 ->     89088   45.91%    win32/pe     libfontconfig-1.dll
 >     443904 ->    195584   44.06%    win32/pe     libfreetype-6.dll
 >     569344 ->    227840   40.02%    win32/pe
 > libgdk-win32-2.0-0.dll
 >     274432 ->     97280   35.45%    win32/pe
 > libgdkglext-win32-1.0-0.dll
 >      86528 ->     40960   47.34%    win32/pe
 > libgdk_pixbuf-2.0-0.dll
 >      87040 ->     34304   39.41%    win32/pe     libglade-2.0-0.dll
 >     656896 ->    222208   33.83%    win32/pe     libglib-2.0-0.dll
 >      14848 ->     10240   68.97%    win32/pe     libgmodule-2.0-0.dll
 >     221184 ->     86016   38.89%    win32/pe     libgobject-2.0-0.dll
 >     173056 ->     72192   41.72%    win32/pe     libgsf-1-114.dll
 >      10752 ->      8192   76.19%    win32/pe
 > libgsf-win32-1-114.dll
 >      18432 ->     11776   63.89%    win32/pe     libgthread-2.0-0.dll
 >    3810304 ->   1178112   30.92%    win32/pe
 > libgtk-win32-2.0-0.dll
 >      10752 ->      8704   80.95%    win32/pe
 > libgtkglext-win32-1.0-0.dll
 >     243712 ->     96768   39.71%    win32/pe     libpango-1.0-0.dll
 >      39936 ->     18944   47.44%    win32/pe
 > libpangocairo-1.0-0.dll
 >     184320 ->     71680   38.89%    win32/pe     libpangoft2-1.0-0.dll
 >      43008 ->     23040   53.57%    win32/pe
 > libpangowin32-1.0-0.dll
 >     145920 ->     72704   49.82%    win32/pe     libpng12.dll
 >     203264 ->     90112   44.33%    win32/pe     libpng13.dll
 >      25088 ->     15872   63.27%    win32/pe     libpopt-0.dll
 >     183296 ->     74240   40.50%    win32/pe     librsvg-2-2.dll
 >     360448 ->    112128   31.11%    win32/pe     libtiff3.dll
 >    1291264 ->    496640   38.46%    win32/pe     libxml2.dll
 >     348160 ->    157184   45.15%    win32/pe     msvcr71.dll
 >    2113536 ->    747008   35.34%    win32/pe     python25.dll
 >     260096 ->    119808   46.06%    win32/pe     sqlite3.dll
 >      53248 ->     25600   48.08%    win32/pe     xmlparse.dll
 >      81920 ->     23040   28.13%    win32/pe     xmltok.dll
 >      59904 ->     35840   59.83%    win32/pe     zlib1.dll
 >    --------------------   ------   -----------   -----------
 >   16084480 ->   6462976   40.18%                 [ 114 files ]
 >
 > Packed 123 files: 114 ok, 9 errors.
 >
 > Jason@FROG-POND /cygdrive/c/Program Files/Nmap
 > $ find . -type f -name '*.exe' -print0 | xargs -0
 > /cygdrive/f/Tools/upx/3.02/upx -9 -v --lzma
 >                        Ultimate Packer for eXecutables
 >   Copyright (C)
 > 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
 > UPX 3.02w       Markus Oberhumer, Laszlo Molnar & John Reiser
 >   Dec 16th 2007
 >
 >         File size         Ratio      Format      Name
 >    --------------------   ------   -----------   -----------
 >    1335808 ->    415232   31.08%    win32/pe     nmap.exe
 >      53647 ->     41359   77.09%    win32/pe     Uninstall.exe
 > upx: ./zenmap/w9xpopen.exe: NotCompressibleException
 >    1080269 ->   1074637   99.48%    win32/pe     zenmap.exe
 >    --------------------   ------   -----------   -----------
 >    2469724 ->   1531228   62.00%                 [ 3 files ]
 >
 > Packed 4 files: 3 ok, 1 error.
 >
 > _______________________________________________
 > Sent through the nmap-dev mailing list
 > http://cgi.insecure.org/mailman/listinfo/nmap-dev
 > Archived at http://SecLists.Org
 >

 _______________________________________________
 Sent through the nmap-dev mailing list
 http://cgi.insecure.org/mailman/listinfo/nmap-dev
 Archived at http://SecLists.Org



-- 
-- Guilherme H. Polo Goncalves

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: