I might be mis-understanding what you're saying. I think you're saying that while I could write a virus to break that particular virus protection, it wouldn't necessarily work if the syntax was different?

I think you have that the wrong way round: there will always be ways to break any anti-virus code you try and impliment. If you're writing a virus, you'd find ways around the anti-virus software. This is the nature of regular viruses. It's the anti-virus software companies that need to keep up with the viruses, not the other way around.

I'm no virus expert, but there are ways of infecting someone's code without setting off this kind of warning.

Not all viruses are benign "worms". Some viruses do much worse things than that.

<self-edited because I don't want to give anyone ideas>

You said:
Using file length could be defeated by a virus that deleted the same number of bytes as it adds but this significantly ups the difficulty factor as the virus needs to delete some 'code' without breaking the target file.
Why would someone writing a virus to infect your code necessarily care if it breaks your code?

Personally, I like the idea you propose in your second paragraph tye mentioned earlier. It's not perfect, but here's how I might impliment it:

  1. Write a module, let's call it Virus::Protect, or maybe something less obvious.
  2. the module should do some kind of check - timestamp or md5hash or PGP signed or only allow certain named scripts to be run
  3. Don't show anyone this code.
  4. rename your perl binary to say /vperl(\.exe)?/i
  5. write a shell or batch script called "perl(\.bat)?" which runs the command: vperl -MVirus::Protect %1
  6. Now all your perl scripts will run with the Virus::Protect module and unless you look closely, people might not find out.
Note, I haven't tried this, and of course there will still be ways of hurting my system. But it's a bit more transparent (or less opaque!).

Of course a better solution, would be to unplug your modem\dsl\network cable, rip out your cdrom and floppy drives, and don't let anyone near your machine. But then life would be a bit boring!

Forgive me if I misunderstood. I'm not attacking you, this is a useful discussion. It's just the thought of open-source virus protection software is a bit strange to me, but I'd love to be proven wrong!

$ perldoc perldoc

Update: some minor reformatting to empasise the real points I'm trying to convey, and attributed the virus::protect to tye, since he mentioned something similar in the first reply.

In reply to opensource (friendly anti)virus? by $code or die
in thread Virus protection for Perl scripts by tachyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.