File: kaspersky-wrapper

package info (click to toggle)
mailscanner 4.79.11-2.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,820 kB
  • ctags: 1,309
  • sloc: perl: 25,655; sh: 2,666; xml: 624; makefile: 242
file content (146 lines) | stat: -rwxr-xr-x 5,181 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/sh

# kaspersky-wrapper --	invoke Kaspersky AV for use with
# 			mailscanner
#
#   MailScanner - SMTP E-Mail Virus Scanner
#   Copyright (C) 2001  Julian Field
#
#   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   The author, Julian Field, can be contacted by email at
#      Jules@JulianField.net
#   or by paper mail at
#      Julian Field
#      Dept of Electronics & Computer Science
#      University of Southampton
#      Southampton
#      SO17 1BJ
#      United Kingdom
#
# $Id: kaspersky-wrapper 4058 2007-07-17 19:32:35Z sysjkf $


# You may want to check this script for bash-isms

PackageDir=$1		# This may vary depending on your OS
shift

# For KAV4FS 5.5
Scanner=kav4fs/bin/kav4fs-kavscanner
if [ -x ${PackageDir}/$Scanner ]; then
  Report=$(tempfile) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
  ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
  if [ "x$1" = "x-IsItInstalled" ]; then
    exit 0
  fi

  Args=`echo "$@" | sed -e 's/ -I/ -i/g; s/^-I/-i/g; s/-- / /g;'`
  rm -f $Report
  # 29/09/05 JKF Removed -j3 on advice from Kaspersky users
  ${PackageDir}/$Scanner $ScanOptions -o$Report -q "$@"
  cat $Report
  rm -f $Report
  exit
fi

# For KAV 5.5.0
Scanner=kav4unix/bin/kavscanner
if [ -x ${PackageDir}/$Scanner ]; then
  Report=$(tempfile) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
  ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
  if [ "x$1" = "x-IsItInstalled" ]; then
    exit 0
  fi

  Args=`echo "$@" | sed -e 's/ -I/ -i/g; s/^-I/-i/g; s/-- / /g;'`
  rm -f $Report
  # 29/09/05 JKF Removed -j3 on advice from Kaspersky users
  ${PackageDir}/$Scanner $ScanOptions -o$Report -q "$@"
  cat $Report
  rm -f $Report
  exit
fi

# For KAV 4.5.0
Scanner=bin/kavscanner
if [ -x ${PackageDir}/$Scanner ]; then
  Report=$(tempfile) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
  ScanOptions="-xp -i0" # Don't report progress, don't attempt to clean
  if [ "x$1" = "x-IsItInstalled" ]; then
    exit 0
  fi

  Args=`echo "$@" | sed -e 's/ -I/ -i/g; s/^-I/-i/g; s/-- / /g;'`
  rm -f $Report
  # 29/09/05 JKF Removed -j3 on advice from Kaspersky users
  ${PackageDir}/$Scanner $ScanOptions -o$Report -q "$@"
  cat $Report
  rm -f $Report
  exit
fi

# Assume still running old version of KAV now
Scanner=kavscanner

# pass this in from mailscanner's config
PF=`echo $0 | sed -e 's/kaspersky-wrapper$//'`kaspersky.prf

# kavscanner (in the copy I have at least) is
# statically linked.
#
#LD_LIBRARY_PATH=$PackageDir
#export LD_LIBRARY_PATH

# I'm only listing ones which we may find useful...

ScanOptions=""
# This first option seems to make no difference to anything.
#ScanOptions="$ScanOptions --"		# disinfect ???
ScanOptions="$ScanOptions -E-"		# don't delete infected files.
ScanOptions="$ScanOptions -MP"		# to check "plain mail format" files 
					# -- I wonder whether this knows TNEF?
ScanOptions="$ScanOptions -MD"		# to check "mail databases"
					# probably Outlook .pst files
ScanOptions="$ScanOptions -P"		# don't check MBR
ScanOptions="$ScanOptions -B"		# don't check boot sectors
ScanOptions="$ScanOptions -H"		# disable heuristic "code analyser"
#ScanOptions="$ScanOptions -U"		# disable unpacking of executables
ScanOptions="$ScanOptions -U-"		# enable unpacking of executables
#ScanOptions="$ScanOptions -A"		# disable archive extracting
ScanOptions="$ScanOptions -A-"		# enable archive extracting
#ScanOptions="$ScanOptions -V"		# enable "redundant scanning" ??
#ScanOptions="$ScanOptions -R"		# don't recurse
ScanOptions="$ScanOptions -R-"		# do recurse
ScanOptions="$ScanOptions -\*"		# scan all files (!!)
ScanOptions="$ScanOptions -O-"		# report nothing for OK files.
#ScanOptions="$ScanOptions -I0"		# what do do on infection... 0 is "just report"
#ScanOptions="$ScanOptions -I2"		# what to do on infection... 2 is "disinfect automatically"
ScanOptions="$ScanOptions -F=$PF"	# use profile (config file)
ScanOptions="$ScanOptions -C"		# stay on filesystem
#ScanOptions="$ScanOptions -LH"		# use symlinks from cmd line
ScanOptions="$ScanOptions -LP"		# skip all symlinks
#ScanOptions="$ScanOptions -LL"		# use all symlinks
ScanOptions="$ScanOptions -W-"		# try to lose cruft
#ScanOptions="$ScanOptions -Y"		# no confirmations (will need once the rest is right)
ScanOptions="$ScanOptions -K-"		# do report on archives etc.

if [ "x$1" = "x-IsItInstalled" ]; then
  [ -x ${PackageDir}/$Scanner ] && exit 0
  exit 1
fi

exec ${PackageDir}/$Scanner $ScanOptions "$@"