in reply to decompile perlapp 4.1

This works on standard compressed exes from PerlApp 5.3.0, although it's extremely slow (~20KByte/sec) and not hugely helpful (since it doesn't bother reading the filenames), and may not work on PerlApp 4.1; but it does usually work for me, and is marginally better than nothing.
use strict; use warnings; use Compress::Zlib; ++$|; open IN, 'test.exe' or die $!; binmode IN; read IN, my $data, 1e8; my $piecenum=0; my $progress = progress(length $data); my $piecedata; for (0..length($data)-1) { $progress->($_); $piecedata = uncompress("\x78\x9c" . substr $data, $_); if (defined $piecedata) { print "\nFound piece at $_\n"; open OUT, sprintf('>piece_%03d.txt', $piecenum++) or die $!; b +inmode OUT; print OUT $piecedata ^ chr(0xAA) x length $piecedata; } } sub progress { my $max = $_[0]; my $last = 0; return sub { print $last = int(100*$_[0]/$max), "%... " if $last ! += int(100*$_[0]/$max) }; }

Replies are listed 'Best First'.
Re^2: decompile perlapp 4.1
by sorenb (Novice) on Sep 29, 2004 at 10:23 UTC
    Thanks a million times Excors. You have just made me a very happy man! It works perfectly and slow or fast is not a problem for me, I would gladly wait a month to get the code back. ActiveState would not help me at all, so I'm glad you were there to save my life :) And... I will never work on local perl copies anymore, that's for sure! Best regards Soren
Re^2: decompile perlapp 4.1
by Anonymous Monk on Dec 04, 2009 at 12:56 UTC
    made it a bit faster. You need Tie::CharArray, but it is worth the speedup.
    use strict; use warnings; use Tie::CharArray; use Compress::Zlib; ++$|; my $filename = $ARGV[0] || die "usage: need a filename"; if ( ! -f "$filename" ) { print STDERR "couldn't open: $filename\n"; exit(-1); } open IN, $filename or die $!; binmode IN; read IN, my $stringdata, 1e8; tie my @data, 'Tie::CharArray', $stringdata; my $piecenum=0; my $progress = progress(length $stringdata); my $piecedata; for (0..length($stringdata)-1) { $progress->($_); shift(@data); $data[0] = "\x78"; $data[1] = "\x9c"; ( $piecedata = uncompress($stringdata)) || next; print "\nFound piece at $_\n"; open OUT, sprintf('>piece_%03d.txt', $piecenum++) or die $!; binmo +de OUT; print OUT $piecedata ^ chr(0xAA) x length $piecedata; } sub progress { my $max = $_[0]; my $last = 0; return sub { print $last = int(100*$_[0]/$max), "%... " if $last ! += int(100*$_[0]/$max) }; }
Re^2: decompile perlapp 4.1
by Anonymous Monk on Jul 14, 2010 at 07:46 UTC
    You are just wonderful!