A short script to scan files or directories with ClamAV.
It provides the ability to scan multiple files, a progress-dialog and a result window.

You need to have ClamAV installed.
If you encounter any issues when using the graphical way extract the file and run "sh install.sh".

All files are installed in the users home directory (/home/[user]/.kde[4]/share/kde4/services/ServiceMenus/ClamScan/), there is no need to use su or sudo to install

Note:
The script is currently translated in English, Finnish, French, German, Indonesian, Italian, Russian, Spanish, Swedish, Turkish and Ukrainian.
If you wish another language, translate the following and leave me a message or write it in a comment:
Name[en]=Scan with ClamAV
wait="ClamAV is scanning, please wait."
not_found="ClamAV is not installed!"
scan_sentence="Scanning files: "

ClamScan shell script update needed

A small thing, but the ClamScan.sh file still includes the line 'version=2.5.5', which is confusing for version 2.5.7, as the KDialog box title bar includes the version number
It also doesn't display the full result of the scan, just 'Result' with a dotted line underneath. The log for the day, and the individual scan logs have the full details though.

I've manually applied the patch and still the progress bar does not update at all.
Can you help me, please?

Re: Re: Progress Bar

So let's see what the problem is here. The script actually checks the amount of lines in the file

"$spath"/ServiceMenus/ClamScan/logs/ClamScan_$date.log

each scanned file creates exactly one new line in that file, so if the amount of lines in the file == amount of all selected files the progressbar should be 100% (or x of x files).
Does the mentioned file exist on your computer (is it creating while scanning)?

Yes, it is created and the files are added to it (it is automatically removed when I close the popup which contains the scan results).

Re: Progress Bar

I found there was a significant overhead in using clamscan for scanning small numbers of files.

On my system it takes about 7.318 secs to load the dictionary and scan the smallest file in a directory. Whereas if I scan all 11 files in the directory clamscan takes 7.785 secs so really it takes only 0.467 secs to scan the 11 files.

How this may be represented in the progress bar is that it displays the bar waits 7.318 secs at 0% then progresses to 100% in the remaining 0.467 secs them closes. Is this what you see?

I think this was one of the reasons I swapped over to using clamdscan.

In this scenario the progress bar might not register anything for the first 7 secs and then

Re: Re: Progress Bar

This is actually a wanted behaviour. The progressbar is set to for example 1300, if you scan 1300 files. A small file will also count as much as a big file for the progressbar. It would be possibly to change that behavior but it would increase the amount of code. For example you could check how big the single files are (in order of the scanned files) and give the single lines a relative count (the script checks the lines of the log file: 1 more line in the log file is +1 for the progressbar until amount of lines = amount of selected files = length of the progressbar.

Might be a problem with DBus.

clamdscan

AS it stands the script ClamScan.sh uses clamscan as the scanner.

As I have clamd running I've amended the script ClamScan.sh to use clamdscan instead. Needed a bit of rework to cater for the differences in the information they write to the log files and of course clamd must be running.

The time to scan has reduced quite significantly. I tested on a directory with 1210 files and 9 sub-directories with a size of 3.2G, in the directory there were 19 infected files. My machine is 10 years old with P4 and 2G of memory.

Using clamscan it took on average 14 mins.

Clamdscan took on average 2.5 minutes.

Not quite sure what to do with it. Let me know whoever might be interested. It doesn't cater for symbolic links. So really this is just a heads up.

Alex

Re: clamdscan

The thought behind using clamscan instead of clamdscan is that not everybody is running or using clamdscan. Not sure if at the mean time something changed about that, but it was at least not easy back in that time to set up clamdscan, at least clamscan was running out of the box.

A possible fix for this would be to let the script check if clamdscan is running and if yes to prefer that one.

How do you like Plasma 5? The best KDE Desktop ever. Definitely a nice improvement. Not decided yet. Haven't tried it yet. I do not like some of the changes. KDE is taking the wrong way. I am still sticking with KDE 3.5. I have no opinion, but wanted to vote anyway.

Copyright 2001-2015 KDE-Look.org Team All rights reserved. KDE-Look.org is not liable for any content or goods on this site.All contributors are responsible for the lawfulness of their uploads.KDE and K Desktop Environment are trademarks of KDE e.V.