Merge pull request #87 from mpgn/fix_brokenpipe

fix brokenpiperror false positive #73
main
mpgn 2023-08-13 14:25:01 +02:00 committed by GitHub
commit 7d4c7007e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -246,6 +246,7 @@ class mssql(connection):
return True
except BrokenPipeError as e:
self.logger.fail(f"Broken Pipe Error while attempting to login")
return False
except Exception as e:
self.logger.fail(f"{domain}\\{username}:{process_secret(password)}")
self.logger.exception(e)
@ -296,6 +297,7 @@ class mssql(connection):
return True
except BrokenPipeError as e:
self.logger.fail(f"Broken Pipe Error while attempting to login")
return False
except Exception as e:
self.logger.fail(f"{domain}\\{username}:{process_secret(ntlm_hash)} {e}")
return False

View File

@ -458,10 +458,8 @@ class smb(connection):
self.password = password
self.username = username
self.domain = domain
try:
self.conn.login(self.username, self.password, domain)
except BrokenPipeError:
self.logger.fail(f"Broken Pipe Error while attempting to login")
self.conn.login(self.username, self.password, domain)
self.check_if_admin()
self.logger.debug(f"Adding credential: {domain}/{self.username}:{self.password}")
@ -508,6 +506,9 @@ class smb(connection):
except (ConnectionResetError, NetBIOSTimeout, NetBIOSError) as e:
self.logger.fail(f"Connection Error: {e}")
return False
except BrokenPipeError as e:
self.logger.fail(f"Broken Pipe Error while attempting to login")
return False
def hash_login(self, domain, username, ntlm_hash):
# Re-connect since we logged off
@ -532,10 +533,8 @@ class smb(connection):
nthash = self.hash
self.domain = domain
try:
self.conn.login(self.username, "", domain, lmhash, nthash)
except BrokenPipeError:
self.logger.fail(f"Broken Pipe Error while attempting to login")
self.conn.login(self.username, "", domain, lmhash, nthash)
self.check_if_admin()
user_id = self.db.add_credential("hash", domain, self.username, nthash)
@ -573,6 +572,9 @@ class smb(connection):
except (ConnectionResetError, NetBIOSTimeout, NetBIOSError) as e:
self.logger.fail(f"Connection Error: {e}")
return False
except BrokenPipeError as e:
self.logger.fail(f"Broken Pipe Error while attempting to login")
return False
def create_smbv1_conn(self, kdc=""):
try: