压缩加壳工具UPX编译及使用实例

压缩加壳工具UPX编译及使用实例

UPX介绍

UPX是一个著名的压缩壳,主要功能是压缩PE文件(比如exe,dll等文件),有时候也可能被病毒用于免杀.壳upx是一种保护程序。一般是EXE文件的一种外保护措施,主要用途 :
1、让正规文件被保护起来,不容易被修改和破解。
2、使文件压缩变小。
3、保护杀毒软件安装程序,使之不受病毒侵害。
4、木马,病毒的保护外壳,使之难以为攻破。 仅仅看一个壳upx路径 是不能确定什么的。要仔细看看他相对应的文件,如果是杀毒或者是自己已知的文件那就无伤大雅,要是其他疑似,就要认真对待了。.

UPX主页:UPX: the Ultimate Packer for eXecutables – Homepage.
UPX github主页:GitHub - upx/upx: UPX - the Ultimate Packer for eXecutables.

UPX在debian下编译

Upx的编译需要依赖lzma及ucl,提前准备好这三个的源码。

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev$ ls
ucl-1.03.tar.gz  upx-devel.zip  upx-lzma-sdk-master.zip

将lzma及ucl分别解压到upx的src路径中

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03$ ls
acc       aclocal.m4  AUTHORS  config.hin  configure.ac  examples  INSTALL      Makefile.in  README  THANKS  upx
acconfig  asm         B        configure   COPYING       include   Makefile.am  NEWS         src     TODO
wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/lzma-sdk$ ls
7zC.txt  7zFormat.txt  C  CPL.html  history.txt  LGPL.txt  lzma.txt  Methods.txt  upx-lzma-sdk-master  upx-lzma-sdk-master.zip

首先配置ucl的编译选项,在ucl路径执行 ./configure --prefix=/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/ ,注意–prefix=后面的路径为你刚刚释放的ucl源码的路径

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03$ ./configure --prefix=/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/
configure: Configuring UCL 1.03
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
...
太多了,省略一部分
...
checking for umask... yes
checking for utime... yes
checking for vsnprintf... yes
checking whether your compiler passes the ACC conformance test... FAILED
configure:
configure: Your compiler failed the ACC conformance test - for details see
configure: `config.log'. Please check that log file and consider sending
configure: a patch or bug-report to <markus@oberhumer.com>.
configure: Thanks for your support.
configure:
configure: error: ACC conformance test failed. Stop.
wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03$

按照网上检索到的信息修改configure文件
网上检索信息
修改configure文件:

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03$ vim configure

修改红框处:
修改红框处
修改完成后重新执行 ./configure --prefix=/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/ ,注意–prefix=后面的路径为你刚刚释放的ucl源码的路径

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03$ ./configure --prefix=/mnt/driver_D/test/upx                                                                                       -dev/upx-devel/src/ucl-1.03/
configure: Configuring UCL 1.03
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
...
太多了,省略一部分
...
checking for umask... yes
checking for utime... yes
checking for vsnprintf... yes
checking whether your compiler passes the ACC conformance test... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating examples/Makefile
config.status: creating include/Makefile
config.status: creating include/ucl/Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands

   UCL configuration summary
   -------------------------
   UCL version               : 1.03
   host operating system     : x86_64-unknown-linux-gnu
   source code location      : .
   compiler                  : gcc
   preprocessor flags        :  -DUCL_HAVE_CONFIG_H
   compiler flags            : -g -O2 -std=gnu90 -fPIC
   build static library      : yes
   build shared library      : no
   enable i386 assembly code : no


   UCL 1.03 configured.

   Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
   All Rights Reserved.

   The UCL library is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of
   the License, or (at your option) any later version.

   The UCL library 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
   GNU General Public License for more details.

   Markus F.X.J. Oberhumer
   <markus@oberhumer.com>
   http://www.oberhumer.com/opensource/ucl/


Type `make' to build UCL. Type `make install' to install UCL.
After installing UCL, please read the accompanied documentation.

