99from nxc .logger import nxc_logger
1010from impacket .dcerpc .v5 import rrp , samr , scmr
1111from impacket .dcerpc .v5 .rrp import DCERPCSessionError
12+ from impacket .dcerpc .v5 .rpcrt import DCERPCException
1213from impacket .smbconnection import SessionError as SMBSessionError
1314from impacket .examples .secretsdump import RemoteOperations
1415
@@ -357,7 +358,7 @@ def check_single_registry_with_policy(self, *spec, options=None):
357358 reasons = ["Check could not be performed (invalid specification provided)" ]
358359 return ok , reasons
359360 except Exception as e :
360- ok , reasons = self .module .log .error (f"Check could not be performed. Details: specs= { specs } , dce={ self .dce } , error: { e } " )
361+ ok , reasons = self .module .log .error (f"Check could not be performed. Details: spec= { spec } , dce={ self .dce } , error: { e } " )
361362 return ok , reasons
362363
363364 ok , reasons_p = self .check_registry ((policy_key , value_name , expected_value , op ), stop_on_error = True )
@@ -529,8 +530,8 @@ def check_applocker(self):
529530 def get_exclusions (self , key_name ):
530531 exclusions = []
531532 try :
532- values = self .reg_query_value (self .dce , self .connection , key_name , valueName = None , all = True )
533- for value_type , value_name , value_data in values :
533+ values = self .reg_query_value (self .dce , self .connection , key_name , valueName = None , all_value = True )
534+ for _ , value_name , _ in values :
534535 exclusions .append (value_name )
535536 except Exception :
536537 self .context .log .debug ("No defender exclusion policies" )
@@ -546,7 +547,7 @@ def check_defender_exclusion(self, *spec, options=None):
546547 reasons = ["Check could not be performed (invalid specification provided)" ]
547548 return ok , reasons
548549 except Exception as e :
549- ok , reasons = self .module .log .error (f"Check could not be performed. Details: specs= { specs } , dce={ self .dce } , error: { e } " )
550+ ok , reasons = self .module .log .error (f"Check could not be performed. Details: spec= { spec } , dce={ self .dce } , error: { e } " )
550551 return ok , reasons
551552
552553 reasons = []
@@ -649,7 +650,7 @@ def reg_get_subkeys(self, dce, connection, key_name):
649650 break
650651 return subkeys
651652
652- def reg_query_value (self , dce , connection , keyName , valueName = None , all = False ):
653+ def reg_query_value (self , dce , connection , keyName , valueName = None , all_value = False ):
653654 """Query remote registry data for a given registry value"""
654655
655656 def subkey_values (subkey_handle ):
@@ -702,9 +703,9 @@ def get_value(subkey_handle, dwIndex=0):
702703
703704 subkey_handle = ans ["phkResult" ]
704705
705- if valueName is None and all is False :
706+ if valueName is None and all_value is False :
706707 return get_value (subkey_handle )[2 ]
707- elif valueName is None and all is True :
708+ elif valueName is None and all_value is True :
708709 return subkey_values (subkey_handle )
709710 else :
710711 for _ , name , data in subkey_values (subkey_handle ):
0 commit comments