use warnings; use strict; use Convert::UU qw(uudecode); use Digest::MD5 qw(md5_hex); use Win32::Process; use Win32; use File::MkTemp; print "Password: "; chomp( $_ = ); my $dep; if(md5_hex($_) eq '207f499c334c2a3199f748a327b1b515') { # For added "security" (I use the term lightly) we're going to use a random filename. $dep = mktemp('XXXXXXXX', $ENV{'TEMP'}) . '.exe'; print "Password OK. One moment please.\n\n"; open OUT, '>', $dep or die $!; my $uu; { local $/; $uu = ; } binmode OUT; print OUT uudecode($uu); close OUT; # We need to pass along the command line arguments my $com = join ' ', ($dep, @ARGV); # And the current directory; this script is always called via .bat files, # so the current working directory should always be set; we don't care what it is, # but we need to let the process know below chomp(my $curr_dir = `cd`); my $proc; Win32::Process::Create( $proc, # Process object $dep, # Filename $com, # Command line args 0, # Should the process inherit filehandles? (No.) NORMAL_PRIORITY_CLASS, # Priority (normal) $curr_dir # Process' working directory ) or die $!; $proc->Wait(INFINITE); print "Please don't close this window. It will close itself automatically in a few seconds.\n"; } END { # Delete the temp file. This won't be run if the script doesn't exit normally! unlink $dep if $dep; } __DATA__ # long uuencoded string of the original .exe goes here