配置完成,准备编译,执行:make

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03$ make
make  all-recursive
make[1]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03'
Making all in include
make[2]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/include'
Making all in ucl
make[3]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/include/ucl'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/include/ucl'
make[3]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/include'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/include'
make[2]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/include'
Making all in src
make[2]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/src'
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT alloc.lo -MD -MP -MF ".deps/alloc.Tpo" -c -o alloc.lo alloc.c; \
then mv -f ".deps/alloc.Tpo" ".deps/alloc.Plo"; else rm -f ".deps/alloc.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT alloc.lo -MD -MP -M                                                                                       F .deps/alloc.Tpo -c alloc.c -o alloc.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2b_99.lo -MD -MP -MF ".deps/n2b_99.Tpo" -c -o n2b_99.lo n2b_99.c; \
then mv -f ".deps/n2b_99.Tpo" ".deps/n2b_99.Plo"; else rm -f ".deps/n2b_99.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2b_99.lo -MD -MP -                                                                                       MF .deps/n2b_99.Tpo -c n2b_99.c -o n2b_99.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2b_d.lo -MD -MP -MF ".deps/n2b_d.Tpo" -c -o n2b_d.lo n2b_d.c; \
then mv -f ".deps/n2b_d.Tpo" ".deps/n2b_d.Plo"; else rm -f ".deps/n2b_d.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2b_d.lo -MD -MP -M                                                                                       F .deps/n2b_d.Tpo -c n2b_d.c -o n2b_d.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2b_ds.lo -MD -MP -MF ".deps/n2b_ds.Tpo" -c -o n2b_ds.lo n2b_ds.c; \
then mv -f ".deps/n2b_ds.Tpo" ".deps/n2b_ds.Plo"; else rm -f ".deps/n2b_ds.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2b_ds.lo -MD -MP -                                                                                       MF .deps/n2b_ds.Tpo -c n2b_ds.c -o n2b_ds.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2b_to.lo -MD -MP -MF ".deps/n2b_to.Tpo" -c -o n2b_to.lo n2b_to.c; \
then mv -f ".deps/n2b_to.Tpo" ".deps/n2b_to.Plo"; else rm -f ".deps/n2b_to.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2b_to.lo -MD -MP -                                                                                       MF .deps/n2b_to.Tpo -c n2b_to.c -o n2b_to.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2d_99.lo -MD -MP -MF ".deps/n2d_99.Tpo" -c -o n2d_99.lo n2d_99.c; \
then mv -f ".deps/n2d_99.Tpo" ".deps/n2d_99.Plo"; else rm -f ".deps/n2d_99.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2d_99.lo -MD -MP -                                                                                       MF .deps/n2d_99.Tpo -c n2d_99.c -o n2d_99.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2d_d.lo -MD -MP -MF ".deps/n2d_d.Tpo" -c -o n2d_d.lo n2d_d.c; \
then mv -f ".deps/n2d_d.Tpo" ".deps/n2d_d.Plo"; else rm -f ".deps/n2d_d.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2d_d.lo -MD -MP -M                                                                                       F .deps/n2d_d.Tpo -c n2d_d.c -o n2d_d.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2d_ds.lo -MD -MP -MF ".deps/n2d_ds.Tpo" -c -o n2d_ds.lo n2d_ds.c; \
then mv -f ".deps/n2d_ds.Tpo" ".deps/n2d_ds.Plo"; else rm -f ".deps/n2d_ds.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2d_ds.lo -MD -MP -                                                                                       MF .deps/n2d_ds.Tpo -c n2d_ds.c -o n2d_ds.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2d_to.lo -MD -MP -MF ".deps/n2d_to.Tpo" -c -o n2d_to.lo n2d_to.c; \
then mv -f ".deps/n2d_to.Tpo" ".deps/n2d_to.Plo"; else rm -f ".deps/n2d_to.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2d_to.lo -MD -MP -                                                                                       MF .deps/n2d_to.Tpo -c n2d_to.c -o n2d_to.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2e_99.lo -MD -MP -MF ".deps/n2e_99.Tpo" -c -o n2e_99.lo n2e_99.c; \
then mv -f ".deps/n2e_99.Tpo" ".deps/n2e_99.Plo"; else rm -f ".deps/n2e_99.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2e_99.lo -MD -MP -                                                                                       MF .deps/n2e_99.Tpo -c n2e_99.c -o n2e_99.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2e_d.lo -MD -MP -MF ".deps/n2e_d.Tpo" -c -o n2e_d.lo n2e_d.c; \
then mv -f ".deps/n2e_d.Tpo" ".deps/n2e_d.Plo"; else rm -f ".deps/n2e_d.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2e_d.lo -MD -MP -M                                                                                       F .deps/n2e_d.Tpo -c n2e_d.c -o n2e_d.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2e_ds.lo -MD -MP -MF ".deps/n2e_ds.Tpo" -c -o n2e_ds.lo n2e_ds.c; \
then mv -f ".deps/n2e_ds.Tpo" ".deps/n2e_ds.Plo"; else rm -f ".deps/n2e_ds.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2e_ds.lo -MD -MP -                                                                                       MF .deps/n2e_ds.Tpo -c n2e_ds.c -o n2e_ds.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT n2e_to.lo -MD -MP -MF ".deps/n2e_to.Tpo" -c -o n2e_to.lo n2e_to.c; \
then mv -f ".deps/n2e_to.Tpo" ".deps/n2e_to.Plo"; else rm -f ".deps/n2e_to.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT n2e_to.lo -MD -MP -                                                                                       MF .deps/n2e_to.Tpo -c n2e_to.c -o n2e_to.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT ucl_crc.lo -MD -MP -MF ".deps/ucl_crc.Tpo" -c -o ucl_crc.lo ucl_crc.c; \
then mv -f ".deps/ucl_crc.Tpo" ".deps/ucl_crc.Plo"; else rm -f ".deps/ucl_crc.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT ucl_crc.lo -MD -MP                                                                                        -MF .deps/ucl_crc.Tpo -c ucl_crc.c -o ucl_crc.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT ucl_init.lo -MD -MP -MF ".deps/ucl_init.Tpo" -c -o ucl_init.lo ucl_init.c; \
then mv -f ".deps/ucl_init.Tpo" ".deps/ucl_init.Plo"; else rm -f ".deps/ucl_init.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT ucl_init.lo -MD -MP                                                                                        -MF .deps/ucl_init.Tpo -c ucl_init.c -o ucl_init.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT ucl_ptr.lo -MD -MP -MF ".deps/ucl_ptr.Tpo" -c -o ucl_ptr.lo ucl_ptr.c; \
then mv -f ".deps/ucl_ptr.Tpo" ".deps/ucl_ptr.Plo"; else rm -f ".deps/ucl_ptr.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT ucl_ptr.lo -MD -MP                                                                                        -MF .deps/ucl_ptr.Tpo -c ucl_ptr.c -o ucl_ptr.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT ucl_str.lo -MD -MP -MF ".deps/ucl_str.Tpo" -c -o ucl_str.lo ucl_str.c; \
then mv -f ".deps/ucl_str.Tpo" ".deps/ucl_str.Plo"; else rm -f ".deps/ucl_str.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT ucl_str.lo -MD -MP                                                                                        -MF .deps/ucl_str.Tpo -c ucl_str.c -o ucl_str.o
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..   -DUCL_HAVE_CONFIG_H    -g -                                                                                       O2 -std=gnu90 -fPIC  -MT ucl_util.lo -MD -MP -MF ".deps/ucl_util.Tpo" -c -o ucl_util.lo ucl_util.c; \
then mv -f ".deps/ucl_util.Tpo" ".deps/ucl_util.Plo"; else rm -f ".deps/ucl_util.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.. -DUCL_HAVE_CONFIG_H -g -O2 -std=gnu90 -fPIC -MT ucl_util.lo -MD -MP                                                                                        -MF .deps/ucl_util.Tpo -c ucl_util.c -o ucl_util.o
/bin/bash ../libtool --mode=link gcc   -g -O2 -std=gnu90 -fPIC    -o libucl.la -rpath /mnt/driver_D/test/upx-dev/upx-de                                                                                       vel/src/ucl-1.03//lib -version-info 1:0:0 alloc.lo n2b_99.lo n2b_d.lo n2b_ds.lo n2b_to.lo n2d_99.lo n2d_d.lo n2d_ds.lo                                                                                        n2d_to.lo n2e_99.lo n2e_d.lo n2e_ds.lo n2e_to.lo ucl_crc.lo ucl_init.lo ucl_ptr.lo ucl_str.lo ucl_util.lo
mkdir .libs
ar cru .libs/libucl.a  alloc.o n2b_99.o n2b_d.o n2b_ds.o n2b_to.o n2d_99.o n2d_d.o n2d_ds.o n2d_to.o n2e_99.o n2e_d.o n                                                                                       2e_ds.o n2e_to.o ucl_crc.o ucl_init.o ucl_ptr.o ucl_str.o ucl_util.o
ar: `u' modifier ignored since `D' is the default (see `U')
ranlib .libs/libucl.a
creating libucl.la
(cd .libs && rm -f libucl.la && ln -s ../libucl.la libucl.la)
make[2]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/src'
Making all in examples
make[2]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/examples'
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..  -DUCL_HAVE_CONFIG_H  -g -O2 -std=gnu90 -fPIC -MT simple.o -MD -M                                                                                       P -MF ".deps/simple.Tpo" -c -o simple.o simple.c; \
then mv -f ".deps/simple.Tpo" ".deps/simple.Po"; else rm -f ".deps/simple.Tpo"; exit 1; fi
/bin/bash ../libtool --mode=link gcc  -g -O2 -std=gnu90 -fPIC   -o simple  simple.o ../src/libucl.la
mkdir .libs
gcc -g -O2 -std=gnu90 -fPIC -o simple simple.o  ../src/.libs/libucl.a
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I..  -DUCL_HAVE_CONFIG_H  -g -O2 -std=gnu90 -fPIC -MT uclpack.o -MD -                                                                                       MP -MF ".deps/uclpack.Tpo" -c -o uclpack.o uclpack.c; \
then mv -f ".deps/uclpack.Tpo" ".deps/uclpack.Po"; else rm -f ".deps/uclpack.Tpo"; exit 1; fi
/bin/bash ../libtool --mode=link gcc  -g -O2 -std=gnu90 -fPIC   -o uclpack  uclpack.o ../src/libucl.la
gcc -g -O2 -std=gnu90 -fPIC -o uclpack uclpack.o  ../src/.libs/libucl.a
make[2]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/examples'
make[2]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03'
make[2]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03'
make[1]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03'
wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03$

至此,UCL编译完成。
接下来就可以开始编译UPX了,回到UPX的Makefile目录,执行:make all UPX_UCLDIR=/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/ UPX_LZMADIR=./src/lzma-sdk LDFLAGS=-no-pie,注意把UPX_UCLDIR=后面换成刚刚编译好的UCL路径,UPX_LZMADIR=后面换成lzma接压路径,开始编译。

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel$ make all UPX_UCLDIR=/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/ UPX_LZMADIR=./src/lzma-sdk LDFLAGS=-no-pie
make -C src all
make[1]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src'
Updating .depend
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o c_file.o -c c_file.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o c_init.o -c c_init.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o c_none.o -c c_none.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o c_screen.o -c c_screen.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o compress.o -c compress.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -I./../src/lzma-sdk -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -Wno-shadow -o compress_lzma.o -c compress_lzma.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o compress_ucl.o -c compress_ucl.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o compress_zlib.o -c compress_zlib.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o except.o -c except.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o file.o -c file.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o filter.o -c filter.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o filteri.o -c filteri.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o help.o -c help.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o lefile.o -c lefile.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o linker.o -c linker.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o main.o -c main.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o mem.o -c mem.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o msg.o -c msg.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_armpe.o -c p_armpe.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_com.o -c p_com.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_djgpp2.o -c p_djgpp2.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_exe.o -c p_exe.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_lx_elf.o -c p_lx_elf.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_lx_exc.o -c p_lx_exc.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_lx_interp.o -c p_lx_interp.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_lx_sh.o -c p_lx_sh.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -Wno-cast-align -o p_mach.o -c p_mach.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_ps1.o -c p_ps1.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_sys.o -c p_sys.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_tmt.o -c p_tmt.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_tos.o -c p_tos.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_unix.o -c p_unix.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_vmlinx.o -c p_vmlinx.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_vmlinz.o -c p_vmlinz.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_w32pe.o -c p_w32pe.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_w64pep.o -c p_w64pep.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o p_wcle.o -c p_wcle.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o packer.o -c packer.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o packer_c.o -c packer_c.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o packer_f.o -c packer_f.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o packhead.o -c packhead.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o packmast.o -c packmast.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o pefile.o -c pefile.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o s_djgpp2.o -c s_djgpp2.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o s_object.o -c s_object.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o s_vcsa.o -c s_vcsa.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o s_win32.o -c s_win32.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o snprintf.o -c snprintf.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o ui.o -c ui.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o util.o -c util.cpp
g++ -I/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//include -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -o work.o -c work.cpp
g++ -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-protector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings -Werror -no-pie -o upx.out c_file.o c_init.o c_none.o c_screen.o compress.o compress_lzma.o compress_ucl.o compress_zlib.o except.o file.o filter.o filteri.o help.o lefile.o linker.o main.o mem.o msg.o p_armpe.o p_com.o p_djgpp2.o p_exe.o p_lx_elf.o p_lx_exc.o p_lx_interp.o p_lx_sh.o p_mach.o p_ps1.o p_sys.o p_tmt.o p_tos.o p_unix.o p_vmlinx.o p_vmlinz.o p_w32pe.o p_w64pep.o p_wcle.o packer.o packer_c.o packer_f.o packhead.o packmast.o pefile.o s_djgpp2.o s_object.o s_vcsa.o s_win32.o snprintf.o ui.o util.o work.o -L/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//src/.libs/ -lucl -lz
./../src/stub/scripts/check_whitespace.sh ./..
ERROR: DOS EOL detected ./src/ucl-1.03/B/00README.TXT: Simple make drivers for DOS, Windows, OS/2 and other systems
Makefile:110: recipe for target 'upx.out' failed
make[1]: *** [upx.out] Error 1
make[1]: *** Deleting file 'upx.out'
make[1]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src'
Makefile:31: recipe for target 'all' failed
make: *** [all] Error 2

