~racb/ubuntu/precise/modsecurity-apache/988819_2

« back to all changes in this revision

Viewing changes to rules/util/runav.pl

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Gonzalez Iniesta
  • Date: 2011-03-23 18:36:29 UTC
  • Revision ID: james.westby@ubuntu.com-20110323183629-8rwn0362sqqqqbgl
Tags: upstream-2.5.13
ImportĀ upstreamĀ versionĀ 2.5.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
#
 
3
# runav.pl
 
4
# Copyright (c) 2007 Breach Security
 
5
#
 
6
# This script is an interface between ModSecurity and its
 
7
# ability to intercept files being uploaded through the
 
8
# web server, and ClamAV
 
9
 
 
10
 
 
11
$CLAMSCAN = "clamscan";
 
12
 
 
13
if ($#ARGV != 0) {
 
14
    print "Usage: modsec-clamscan.pl <filename>\n";
 
15
    exit;
 
16
}
 
17
 
 
18
my ($FILE) = shift @ARGV;
 
19
 
 
20
$cmd = "$CLAMSCAN --stdout --disable-summary $FILE";
 
21
$input = `$cmd`;
 
22
$input =~ m/^(.+)/;
 
23
$error_message = $1;
 
24
 
 
25
$output = "0 Unable to parse clamscan output [$1]";
 
26
 
 
27
if ($error_message =~ m/: Empty file\.?$/) {
 
28
    $output = "1 empty file";
 
29
}
 
30
elsif ($error_message =~ m/: (.+) ERROR$/) {
 
31
    $output = "0 clamscan: $1";
 
32
}
 
33
elsif ($error_message =~ m/: (.+) FOUND$/) {
 
34
    $output = "0 clamscan: $1";
 
35
}
 
36
elsif ($error_message =~ m/: OK$/) {
 
37
    $output = "1 clamscan: OK";
 
38
}
 
39
 
 
40
print "$output\n";
 
 
b'\\ No newline at end of file'