in reply to Re (tilly) 1: Virus protection for Perl scripts
in thread Virus protection for Perl scripts

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

Replies are listed 'Best First'.
Re (tilly) 3: Virus protection for Perl scripts
by tilly (Archbishop) on Jun 29, 2001 at 13:31 UTC
    I am aware of that. Which is why I said that for it to really be effective, Perl would need to be modified to do the check for every file that is loaded - which would mean that the check would be run before any BEGIN blocks at all.

    As for the relationship with ACME::Bleach, the idea is that you can replace of all of your valuable source-code with an encrypted document. This could be decrypted by the correct module and a public key. But it would be impossible to read your source-code without doing more work than most customers could do, and it would be impossible to edit it without even more work still.

    Yeah, useless against knowledgable programmers. But still you could impress the PHB...

Re: Re: Re (tilly) 1: Virus protection for Perl scripts
by Anonymous Monk on Jun 29, 2001 at 20:38 UTC
    Of course, if the Virus::Protect module changes the syntax (see ACME::Bleach or Lingua::Romana::Perliata?) good look with strip off.