Update autorecon.py

Fixes #68

Instead of messing around with limits, we should ignore any line longer than 64 KiB, as it is likely invalid data of some kind anyway.
This commit is contained in:
Tib3rius 2021-08-03 00:08:40 -04:00
parent 62a87f9696
commit 24f71534dd
1 changed files with 6 additions and 1 deletions

View File

@ -161,7 +161,12 @@ class CommandStreamReader(object):
while True: while True:
if self.stream.at_eof(): if self.stream.at_eof():
break break
line = (await self.stream.readline()).decode('utf8').rstrip() try:
line = (await self.stream.readline()).decode('utf8').rstrip()
except ValueError:
error('{blue}[{bright}' + self.target.address + '/' + self.tag + '{srst}]{crst} A line was longer than 64 KiB and cannot be processed. Ignoring.')
continue
if self.target.autorecon.config['verbose'] >= 2: if self.target.autorecon.config['verbose'] >= 2:
if line != '': if line != '':
info('{blue}[{bright}' + self.target.address + '/' + self.tag + '{srst}]{crst} ' + line.replace('{', '{{').replace('}', '}}')) info('{blue}[{bright}' + self.target.address + '/' + self.tag + '{srst}]{crst} ' + line.replace('{', '{{').replace('}', '}}'))