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) };
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.