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 6, 2024
1 parent 1bce773 commit 2570126
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions sddi-urban/clamav/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,38 +190,26 @@ def instream(self, buff):
chunk = buff.read(max_chunk_size)

while chunk:
print('-------------')
print('XXXXXXXXXXX 1')
size = struct.pack(b'!L', len(chunk))
print('XXXXXXXXXXX 2')
print(len(chunk))
self.clamd_socket.send(size + chunk)
chunk = buff.read(max_chunk_size)
print('XXXXXXXXXXX 3')
f = open('/srv/app/data/MB_clamav_instream_01', 'w')
f.writelines("XXXXXXXXXXX 3 chunk\n")
f.writelines(str(len(chunk)))
f.writelines('\n')
f.writelines(str(chunk))
f = open('/srv/app/data/clamd_instream', 'w')
f.write("prevent timeout error")
f.close()

self.clamd_socket.send(struct.pack(b'!L', 0))

print('XXXXXXXXXXX 4')
f = open('/srv/app/data/MB_clamav_instream_02', 'w')
f.writelines("XXXXXXXXXXX 4 socket.send")
f.close()
#f = open('/srv/app/data/MB_clamav_instream_02', 'w')
#f.writelines("XXXXXXXXXXX 4 socket.send")
#f.close()

result = self._recv_response()

print('XXXXXXXXXXX 5')
print('clamav scan successfull')

if len(result) > 0:
if result == 'INSTREAM size limit exceeded. ERROR':
raise BufferTooLongError(result)

print('XXXXXXXXXXX 6')

raise BufferTooLongError(result)

filename, reason, status = self._parse_response(result)
return {filename: (status, reason)}
Expand Down

0 comments on commit 2570126

Please sign in to comment.