Skip to content

Commit 6d5ce45

Browse files
committed
Move remote_ops.finish to end so we have the remoteops available
1 parent 6bee36f commit 6d5ce45

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

nxc/modules/recyclebin.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,9 @@ def options(self, context, module_options):
2424
def on_admin_login(self, context, connection):
2525
found = 0
2626
try:
27-
remote_ops = RemoteOperations(connection.conn, False)
27+
remote_ops = RemoteOperations(connection.conn, connection.kerberos)
2828
remote_ops.enableRegistry()
29-
except DCERPCSessionError as e:
30-
context.log.debug(f"Error connecting to RemoteRegistry {e} on host {connection.host}")
31-
finally:
32-
remote_ops.finish()
3329

34-
if remote_ops._RemoteOperations__rrp:
3530
for sid_directory in connection.conn.listPath("C$", "$Recycle.Bin\\*"):
3631
if sid_directory.get_longname() and sid_directory.get_longname() not in self.false_positive:
3732

@@ -99,3 +94,7 @@ def on_admin_login(self, context, connection):
9994
context.log.debug(f"Couldn't open {path} because of {e}")
10095
if found > 0:
10196
context.log.highlight(f"Recycle bin's content downloaded to {export_path}")
97+
except DCERPCSessionError as e:
98+
context.log.fail(f"Error connecting to RemoteRegistry {e} on host {connection.host}")
99+
finally:
100+
remote_ops.finish()

0 commit comments

Comments
 (0)