ports/security/w3af/files/patch-w3af_plugins_grep_clamav.py
Kurt Jaeger 951a132e81 security/w3af: 1.0-rc4 -> 1.6.49
- move from SF to new official repo at Github
- set LICENSE_FILE
- add 12 new dependencies
- remove do-patch section
- change BUILD_DEPENDS to RUN_DEPENDS
- apply shebangfix on tools/*
- add DOCS option
- submitter becomes maintainer

PR:		211061
Changes:	https://github.com/andresriancho/w3af/blob/master/doc/CHANGELOG
Submitted by:	Danilo G. Baio <dbaio@bsd.com.br>
2016-08-02 17:29:23 +00:00

70 lines
2.4 KiB
Python

--- w3af/plugins/grep/clamav.py.orig 2015-04-07 15:04:48 UTC
+++ w3af/plugins/grep/clamav.py
@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth
"""
import threading
-import clamd
+import pyclamd
# Installed as a clamd dependency by pip
from six import BytesIO
@@ -55,7 +55,7 @@ class clamav(GrepPlugin):
# User configured settings
# Default for ubuntu installation
- self._clamd_socket = '/var/run/clamav/clamd.ctl'
+ self._clamd_socket = '/var/run/clamav/clamd.sock'
def grep(self, request, response):
"""
@@ -113,7 +113,7 @@ class clamav(GrepPlugin):
"""
try:
cd = self._get_connection()
- return cd.ping() == u'PONG'
+ return cd.ping()
except:
return False
@@ -123,7 +123,7 @@ class clamav(GrepPlugin):
Thought about having a connection pool, but it doesn't make
much sense; plus it adds complexity due to the threads.
"""
- return clamd.ClamdUnixSocket(path=self._clamd_socket)
+ return pyclamd.ClamdUnixSocket(self._clamd_socket)
def _get_clamd_version(self):
"""
@@ -145,7 +145,7 @@ class clamav(GrepPlugin):
try:
cd = self._get_connection()
- result_dict = cd.instream(BytesIO(body))
+ result_dict = cd.scan_stream(body)
except Exception, e:
msg = 'The ClamAV plugin failed to connect to clamd using'\
' the provided unix socket: "%s". Please verify your'\
@@ -185,12 +185,9 @@ class clamav(GrepPlugin):
:return: A namedtuple with the scan result
"""
- try:
- signature = result['stream'][1]
- found = result['stream'][0] == 'FOUND'
- return ScanResult(found, signature)
- except:
- om.out.debug('Invalid response from clamd: %s' % result)
+ signature = result['stream'][1]
+ found = result['stream'][0] == 'FOUND'
+ return ScanResult(found, signature)
def set_options(self, options_list):
self._clamd_socket = options_list['clamd_socket'].get_value()
@@ -232,4 +229,4 @@ class clamav(GrepPlugin):
This plugin was sponsored by http://scoresecure.com/ .
"""
-ScanResult = namedtuple('ScanResult', ['found', 'signature'])
\ No newline at end of file
+ScanResult = namedtuple('ScanResult', ['found', 'signature'])