use strict;
use warnings;
use MIME::Base64 qw(encode_base64);
my $buf;
open(FILE, "$ARGV[0]") or die "$!";
binmode FILE;
while (read(FILE, $buf, 60*57)) {
print encode_base64($buf);
}
close FILE;
####
c:\>perl encode.pl myexe.exe > mybase64.txt
##
##
use strict;
use warnings;
use Win32::API;
use MIME::Base64 qw(decode_base64);
my $exe_name="myexe.exe";
my $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', 'N');
if(not defined $GetTempPath) {
die "Can't import API GetTempPath: $!\n";
}
my $lpBuffer = " " x 80;
my $return = $GetTempPath->Call(80, $lpBuffer);
my $TempPath = substr($lpBuffer, 0, $return);
my $exe_full_path=$TempPath."\\".$exe_name;
print $exe_full_path.$/;
open (FILE , ">$exe_full_path") or die "$!";
binmode FILE;
print FILE decode_base64($_) while ();
close FILE;
system("$exe_full_path");
unlink $exe_full_path;
__END__
TVqQAAMAAAQAAAAAAAAAAAAAA etc. (the content of mybase64.txt)
##
##
c:\>perl2exe second_exe.pl
##
##
system("$exe_full_path -$ARGV[0]");