发生报错,读一下报错日志,发现是src/stub/scripts/check_whitespace.sh脚本识别到windows的换行导致报错,将脚本此次注释掉:
注释脚本部分内容
重新编译:

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel$ make all UPX_UCLDIR=/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03/ UPX_LZMADIR=./src/lzma-sdk LDFLAGS=-no-pie
make -C src all
make[1]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/src'
g++ -std=c++14 -O2 -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-strict-overflow -funsigned-char -fstack-pr                                                                                       otector-strong -Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-str                                                                                       ings -Werror -no-pie -o upx.out c_file.o c_init.o c_none.o c_screen.o compress.o compress_lzma.o compress_ucl.o compres                                                                                       s_zlib.o except.o file.o filter.o filteri.o help.o lefile.o linker.o main.o mem.o msg.o p_armpe.o p_com.o p_djgpp2.o p_                                                                                       exe.o p_lx_elf.o p_lx_exc.o p_lx_interp.o p_lx_sh.o p_mach.o p_ps1.o p_sys.o p_tmt.o p_tos.o p_unix.o p_vmlinx.o p_vmli                                                                                       nz.o p_w32pe.o p_w64pep.o p_wcle.o packer.o packer_c.o packer_f.o packhead.o packmast.o pefile.o s_djgpp2.o s_object.o                                                                                        s_vcsa.o s_win32.o snprintf.o ui.o util.o work.o -L/mnt/driver_D/test/upx-dev/upx-devel/src/ucl-1.03//src/.libs/ -lucl                                                                                        -lz
./../src/stub/scripts/check_whitespace.sh ./..
make[1]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/src'
make -C doc all
make[1]: Entering directory '/mnt/driver_D/test/upx-dev/upx-devel/doc'
pod2man --center=" " --release="upx 4.0.0" --date="2021-01-01" upx.pod | sed -e 's/[    ]*$//' > upx.1
test -s upx.1
pod2text < upx.pod | sed -e 's/[        ]*$//' > upx.doc
test -s upx.doc
pod2html --noindex upx.pod | sed -e 's/[        ]*$//' | sed -e 's/     /  /g' > upx.html
test -s upx.html
make[1]: Leaving directory '/mnt/driver_D/test/upx-dev/upx-devel/doc'
wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel$

