Tuesday, November 3, 2009

A (crazy) PHP AntiVirus

I often find myself unsatisfied of what my antivirus can detect, so I often wish I can tell my antivirus, hey! delete all files like this one, everything identical with this file should be deleted! delete them all.

But, I didn't found anything like that, and I am a PHP programmer, and I can't do anything? So one night I started to create a simple antivirus program using PHP. So I created it, but lol, what's the sense? I bet it can only be used on localhost, so I won't be able to share it.

It simply compare contents of files from the virus signatures folder, one by one, but of course, for efficiency, it also records the file sizes, making it possible to check for possible threats, without really opening the contents of the files that is currently on scan, that makes it more efficient

The next problem will be, how to make it run continously, overcoming the maximum execution time, which is, by default, is 60 seconds, and on free webhosts, 30 seconds. Well implementing it on another host will popup another problem that I will figure out later.

This maximum execution time problem is defeated by using ajax and jquery, by using the $().replace which creates a chain reaction of ajax. And by using a get parameter that tells where the scan stopped, that will be used as "bookmark", that will be used to indicate where the script should start scanning.

I actually slept accidentally, and in the morning, I have found out that the script actually still runs, and it really ran continously, which is nice, just like a real antivirus

The funny part is, my (real)antivirus deletes my php antivirus' quarantine, *lol* . But I got i fixed later on by making the file extension not to be scanned. I actually always changed the file extensions of my virus collection( I actually call them pokemons sometimes ) into ".dangerous" so that it would say under the file name "DANGEROUS FILE" *lol*. After this all went right.

But in the end, what's the use of this PHP antivirus anyway? I dunno, but I know I can use this to scan my files with new threats that my antivirus can't detect as threat. If you find it to be useful for yourself, hmm maybe leave a comment

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home