A use Virus::Protect; strategy would easily be circumvented by:
BEGIN { local $/; open ME,"+<$0"; $_ = <ME>; s/#use\s+Virus::Protect\s*;\s*\n//; s/BEGIN {.+?Virus::Protect.+?\n}//s; seek ME,0,0; truncate ME,0; print ME $_; close ME; eval $_; exit; } #use Virus::Protect; print "Hello World!\n";
If a postulated virus inserted this BEGIN block it would erase the postulated use Virus::Protect line and the BEGIN block. That is why I did not wrap the sample code in a module. It needs to be modified (polymorphic) to be effective - see comments below. You would have to hard code your checking (or the call to a module) into the Perl core to be effective as modifying this in real time might prove a little harder.
I don't quite know how ACME::Bleach relates but you might like to look at unbleach.pl :-)
cheers
tachyon
In reply to Re: Re (tilly) 1: Virus protection for Perl scripts
by tachyon
in thread Virus protection for Perl scripts
by tachyon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |