44from impacket .smb3structs import FILE_SHARE_WRITE , FILE_SHARE_DELETE , FILE_ATTRIBUTE_ENCRYPTED
55from impacket .smbconnection import SessionError , SMBConnection
66
7- # Copy-pasta from protocols/smb.py
8- smb_error_status = [
9- "STATUS_ACCOUNT_DISABLED" ,
10- "STATUS_ACCOUNT_EXPIRED" ,
11- "STATUS_ACCOUNT_RESTRICTION" ,
12- "STATUS_INVALID_LOGON_HOURS" ,
13- "STATUS_INVALID_WORKSTATION" ,
14- "STATUS_LOGON_TYPE_NOT_GRANTED" ,
15- "STATUS_PASSWORD_EXPIRED" ,
16- "STATUS_PASSWORD_MUST_CHANGE" ,
17- "STATUS_ACCESS_DENIED" ,
18- "STATUS_NO_SUCH_FILE" ,
19- "KDC_ERR_CLIENT_REVOKED" ,
20- "KDC_ERR_PREAUTH_FAILED" ,
21- ]
22-
23-
247def get_error_string (exception ):
258 if hasattr (exception , "getErrorString" ):
269 try :
@@ -63,7 +46,7 @@ def on_login(self, context: Context, connection):
6346 error = get_error_string (e )
6447 context .log .fail (
6548 f"Error enumerating shares: { error } " ,
66- color = "magenta" if error in smb_error_status else "red" ,
49+ color = "magenta" ,
6750 )
6851 return
6952
@@ -78,7 +61,7 @@ def on_login(self, context: Context, connection):
7861 error = get_error_string (e )
7962 context .log .fail (
8063 f"Error enumerating named pipes: { error } " ,
81- color = "magenta" if error in smb_error_status else "red" ,
64+ color = "magenta" ,
8265 )
8366 return
8467
@@ -126,6 +109,6 @@ def on_login(self, context: Context, connection):
126109 else :
127110 context .log .fail (
128111 f"Error waiting for named pipe: { error } " ,
129- color = "magenta" if error in smb_error_status else "red" ,
112+ color = "magenta" ,
130113 )
131114 return
0 commit comments