Skip to content

Commit 08ebdc4

Browse files
committed
Catch exceptions
1 parent 230ac87 commit 08ebdc4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

enum4linux-ng.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,12 +2596,15 @@ def enum(self):
25962596
'''
25972597
policy = {}
25982598

2599-
smb_conn = SmbConnection(self.target, self.creds)
2600-
smb_conn.login()
2601-
samr_object = SAMR(smb_conn)
2602-
domains = samr_object.get_domains()
2603-
# FIXME: Gets policy for BULTIN domain
2604-
domain_handle = samr_object.get_domain_handle(domains[0])
2599+
try:
2600+
smb_conn = SmbConnection(self.target, self.creds)
2601+
smb_conn.login()
2602+
samr_object = SAMR(smb_conn)
2603+
domains = samr_object.get_domains()
2604+
# FIXME: Gets policy for domain only, [1] stores the policy for BUILTIN
2605+
domain_handle = samr_object.get_domain_handle(domains[0])
2606+
except Exception as e:
2607+
return Result(None, process_impacket_smb_exception(e, self.target))
26052608

26062609
try:
26072610
result = samr_object.get_domain_password_information(domain_handle)

0 commit comments

Comments
 (0)