UPX使用教程


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 <A href=http://upx.tsx.org>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/
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM