Search:  
Gentoo Wiki

KMail/BitDefender

You can configure your favorite file manager, email or news client to use BitDefender Antivirus Scanner for Unices for an instant scan of some file or some email. In some cases this is as simple as a mouse click, key-shortcut or menu selection.

Here is how to use BitDefender Antivirus Scanner for Unices scan the emails from KMail.

BitDefender Antivirus Scanner for Unices

BitDefender Antivirus Scanner for Unices is a versatile antivirus scanning solution, that could be easily integrated in desktop and server software to perform an instant target scan.

You can find more on the BitDefender website.

Add the antivirus filter

Start from Settings → Configure filters.... Add a new filter and name it BitDefender Anti-Virus Check. In the Filter Criteria panel add a rule to select which messages to scan, for example a rule that will scan all messages. In the Filter Actions panel select Pipe Through and fill in the textbox kmail_bitdefender.sh. Then check the boxes Apply to incoming message and Apply on manual filtering. Save the new rule by pressing the OK button

Copy the following script, name it kmail_bitdefender.sh and save it somewhere in your path.

File: kmail_bitdefender.sh
#!/bin/sh
# BitDefender KMail integration script
# Copyright (C) 1996-2006 SOFTWIN SRL. All rights reserved.

# Place this script in your PATH and name it
# kmail_bitdefender.sh, such as: ~/bin/kmail_bitdefender.sh

# Set some parameters
BDSCAN=bdscan
TMPFILE=/tmp/bdkmail_$$

# Save the standard-input to a temporay file
cat > $TMPFILE

# Scan it with BitDefender, filter the output and echo the header
if $BDSCAN $TMPFILE | grep -q infected; then
  echo "X-Virus-Flag: yes"
else
  echo "X-Virus-Flag: no"
fi

# Output the email and remove the temporary file
cat $TMPFILE
rm $TMPFILE

# End of the script

You can customize this filter by yourself. You can add a convenient button on the toolbar, to call the filter on the highlighted message.

Filter actions in KMail

Due to the current KMail structure, the script is called in the Actions section on the filter. That means the only action the filter can do is to add a header stating the message is infected or not. It is up to you to add another filter to check for this header and to perform any desired action.

Retrieved from "http://www.gentoo-wiki.info/KMail/BitDefender"

Last modified: Sat, 06 Sep 2008 15:51:00 +0000 Hits: 4,936