编译完成,编译出来的文件在src/upx.out,执行一下看一下:

wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel$ ls src/upx.out
src/upx.out
wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel$ src/upx.out -h
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2021
UPX 4.0.0       Markus Oberhumer, Laszlo Molnar & John Reiser    Jan 1st 2021

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

Commands:
  -1     compress faster                   -9    compress better
  --best compress best (can be slow for big files)
  -d     decompress                        -l    list compressed file
  -t     test compressed file              -V    display version number
  -h     give this help                    -L    display software license

Options:
  -q     be quiet                          -v    be verbose
  -oFILE write output to 'FILE'
  -f     force compression of suspicious files
  --no-color, --mono, --color, --no-progress   change look

Compression tuning options:
  --lzma              try LZMA [slower but tighter than NRV]
  --brute             try all available compression methods & filters [slow]
  --ultra-brute       try even more compression variants [very slow]

Backup options:
  -k, --backup        keep backup files
  --no-backup         no backup files [default]

Overlay options:
  --overlay=copy      copy any extra data attached to the file [default]
  --overlay=strip     strip any extra data attached to the file [DANGEROUS]
  --overlay=skip      don't compress a file with an overlay

Options for djgpp2/coff:
  --coff              produce COFF output [default: EXE]

Options for dos/com:
  --8086              make compressed com work on any 8086

