@@ -350,14 +350,13 @@ class Target:
350350 passed during the enumeration to the various modules. This allows to modify/update target information
351351 during enumeration.
352352 '''
353- def __init__ (self , host , credentials , port = None , tls = None , timeout = None , samba_config = None , sessions = {} ):
353+ def __init__ (self , host , credentials , port = None , tls = None , timeout = None , samba_config = None ):
354354 self .host = host
355355 self .creds = credentials
356356 self .port = port
357357 self .timeout = timeout
358358 self .tls = tls
359359 self .samba_config = samba_config
360- self .sessions = sessions
361360
362361 self .ip_version = None
363362 self .smb_ports = []
@@ -367,6 +366,14 @@ def __init__(self, host, credentials, port=None, tls=None, timeout=None, samba_c
367366 self .smb1_supported = False
368367 self .smb1_only = False
369368
369+ self .sessions = {"sessions_possible" :False ,
370+ AUTH_NULL :False ,
371+ AUTH_PASSWORD :False ,
372+ AUTH_KERBEROS :False ,
373+ AUTH_NTHASH :False ,
374+ "random_user" :False ,
375+ }
376+
370377 result = self .valid_host (host )
371378 if not result .retval :
372379 raise Exception (result .retmsg )
@@ -2950,11 +2957,12 @@ def run_modules(self, modules):
29502957 if ENUM_SESSIONS in modules :
29512958 result = EnumSessions (self .target , self .creds ).run ()
29522959 self .output .update (result )
2960+ # Overwrite sessions
29532961 self .target .sessions = self .output .as_dict ()['sessions' ]
29542962
29552963 # If sessions are not possible, we regenerate the list of modules again.
29562964 # This will only leave those modules in, which don't require authentication.
2957- if self . target . sessions and not self .target .sessions [self .creds .auth_method ]:
2965+ if not self .target .sessions [self .creds .auth_method ]:
29582966 modules = self .get_modules (self .target .listeners , session = False )
29592967
29602968 # Try to get domain name and sid via lsaquery
0 commit comments