Remove src/stub/scripts/UNUSED.
This commit is contained in:
@@ -1,50 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
#
|
|
||||||
# asl_m68k.sh --
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
# Copyright (C) 1996-2015 Laszlo Molnar
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
# <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# wrapper for the ASL cross-assembler (version 1.42bld43)
|
|
||||||
# http://john.ccac.rwth-aachen.de:8000/as/
|
|
||||||
# http://john.ccac.rwth-aachen.de:8000/ftp/as/source/c_version/
|
|
||||||
|
|
||||||
file="$1"
|
|
||||||
test -f "$file" || exit 1
|
|
||||||
|
|
||||||
ofile=`echo "$file" | sed 's/\.[a-z]*$/.o/'`
|
|
||||||
|
|
||||||
# convert ' to " in dc.x statements
|
|
||||||
perl -p -i -e '
|
|
||||||
s,\x27,",g if m,^\s*dc\.,;
|
|
||||||
' "$file"
|
|
||||||
|
|
||||||
echo asl -q -xC -U -cpu 68000 -o "$ofile" -L "$file"
|
|
||||||
asl -q -xC -U -cpu 68000 -o "$ofile" -L "$file"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
#
|
|
||||||
# bin2h.pl --
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
# Copyright (C) 1996-2015 Laszlo Molnar
|
|
||||||
# Copyright (C) 2000-2015 John F. Reiser
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
# <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
use Compress::Zlib;
|
|
||||||
|
|
||||||
$delim = $/;
|
|
||||||
undef $/; # undef input record separator - read file as a whole
|
|
||||||
|
|
||||||
$ifile = shift || die;
|
|
||||||
$ident = shift || die;
|
|
||||||
$ofile = shift || die;
|
|
||||||
|
|
||||||
$opt_q = "";
|
|
||||||
$opt_q = shift if ($#ARGV >= 0);
|
|
||||||
|
|
||||||
# open ifile
|
|
||||||
open(INFILE,$ifile) || die "open $ifile\n";
|
|
||||||
binmode(INFILE);
|
|
||||||
|
|
||||||
# check file size
|
|
||||||
@st = stat($ifile);
|
|
||||||
if (1 && $st[7] <= 0) {
|
|
||||||
print STDERR "$ifile: ERROR: empty file\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (1 && $st[7] > 64*1024) {
|
|
||||||
print STDERR "$ifile: ERROR: file is too big (${st[7]} bytes)\n";
|
|
||||||
if ($ifile =~ /^fold/) {
|
|
||||||
print STDERR " (please upgrade your binutils to 2.12.90.0.15 or better)\n";
|
|
||||||
}
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
# read whole file
|
|
||||||
$data = <INFILE>;
|
|
||||||
close(INFILE) || die;
|
|
||||||
$n = length($data);
|
|
||||||
die if ($n != $st[7]);
|
|
||||||
|
|
||||||
# open ofile
|
|
||||||
open(OUTFILE,">$ofile") || die "open $ofile\n";
|
|
||||||
binmode(OUTFILE);
|
|
||||||
select(OUTFILE);
|
|
||||||
|
|
||||||
$if = $ifile;
|
|
||||||
$if =~ s/.*[\/\\]//;
|
|
||||||
$of = $ofile;
|
|
||||||
$of =~ s/.*[\/\\]//;
|
|
||||||
|
|
||||||
if ($opt_q ne "-q") {
|
|
||||||
printf ("/* %s -- created from %s, %d (0x%x) bytes\n", $of, $if, $n, $n);
|
|
||||||
print <<"EOF";
|
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
Copyright (C) 1996-2015 Laszlo Molnar
|
|
||||||
Copyright (C) 2000-2015 John F. Reiser
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
|
||||||
and/or modify them 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.
|
|
||||||
|
|
||||||
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
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING.
|
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
<markus\@oberhumer.com> <ml1050\@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
$s = $ident;
|
|
||||||
$s =~ tr/a-z/A-Z/;
|
|
||||||
printf("#define %s_SIZE %d\n", $s, $n);
|
|
||||||
printf("#define %s_ADLER32 0x%08x\n", $s, &adler32($data));
|
|
||||||
printf("#define %s_CRC32 0x%08x\n", $s, &crc32($data));
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
printf("unsigned char %s[%d] = {", $ident, $n);
|
|
||||||
for ($i = 0; $i < $n; $i++) {
|
|
||||||
if ($i % 16 == 0) {
|
|
||||||
printf(" /* 0x%4x */", $i - 16) if $i > 0;
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
printf("%3d", ord(substr($data, $i, 1)));
|
|
||||||
print "," if ($i != $n - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (($i % 16) != 0) {
|
|
||||||
$i++;
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
printf(" /* 0x%4x */", $i - 16);
|
|
||||||
|
|
||||||
print "\n};\n";
|
|
||||||
|
|
||||||
close(OUTFILE) || die;
|
|
||||||
select(STDOUT);
|
|
||||||
|
|
||||||
undef $delim;
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
# vi:ts=4:et
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# bin2w.sh
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008-2015 John F. Reiser
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# John F. Reiser
|
|
||||||
# <jreiser@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
# Convert binary 4-byte integers to assembler input.
|
|
||||||
# Endian-ness will be handled by the assembler.
|
|
||||||
|
|
||||||
od -Ax -tx4 |
|
|
||||||
sed -e '
|
|
||||||
/^\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\)$/ {
|
|
||||||
s//\/*0x\1*\/ .long 0x\2,0x\3,0x\4,0x\5/p
|
|
||||||
d
|
|
||||||
}
|
|
||||||
/^\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\)$/ {
|
|
||||||
s//\/*0x\1*\/ .long 0x\2,0x\3,0x\4/p
|
|
||||||
d
|
|
||||||
}
|
|
||||||
/^\([^ ]*\) \([^ ]*\) \([^ ]*\)$/ {
|
|
||||||
s//\/*0x\1*\/ .long 0x\2,0x\3/p
|
|
||||||
d
|
|
||||||
}
|
|
||||||
/^\([^ ]*\) \([^ ]*\)$/ {
|
|
||||||
s//\/*0x\1*\/ .long 0x\2/p
|
|
||||||
d
|
|
||||||
}
|
|
||||||
/^\([^ ]*\)$/ {
|
|
||||||
s//\/*0x\1*\//p
|
|
||||||
d
|
|
||||||
}
|
|
||||||
'
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
#
|
|
||||||
# o2bin.pl --
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
# Copyright (C) 1996-2015 Laszlo Molnar
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
# <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
$delim = $/;
|
|
||||||
undef $/; # undef input record separator - read file as a whole
|
|
||||||
|
|
||||||
$ifile = shift || die;
|
|
||||||
$ofile = shift || die;
|
|
||||||
$x_start = shift || die;
|
|
||||||
$x_end = shift || die;
|
|
||||||
|
|
||||||
# read whole file
|
|
||||||
open(INFILE,$ifile) || die "$ifile\n";
|
|
||||||
binmode(INFILE);
|
|
||||||
$data = <INFILE>;
|
|
||||||
close(INFILE) || die;
|
|
||||||
|
|
||||||
# delete everything up to 'UPX1'
|
|
||||||
die if ($data =~ s/^.*${x_start}//s) != 1;
|
|
||||||
|
|
||||||
# delete everything from 'UPX9'
|
|
||||||
die if ($data =~ s/${x_end}.*$//s) != 1;
|
|
||||||
|
|
||||||
# write file
|
|
||||||
open(OUTFILE,">$ofile") || die "$ofile\n";
|
|
||||||
binmode(OUTFILE);
|
|
||||||
if ($ofile =~ /\.(db)$/i) {
|
|
||||||
# asm "db xx" output
|
|
||||||
$n = length($data);
|
|
||||||
$l = 16;
|
|
||||||
for ($i = 0; $i < $n; ) {
|
|
||||||
print OUTFILE "db " if ($i % $l == 0);
|
|
||||||
printf OUTFILE ("%d", ord(substr($data, $i, 1)));
|
|
||||||
++$i;
|
|
||||||
if ($i == $n || $i % $l == 0) {
|
|
||||||
print OUTFILE "\n";
|
|
||||||
} else {
|
|
||||||
print OUTFILE ",";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print OUTFILE $data;
|
|
||||||
}
|
|
||||||
close(OUTFILE) || die;
|
|
||||||
|
|
||||||
undef $delim;
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
# vi:ts=4:et
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
#
|
|
||||||
# setfold.pl -- set Elf32_Phdr[1].p_offset
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000-2015 John F. Reiser
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
# <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# John F. Reiser
|
|
||||||
# <jreiser@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
$fname = shift || die;
|
|
||||||
sysopen (FH,$fname,2) || die;
|
|
||||||
binmode FH;
|
|
||||||
|
|
||||||
$fsize = (stat($fname))[7];
|
|
||||||
|
|
||||||
$val = shift || die "$val";
|
|
||||||
###print STDERR "$val\n";
|
|
||||||
$val = oct($val); # acutally hex()
|
|
||||||
$val = $val & 0xfff;
|
|
||||||
printf STDERR "setfold info: $fname: setting fold to 0x%x, file size 0x%x\n", $val, $fsize;
|
|
||||||
die unless $val > 0;
|
|
||||||
die unless $val < $fsize;
|
|
||||||
$num = pack("V", $val);
|
|
||||||
|
|
||||||
# 0x34 = sizeof(Elf32_Ehdr)
|
|
||||||
# 0x20 = sizeof(Elf32_Phdr)
|
|
||||||
# 4 = offset(p_offset)
|
|
||||||
sysseek (FH,0x34+0x20+4,0) || die;
|
|
||||||
|
|
||||||
syswrite (FH,$num,4) || die;
|
|
||||||
|
|
||||||
close(FH) || die;
|
|
||||||
exit 0;
|
|
||||||
|
|
||||||
# vi:ts=4:et
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
#
|
|
||||||
# setfold.sh --
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
# Copyright (C) 1996-2015 Laszlo Molnar
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
# <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
file="$1"
|
|
||||||
|
|
||||||
# get directory of this script
|
|
||||||
bindir=`echo "$0" | sed -e 's|[^/][^/]*$||'`
|
|
||||||
bindir=`cd "$bindir" && pwd`
|
|
||||||
|
|
||||||
sstrip="./util/sstrip/sstrip"
|
|
||||||
test -x "$sstrip" || sstrip="$bindir/../util/sstrip/sstrip"
|
|
||||||
|
|
||||||
# get address of symbol "fold_begin"
|
|
||||||
fold=`nm -f bsd "$file" | grep fold_begin | sed 's/^0*\([0-9a-fA-F]*\).*/0x\1/'`
|
|
||||||
|
|
||||||
# strip
|
|
||||||
objcopy -S -R .comment -R .note "$file"
|
|
||||||
"$sstrip" "$file"
|
|
||||||
|
|
||||||
# patch address
|
|
||||||
perl -w "$bindir/setfold.pl" "$file" "$fold"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
#
|
|
||||||
# stripelf.pl -- strip section headers from an ELF executable
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
# Copyright (C) 1996-2015 Laszlo Molnar
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
# <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Strip section headers from the Linux stub. Section headers are
|
|
||||||
# optional for executables, but nevertheless binutils (2.9.1.0.25)
|
|
||||||
# complain with a "File format not recognized" error.
|
|
||||||
# Looks like a bug in binutils to me.
|
|
||||||
#
|
|
||||||
# A positive side effect of this is that `strip' cannot ruin an UPX
|
|
||||||
# compressed file any longer.
|
|
||||||
#
|
|
||||||
|
|
||||||
$fname = shift || die;
|
|
||||||
sysopen (FH,$fname,2) || die;
|
|
||||||
binmode FH;
|
|
||||||
|
|
||||||
sysseek (FH,0x20,0) || die;
|
|
||||||
sysread (FH,$num,4) || die;
|
|
||||||
$shpos = unpack ("V",$num); # e_shoff
|
|
||||||
|
|
||||||
sysseek (FH,0x2e,0) || die;
|
|
||||||
sysread (FH,$num,2) || die;
|
|
||||||
$ssize = unpack ("v",$num); # e_shentsize
|
|
||||||
|
|
||||||
sysseek (FH,0x32,0) || die;
|
|
||||||
sysread (FH,$num,2) || die;
|
|
||||||
$idx = unpack ("v",$num); # e_shstrndx
|
|
||||||
|
|
||||||
sysseek (FH,$shpos + $idx * $ssize + 16,0) || die;
|
|
||||||
sysread (FH,$num,4) || die;
|
|
||||||
$neweof = unpack ("V",$num); # sh_offset of the e_shstrndx section
|
|
||||||
|
|
||||||
$num = pack ("x6");
|
|
||||||
sysseek (FH,0x20,0) || die;
|
|
||||||
syswrite (FH,$num,4) || die; # clear e_shoff
|
|
||||||
|
|
||||||
if (1) {
|
|
||||||
sysseek (FH,0x2e,0) || die;
|
|
||||||
syswrite (FH,$num,6) || die; # clear e_shentsize, e_shnum & e_shstrndx
|
|
||||||
} else {
|
|
||||||
sysseek (FH,0x30,0) || die;
|
|
||||||
syswrite (FH,$num,4) || die; # clear e_shnum & e_shstrndx
|
|
||||||
}
|
|
||||||
|
|
||||||
truncate (FH,$neweof) || die;
|
|
||||||
close(FH) || die;
|
|
||||||
|
|
||||||
print STDOUT "$0: truncated $fname to $neweof bytes.\n";
|
|
||||||
exit 0;
|
|
||||||
|
|
||||||
# vi:ts=4:et
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
#
|
|
||||||
# version.pl -- convert version.h into version.asy
|
|
||||||
#
|
|
||||||
# This file is part of the UPX executable compressor.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
# Copyright (C) 1996-2015 Laszlo Molnar
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# UPX and the UCL library are free software; you can redistribute them
|
|
||||||
# and/or modify them 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.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.
|
|
||||||
# If not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
# <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
$mode = shift || "--nasm";
|
|
||||||
while (<>) {
|
|
||||||
chop;
|
|
||||||
s/\s+$//;
|
|
||||||
if (/^\s*\#\s*define\s+(.*)/) {
|
|
||||||
print "%define $1\n" if ($mode eq "--nasm");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit (0);
|
|
||||||
|
|
||||||
# vi:ts=4:et
|
|
||||||
Reference in New Issue
Block a user