Skip to content

Commit dbfb0d8

Browse files
committed
Formatting
1 parent 2ec56d1 commit dbfb0d8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

nxc/modules/recyclebin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,29 @@ class NXCModule:
1616
supported_protocols = ["smb"]
1717
opsec_safe = True
1818
multiple_hosts = True
19-
false_positive = [".", "..", "desktop.ini", "Public", "Default", "Default User", "All Users", ".NET v4.5", ".NET v4.5 Classic"]
2019

2120
def options(self, context, module_options):
2221
"""No options available"""
2322

2423
def on_admin_login(self, context, connection):
24+
false_positive_users = [".", "..", "desktop.ini", "Public", "Default", "Default User", "All Users", ".NET v4.5", ".NET v4.5 Classic"]
2525
found = 0
2626
try:
2727
remote_ops = RemoteOperations(connection.conn, connection.kerberos)
2828
remote_ops.enableRegistry()
2929

3030
for sid_directory in connection.conn.listPath("C$", "$Recycle.Bin\\*"):
3131
try:
32-
if sid_directory.get_longname() and sid_directory.get_longname() not in self.false_positive:
32+
if sid_directory.get_longname() and sid_directory.get_longname() not in false_positive_users:
3333

3434
# Extracts the username from the SID
3535
reg_handle = rrp.hOpenLocalMachine(remote_ops._RemoteOperations__rrp)["phKey"]
3636
key_handle = rrp.hBaseRegOpenKey(remote_ops._RemoteOperations__rrp, reg_handle, f"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\{sid_directory.get_longname()}")["phkResult"]
37-
username = profileimagepath = None
37+
username = None
3838
try:
3939
_, profileimagepath = rrp.hBaseRegQueryValue(remote_ops._RemoteOperations__rrp, key_handle, "ProfileImagePath\x00")
4040
# Get username and remove embedded null byte
41-
username = profileimagepath.split("\\")[-1].replace("\x00", "")
41+
username = profileimagepath.split("\\")[-1].rstrip("\x00")
4242
except rrp.DCERPCSessionError as e:
4343
context.log.debug(f"Couldn't get username from SID {e} on host {connection.host}")
4444

@@ -51,8 +51,8 @@ def on_admin_login(self, context, connection):
5151
no_print_results=True
5252
)
5353

54-
false_positiv = (".", "..", "desktop.ini")
55-
filtered_file_paths = [path for path in paths if not path.endswith(false_positiv)]
54+
false_positive = (".", "..", "desktop.ini")
55+
filtered_file_paths = [path for path in paths if not path.endswith(false_positive)]
5656
if filtered_file_paths:
5757
if username is not None:
5858
context.log.highlight(f"CONTENT FOUND {sid_directory.get_longname()} ({username})")

0 commit comments

Comments
 (0)