Matthew Dettinger wrote:
On 9/8/06, tBB <[EMAIL PROTECTED]> wrote:
> The problem is that clamscan wants the files or directories passed to
> it via the command line, not via stdin-- besides which, Windows has a
> fairly limited max length for the command line.
Actually it's not that limited (but still too limited for this purpose I
guess). Windows XP/2k3 has a max command line length of 8191 characters
and Win2k/NT has a limit of 2047. However, if the list of files can be
provided externally it's not much of a problem. A simple .bat should do:
@echo off
for /F %%a in (files_to_scan.list) do clamdscan.exe %%a
This example works for one filename per line. If you rather prefer to
separate the filenames by some character, let's say ";" it would look
like:
for /F "delims=;" %%a in (files_to_scan.list) do clamdscan.exe %%a
Best regards, Nico
So ultimately clamscan.exe will not take stdin. I will just have to run it
like you state above... multiple time! By reloading clamscan.exe in and out
of memory for every file at which point am I better off just scanning the
entire drive recursively?
Thanks again for every ones insight!
A simple Perl script that makes a socket connection to Clamd can be
written that is run once per scan. It can read a pre-made list of files
to scan or it can crawl the hard disk (very inefficient) to build a
list. The Perl script can then walk the array of files and submit them
one at a time to Clamd. Clamd has to run as administrator so that it can
open any files given to it. This is also true for Python, PHP, and even
VB. You just need a socket-capable language.
This avoids reloading clamscan thousands of times, or scanning file
system areas that don't require scanning.
dp
_______________________________________________
http://lurker.clamav.net/list/clamav-users.html