Location: PHPKode > scripts > ANDURAS SurfProtect > anduras-surfprotect/surfprot_avp.inc
<?php

// ====================================================================
// Copyright (c) 2002 by the ANDURAS AG, Passau, Germany.
// ====================================================================
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ====================================================================
// $Id: surfprot_avp.inc,v 1.5 2002/08/16 08:55:06 anders Exp $
// ====================================================================

// ====================================================================
// Configuration begin
// ====================================================================

define(VSCAN_PRG, "/opt/AVP/kavscanner");
define(VSCAN_OPTIONS, "-Y -P -B");
#define(VSCAN_OPTIONS, "-Y -P -B -I2D");

//--------------------------------------------------------------------------
// Scan for virus and return TRUE, if any was found
//--------------------------------------------------------------------------

function call_scanner()
{
  global $filename, $temp_scanlogfile_name, $temp_datafile_name;

  // start AVP-Virus-Scanner
  $cmd = VSCAN_PRG." ".VSCAN_OPTIONS." ".$temp_datafile_name;
  exec($cmd, $output, $ret);

  // write output for log-file
  $fb = fopen($temp_scanlogfile_name, "w");
  for ($i=0; $i<sizeof($output); $i++) fwrite($fb,$output[$i]."\n");
  fclose($fb);

  switch ($ret%16)
  {
    case 0: // No viruses were found
     return SCANNER_NO_VIRUS_FOUND;

    case 1: // Virus scan was not complete
     return SCANNER_ERROR;

    case 3: // Suspicious objects were found
    case 4: // Known viruses were detected
     return SCANNER_VIRUS_FOUND;

    case 5: // All detected viruses have been disinfected
    case 6: // All detected viruses have been deleted
     return SCANNER_VIRUS_FOUND_AND_DISINFECTED;

    case 7: // File kavscanner is corrupted or found same error
    case 8: // Corrupted objects were found
     return SCANNER_ERROR;
  }

  return SCANNER_ERROR;
}

?>
Return current item: ANDURAS SurfProtect