Permalink
Browse files

virusscan.py: add ISO8601 signature date

  • Loading branch information...
1 parent 2cbf33f commit 14c11d040bd3dfc8432d2a8d93fc7a78a27d45b9 @anarchivist committed Feb 5, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 python/virusscan.py
View
@@ -7,14 +7,18 @@
import sys
from optparse import OptionParser
from pyclamd import pyclamd
+import dateutil.parser
def virusscan(fn, method='socket', socket='/tmp/clamd.socket'):
out = {}
if method != 'socket':
raise NotImplementedError
else:
clam = pyclamd.ClamdUnixSocket(filename=socket)
- out['virusScannerVersion'], out['virusScannerSignatureVersion'], out['virusScannerSignatureDate'] = clam.version().split('/')
+ vers = clam.version().split('/')
+ out['virusScannerVersion'] = vers[0]
+ out['virusScannerSignatureVersion'] = vers[1]
+ out['virusScannerSignatureDate'] = dateutil.parser.parse(vers[2]).strftime("%Y-%m-%dT%H:%M:%S")
vscan = clam.scan_file(fn)
if vscan is None:
out['virusFound'] = 'false'

0 comments on commit 14c11d0

Please sign in to comment.