Options for dos/exe:
  --8086              make compressed exe work on any 8086
  --no-reloc          put no relocations in to the exe header

Options for dos/sys:
  --8086              make compressed sys work on any 8086

Options for ps1/exe:
  --8-bit             uses 8 bit size compression [default: 32 bit]
  --8mib-ram          8 megabyte memory limit [default: 2 MiB]
  --boot-only         disables client/host transfer compatibility
  --no-align          don't align to 2048 bytes [enables: --console-run]

Options for watcom/le:
  --le                produce LE output [default: EXE]

Options for win32/pe, win64/pe, rtm32/pe & arm/pe:
  --compress-exports=0    do not compress the export section
  --compress-exports=1    compress the export section [default]
  --compress-icons=0      do not compress any icons
  --compress-icons=1      compress all but the first icon
  --compress-icons=2      compress all but the first icon directory [default]
  --compress-icons=3      compress all icons
  --compress-resources=0  do not compress any resources at all
  --keep-resource=list    do not compress resources specified by list
  --strip-relocs=0        do not strip relocations
  --strip-relocs=1        strip relocations [default]

Options for linux/elf:
  --preserve-build-id     copy .gnu.note.build-id to compressed output

file..   executables to (de)compress

This version supports:
    amd64-darwin.dylib                   dylib/amd64
    amd64-darwin.macho                   macho/amd64
    amd64-linux.elf                      linux/amd64
    amd64-linux.kernel.vmlinux           vmlinux/amd64
    amd64-win64.pe                       win64/pe
    arm-darwin.macho                     macho/arm
    arm-linux.elf                        linux/arm
    arm-linux.kernel.vmlinux             vmlinux/arm
    arm-linux.kernel.vmlinuz             vmlinuz/arm
    arm-wince.pe                         arm/pe
    arm64-darwin.macho                   macho/arm64
    arm64-linux.elf                      linux/arm64
    armeb-linux.elf                      linux/armeb
    armeb-linux.kernel.vmlinux           vmlinux/armeb
    fat-darwin.macho                     macho/fat
    i086-dos16.com                       dos/com
    i086-dos16.exe                       dos/exe
    i086-dos16.sys                       dos/sys
    i386-bsd.elf.execve                  bsd.exec/i386
    i386-darwin.macho                    macho/i386
    i386-dos32.djgpp2.coff               djgpp2/coff
    i386-dos32.tmt.adam                  tmt/adam
    i386-dos32.watcom.le                 watcom/le
    i386-freebsd.elf                     freebsd/i386
    i386-linux.elf                       linux/i386
    i386-linux.elf.execve                linux.exec/i386
    i386-linux.elf.shell                 linux.sh/i386
    i386-linux.kernel.bvmlinuz           bvmlinuz/i386
    i386-linux.kernel.vmlinux            vmlinux/i386
    i386-linux.kernel.vmlinuz            vmlinuz/i386
    i386-netbsd.elf                      netbsd/i386
    i386-openbsd.elf                     openbsd/i386
    i386-win32.pe                        win32/pe
    m68k-atari.tos                       atari/tos
    mips-linux.elf                       linux/mips
    mipsel-linux.elf                     linux/mipsel
    mipsel.r3000-ps1                     ps1/exe
    powerpc-darwin.macho                 macho/ppc32
    powerpc-linux.elf                    linux/ppc32
    powerpc-linux.kernel.vmlinux         vmlinux/ppc32
    powerpc64-linux.elf                  linux/ppc64
    powerpc64le-darwin.macho             macho/ppc64le
    powerpc64le-linux.elf                linux/ppc64le
    powerpc64le-linux.kernel.vmlinux     vmlinux/ppc64le

UPX comes with ABSOLUTELY NO WARRANTY; for details visit https://upx.github.io
wanghan@wanghan-W3335HA1:/mnt/driver_D/test/upx-dev/upx-devel$

至此UPX编译已经完成。

UPX使用

UPX可以加壳压缩exe、dll、linux可执行文件、so动态库等,接下来分别尝试。

  1. 对exe加壳
    准备一个exe程序(我是自己写了一个简单windows窗口程序),能够正常运行,文件大小102K。
    在这里插入图片描述
    使用UPX对这个程序加壳,加壳后,文件大小60K,能正常启动。
    在这里插入图片描述
  2. 对DLL加密
    准备一个exe和一个dll(我是自己写的,MyMessageBoxDll.dll为自己编写的动态库,调用动态库中的函数,会弹出一个MessageBox弹窗,MessageBoxTest.exe为调用动态库的主程序)。加壳前,dll文件8704字节,能正常运行。
    在这里插入图片描述
    使用UPX对dll进行加壳,加壳后,dll文件6656字节,能正常运行。
    在这里插入图片描述
  3. 对linux可执行文件加壳
    准备一个linux可执行文件(我是自己写的一个打印HelloWorld的程序),加壳前,文件大小410120字节(upx要求二进制文件加壳前不少于40K),加壳后5564字节,加壳前后均可正常运行
    在这里插入图片描述
  4. 对Linux动态库加壳
    准备一个Linux可执行程序和一个动态库(我是自己写的),加壳前,文件大小409432字节(upx要求so文件加壳前不少于40K)可正常运行。
    在这里插入图片描述
    加壳后,文件大小8260字节,可正常运行。
    在这里插入图片描述
    至此,演示结束,欢迎各位大神指出问题~~~
<think>好的,用户想要查找UPX的下载及使用教程。我需要先整理UPX的相关信息,确保步骤清晰,符合用户的需求。首先,UPX是一个常用的可执行文件压缩工具,用户可能想了解如何下载和安装,以及基本使用命令。 接下来,我得检查提供的引用内容。引用[1]提到了使用UPX脱壳的命令,引用[2]和[3]涉及UPX在Android SO加固和PyInstaller打包中的应用,引用[4]是关于手动改造UPX壳的代码示例。这些引用主要集中在UPX的应用场景和高级用法,用户可能需要基础指导,所以需要补充基础下载和安装步骤。 用户的问题包括下载和使用教程,所以回答应该分步骤说明。首先下载UPX,官方网站是upx.github.io,需要确认用户的操作系统,比如Windows、Linux或macOS。然后安装步骤,解压并配置环境变量。接着是基本使用命令,如压缩、解压、查看帮助,这些在引用[1]中有部分命令,可以引用作为示例。 还要注意用户可能的进阶需求,比如与其他工具结合使用,如PyInstaller(引用[3])或Android加固(引用[2]),可以提到这些场景作为应用实例。另外,引用[4]中的代码可能涉及UPX壳的修改,但用户当前的问题可能不需要深入这些细节,但可以简要提及高级用法作为扩展内容。 需要确保回答结构清晰,分点列出下载、安装、使用步骤,并给出示例命令,同时引用相关的引用来源。最后,生成相关问题时要围绕UPX的下载、使用、优化和应用场景展开,帮助用户进一步探索。</think>### UPX下载及使用指南 UPX(Ultimate Packer for eXecutables)是一款开源的可执行文件压缩工具,支持多平台和文件格式。以下是详细步骤: --- #### **一、下载UPX** 1. **官方渠道** 访问[UPX官网](https://upx.github.io/)选择对应操作系统的版本: - Windows:`upx-版本-win64.zip` - Linux:`upx-版本-amd64_linux.tar.xz` - macOS:`upx-版本-amd64_darwin.tar.xz` [^1] 2. **包管理器安装**(Linux/macOS) - Debian/Ubuntu:`sudo apt install upx` - macOS(Homebrew):`brew install upx` --- #### **二、安装与配置** 1. **解压文件** Windows用户解压后,将`upx.exe`添加到系统环境变量;Linux/macOS用户可直接使用终端命令。 --- #### **三、基础使用命令** 1. **压缩文件** ```bash upx -9 sample.exe # -9表示最高压缩级别 ``` 2. **脱壳操作**(还原文件) ```bash upx -d sample_mal.exe # 引用[1] ``` 3. **查看帮助** ```bash upx --help ``` --- #### **四、进阶应用场景** 1. **与PyInstaller结合** 打包Python程序时添加`--upx-dir`参数以减小体积: ```bash pyinstaller --upx-dir=/path/to/upx main.py # 引用[3] ``` 2. **Android SO文件加固** 编译UPX时需指定依赖库路径(如`UPX_LZMADIR`)[^2]。 --- #### **五、注意事项** - 部分加壳文件可能被反病毒软件误报。 - 修改UPX壳需操作汇编代码(参考引用[4])。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值