44from impacket .smb3structs import FILE_SHARE_WRITE , FILE_SHARE_DELETE , FILE_ATTRIBUTE_ENCRYPTED
55from impacket .smbconnection import SessionError , SMBConnection
66
7+
78def get_error_string (exception ):
89 if hasattr (exception , "getErrorString" ):
910 try :
@@ -44,10 +45,7 @@ def on_login(self, context: Context, connection):
4445 shares = conn .listShares ()
4546 except SessionError as e :
4647 error = get_error_string (e )
47- context .log .fail (
48- f"Error enumerating shares: { error } " ,
49- color = "magenta" ,
50- )
48+ context .log .fail (f"Error enumerating shares: { error } " , color = "magenta" )
5149 return
5250
5351 # Check if named pipe is already available
@@ -59,10 +57,7 @@ def on_login(self, context: Context, connection):
5957 return
6058 except SessionError as e :
6159 error = get_error_string (e )
62- context .log .fail (
63- f"Error enumerating named pipes: { error } " ,
64- color = "magenta" ,
65- )
60+ context .log .fail (f"Error enumerating named pipes: { error } " , color = "magenta" )
6661 return
6762
6863 # Write an encrypted file on the share root.
@@ -107,8 +102,5 @@ def on_login(self, context: Context, connection):
107102 if error == "STATUS_OBJECT_NAME_NOT_FOUND" :
108103 context .log .debug ("efsrpc pipe was not activated." )
109104 else :
110- context .log .fail (
111- f"Error waiting for named pipe: { error } " ,
112- color = "magenta" ,
113- )
105+ context .log .fail (f"Error waiting for named pipe: { error } " , color = "magenta" )
114106 return
0 commit comments