Merge pull request #27 from mpgn/neff-bugfixes
Stop crashing with "Too many open files" and fixing the missing logger errormain
commit
ca30e86540
|
@ -28,6 +28,18 @@ from sys import exit
|
|||
import logging
|
||||
import sqlalchemy
|
||||
from rich.progress import Progress
|
||||
from sys import platform
|
||||
|
||||
# Increase file_limit to prevent error "Too many open files"
|
||||
if platform != "win32":
|
||||
import resource
|
||||
file_limit = list(resource.getrlimit(resource.RLIMIT_NOFILE))
|
||||
if file_limit[1] > 10000:
|
||||
file_limit[0] = 10000
|
||||
else:
|
||||
file_limit[0] = file_limit[1]
|
||||
file_limit = tuple(file_limit)
|
||||
resource.setrlimit(resource.RLIMIT_NOFILE, file_limit)
|
||||
|
||||
try:
|
||||
import librlers
|
||||
|
|
|
@ -606,8 +606,12 @@ class smb(connection):
|
|||
)
|
||||
self.smbv1 = False
|
||||
except socket.error as e:
|
||||
# This should not happen anymore!!!
|
||||
if str(e).find("Too many open files") != -1:
|
||||
self.logger.error(f"SMBv3 connection error on {self.host if not kdc else kdc}: {e}")
|
||||
if not self.logger:
|
||||
print("DEBUG ERROR: logger not set, please open an issue on github: " + str(self) + str(self.logger))
|
||||
self.proto_logger()
|
||||
self.logger.fail(f"SMBv3 connection error on {self.host if not kdc else kdc}: {e}")
|
||||
return False
|
||||
except (Exception, NetBIOSTimeout) as e:
|
||||
self.logger.info(f"Error creating SMBv3 connection to {self.host if not kdc else kdc}: {e}")
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -53,6 +53,7 @@ aiosqlite = "^0.18.0"
|
|||
pyasn1-modules = "^0.3.0"
|
||||
rich = "^13.3.5"
|
||||
python-libnmap = "^0.7.3"
|
||||
resource = "^0.2.1"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
flake8 = "*"
|
||||
|
|
Loading…
Reference in New Issue