UPX使用教程
阅读原文时间:2023年07月10日阅读:3

UPX是一个通用可执行文件压缩器,由于其具有:

  • 压缩率高:压缩效果优于zip/gzip;
  • 解压速度快:在奔腾133上即可达到大约10MB/秒;
  • 压缩的可执行文件没有额外的内存开销;
  • 安全:可以列表,检测和解压可执行文件,压缩和解压缩文件内部都维持有一个校验和;
  • 广域:可以压缩多种可执行文件格式:
    • dos/exe
    • dos/sys
    • dos/com
    • djgpp2/coff
    • watcom/le ( 支持DOS4G, PMODE/W, DOS32a 和 CauseWay )
    • win32/pe
    • rtm32/pe
    • tmt/adam
    • linux/386
    • atari/tos
  • 免费

等特性,因此其也成为我们在压缩可执行文件时的首选工具。

UPX是一个控制台应用程序,以命令行方式进行操作,其使用是极其简单的:

upx [-命令] [-选项] [-o 目标文件] 源文件..下面我们以UPX
1.07W为例,具体讲解其使用方法。默认情况下,UPX将直接对源文件进行操作,但也可指定目标文件,而不覆盖源文件,文件名支持通配符,即一次可对多个文件进行同一操作。

一、显示 UPX 通用信息(版权信息,使用说明等),在命令行直接输入 UPX 并回车。

找到其路径,在cmd命令行下打开

代码:

``C:>UPX

  
  
  
   
Ultimate Packer for eXecutables

  
  
   Copyright (C)
1996, 1997, 1998, 1999, 2000, 2001

UPX 1.07w   
   
Markus F.X.J. Oberhumer & Laszlo Molnar
  
   
Feb 20th 2001

Usage: upx [-123456789dlthVL] [-qvfk] [-o file] file..

Commands:

   -1
   
compress faster   
  
  
  
   -9 compress
better

  
-d    
decompress   
  
  
  
  
  
   -l list
compressed file

   -t
   
test compressed file
  
  
  
   
-V display version number

   -h
   
give more help   
  
  
  
  
   
-L display software license

Options:

   -q
   
be quiet   
  
  
  
  
  
  
   
-v be verbose

   -oFILE write
output to `FILE'

   -f
   
force compression of suspicious files

   -k
   
keep backup files

   file..
executables to (de)compress

This version supports: dos/exe, dos/com, dos/sys, djgpp2/coff,
watcom/le,

  
  
  
  
  
  
   
win32/pe, rtm32/pe, tmt/adam, atari/tos, linux/386

UPX comes with ABSOLUTELY NO WARRANTY; for details visit
http://upx.tsx.org``

常用操作

二、压缩可执行文件:

复制内容到剪贴板

代码:

`C:>UPX sample.exe

  
  
  
  
  
   Ultimate Packer
for eXecutables

  
  
   Copyright (C)
1996, 1997, 1998, 1999, 2000, 2001

UPX 1.07w   
   
Markus F.X.J. Oberhumer & Laszlo Molnar
  
   
Feb 20th 2001

  
   
File size   
   Ratio
   Format
   Name


Compressing sample.exe [win32/pe]

[*……………………………..]
45.8%   |

  
  
  
  
  
   Ultimate Packer
for eXecutables

  
  
   Copyright (C)
1996, 1997, 1998, 1999, 2000, 2001

UPX 1.07w   
   
Markus F.X.J. Oberhumer & Laszlo Molnar
  
   
Feb 20th 2001

  
   
File size   
   Ratio
   Format
   Name


341504 -> 142336 41.67% win32/pe
   
sample.exe

Packed 1 file.`

压缩文件可使用命令参数-1~-9来控制压缩速度及压缩率,数字越小压缩速度越快,数字越大压缩率越大。使用--best命令参数将获得最大的压缩率,但其压缩速度也是最慢的。压缩过程将以动态方式显示,压缩完毕将给出压缩前后的文件大小,压缩率,文件格式及名称。

三、解压缩可执行文件:

复制内容到剪贴板

代码:

`C:>UPX -d
sample.exe

  
  
  
  
  
   Ultimate Packer
for eXecutables

  
  
   Copyright (C)
1996, 1997, 1998, 1999, 2000, 2001

UPX 1.07w   
   
Markus F.X.J. Oberhumer & Laszlo Molnar
  
   
Feb 20th 2001

  
   
File size   
   Ratio
   Format
   Name


341504 <- 142336 41.67% win32/pe
   
sample.exe

Unpacked 1 file.`

四、列表

复制内容到剪贴板

代码:

`C:>UPX -l
sample.exe

  
  
  
  
  
   Ultimate Packer
for eXecutables

  
  
   Copyright (C)
1996, 1997, 1998, 1999, 2000, 2001

UPX 1.07w   
   
Markus F.X.J. Oberhumer & Laszlo Molnar
  
   
Feb 20th 2001

  
   
File size   
   Ratio
   Format
   Name


341504 -> 142336 41.67% win32/pe
   
sample.exe`

五、 测试压缩过的可执行文件

复制内容到剪贴板

代码:

`C:>UPX -t
sample.exe

  
  
  
  
  
   Ultimate Packer
for eXecutables

  
  
   Copyright (C)
1996, 1997, 1998, 1999, 2000, 2001

UPX 1.07w   
   
Markus F.X.J. Oberhumer & Laszlo Molnar
  
   
Feb 20th 2001

testing sample.exe [OK]

Tested 1 file.`

其它操作

六、显示版本号:

复制内容到剪贴板

代码:

``C:>UPX -V

upx 1.07

NRV data compression library 0.81

Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer

Copyright (C) 1996-2001 Laszlo Molnar

UPX comes with ABSOLUTELY NO WARRANTY; for details type `upx
-L'.``

七、显示软件许可声明:
复制内容到剪贴板

代码:

`C:>UPX -L

  
  
  
  
  
   Ultimate Packer
for eXecutables

  
  
   Copyright (C)
1996, 1997, 1998, 1999, 2000, 2001

UPX 1.07w   
   
Markus F.X.J. Oberhumer & Laszlo Molnar
  
   
Feb 20th 2001

This program may be used freely, and you are welcome to

redistribute it under certain conditions.

This program is distributed in the hope that it will be
useful,

but WITHOUT ANY WARRANTY; without even the implied warranty
of

MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.   See
the

UPX License Agreement for more details.

You should have received a copy of the UPX License Agreement

along with this program; see the file LICENSE.

If not, visit one of the following pages:

  
   
http://upx.tsx.org

  
   
http://www.oberhumer.com/upx/`

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章