Posted by cariba on 02 12th, 2009


Virusscan (ClamWin) Script for SABnzbd

This script will automatically virus scan downloaded files using the free ClamWin Antivirus package. These instructions are for SABnzbd on Windows.

It will prefix the directory with _VIRUS_ when a virus is found in the downloaded stuff, it won’t delete files but just reminds you that you’ve downloaded hazardous stuff :)

To set this up follow the these steps:

  1. Go to http://your_host:port/sabnzbd/config/directories/
  2. Configure the ‘Folder Containing the User Scripts’ to point to a (possibly new) existing folder.
  3. Go to that folder (using explorer) and create an new text document there and name it ‘clamwinscan.bat’ edit it, and paste the following content:
    @echo off
    set name=%3
    set name=%name:"=%
    set dirname=%1
    set dirname=%dirname:"=%
    
    "C:\Program Files (x86)\ClamWin\bin\clamscan.exe" --tempdir "c:tempclamscan" --keep-mbox --stdout --database="C:\ProgramData\.clamwin\db" --log="c:\temp\clamscan.log" --no-mail --infected --max-files=500 --max-scansize=150000M --max-recursion=5 --max-filesize=100000M --recursive --kill "%dirname%"
    
    @echo %errorlevel%
    if not errorlevel 1 goto novirus
    goto virus
    
    :virus
    echo virus found!
    echo ___WARNING VIRUS FOUND___ > "%dirname%___WARNING VIRUS FOUND___"
    rem make sure the drive letter below matches your download destination drive!!
    c:
    cd "%dirname%"
    cd..
    move "%name%" "_VIRUS_%name%"
    goto end
    
    :novirus
    echo no virus found!
    goto end
    
    :end
  4. Make sure you change the paths of the clamwin installation, database, tempdir, log and drive.
  5. Go to http://your_host:port/sabnzbd/config/switches/ and set the ‘Default User Script’ to ‘clamwinscan.bat’
  6. You’re all set! Besure to check your script output if everything works okay!
Post a Comment


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment