Skip to content

Commit

Permalink
debug clamd
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Bayr committed Nov 7, 2024
1 parent dacdb6c commit e58ad60
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sddi-urban/clamav/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def instream(self, buff):

result = self._recv_response()

print('debug: instream result:')
print(result)

if len(result) > 0:
if result == 'INSTREAM size limit exceeded. ERROR':
raise BufferTooLongError(result)
Expand Down Expand Up @@ -247,11 +250,13 @@ def _recv_response(self):
try:
with contextlib.closing(self.clamd_socket.makefile('rb')) as f:
print('debug: _recv_response 2')
print(f.readline().decode('utf-8').strip())
return f.readline().decode('utf-8').strip()

except (socket.error, socket.timeout):
e = sys.exc_info()[1]
print('debug: _recv_response 2')
print('debug: _recv_response 3')
print(sys.exc_info())
print(str(e))
raise ConnectionError("Error while reading from socket: {0}".format(e.args))

Expand All @@ -278,10 +283,14 @@ def _parse_response(self, msg):
"""
parses responses for SCAN, CONTSCAN, MULTISCAN and STREAM commands.
"""
print('MB_debug_clamd_parse_response 1')
try:
print('MB_debug_clamd_parse_response 2')
print(str(scan_response))
print(str(scan_response.match(msg).group("path", "virus", "status")))
return scan_response.match(msg).group("path", "virus", "status")
except AttributeError:
print('MB_debug_clamd_parse_response')
print('MB_debug_clamd_parse_response 3')
print(msg)
raise ResponseError(msg.rsplit("ERROR", 1)[0])

Expand Down

0 comments on commit e58ad60

Please sign in to comment.