Merge pull request #271 from guardicore/hotfix/sambacry-catch-another-exception

Sambacry now catches NetBIOSError on attempting credentials
This commit is contained in:
itaymmguardicore 2019-02-21 12:34:54 +02:00 committed by GitHub
commit 8069d27346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from io import BytesIO
from os import path from os import path
import impacket.smbconnection import impacket.smbconnection
from impacket.nmb import NetBIOSError
from impacket.nt_errors import STATUS_SUCCESS from impacket.nt_errors import STATUS_SUCCESS
from impacket.smb import FILE_OPEN, SMB_DIALECT, SMB, SMBCommand, SMBNtCreateAndX_Parameters, SMBNtCreateAndX_Data, \ from impacket.smb import FILE_OPEN, SMB_DIALECT, SMB, SMBCommand, SMBNtCreateAndX_Parameters, SMBNtCreateAndX_Data, \
FILE_READ_DATA, FILE_SHARE_READ, FILE_NON_DIRECTORY_FILE, FILE_WRITE_DATA, FILE_DIRECTORY_FILE FILE_READ_DATA, FILE_SHARE_READ, FILE_NON_DIRECTORY_FILE, FILE_WRITE_DATA, FILE_DIRECTORY_FILE
@ -172,7 +173,7 @@ class SambaCryExploiter(HostExploiter):
if self.is_share_writable(smb_client, share): if self.is_share_writable(smb_client, share):
writable_shares_creds_dict[share] = credentials writable_shares_creds_dict[share] = credentials
except (impacket.smbconnection.SessionError, SessionError): except (impacket.smbconnection.SessionError, SessionError, NetBIOSError):
# If failed using some credentials, try others. # If failed using some credentials, try others.
pass pass