[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: scan repository for viruses

From: jehan procaccia <jehan.procaccia_at_it-sudparis.eu>
Date: Fri, 21 Nov 2008 12:14:24 +0100

jehan procaccia a écrit :
> jehan procaccia wrote:
>> I like this one:
>> "Can't you just svnlook cat -t each file?"
>> if you have a complete command sample with a pipe to clamav , that
>> would same me hours searching how to do it ;-) .
> Ok, it took me a certain time (mostly with svnlook rather than clamav
> ...), but I finnaly get it ;-)
> "svnlook cat each files and pipe the output to clamav antivirus"
> exemple:
> [root_at_svnserver /data2/svn/repos/test4/db]
> $ svnlook cat /data2/svn/repos/test4 "New Document Microsoft Office
> Word.docx" | clamscan -
>
> Now I'll try to figure out how to write a script that gets a list of
> all files in the repository (possibly "svnlook tree") to feed "svnlook
> cat" in the first place .
For your Information, I finnaly wrote a script to scan the whole
repository for virus, if it can help someone else ...

1) Get the full path list of files of the repository affected by viruses
$ svnlook tree --full-paths /svn/repos/repoName >
/tmp/repoName-file-list.txt

2) write a script that scan each files in the list above
$ cat /root/svn-clamscan.sh
#!/bin/bash
while read x
do
echo "____NEXT_FILE_____"
echo $x
svnlook cat /svn/repos/repoName "$x" | clamscan -
done < /tmp/repoName-file-list.txt

3) start it
$ time sh /root/svn-clamscan.sh > /tmp/clamscan-result-repoName.txt

4) check it
$ grep "Infected files" /tmp/clamscan-result-repoName.txt | more

the whole thing could be more automated by creating input varaibles
(repoName for example) but I didn't had to do it has I needed to scan
only 2 repos .

hope it helps .. at least me next time ;-) .
Bye .

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-11-21 12:15:07 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.