Skip to content

Commit cb44d09

Browse files
committed
fix ruff
1 parent fb369f0 commit cb44d09

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

nxc/modules/notepad++.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def options(self, context, module_options):
2020

2121
def on_admin_login(self, context, connection):
2222
found = 0
23-
for directory in connection.conn.listPath("C$", "Users\\*"):
23+
for directory in connection.conn.listPath("C$", "Users\\*"):
2424
if directory.get_longname() not in self.false_positive and directory.is_directory():
2525
try:
2626
notepad_backup_dir = f"Users\\{directory.get_longname()}\\AppData\\Roaming\\Notepad++\\backup\\"

nxc/modules/powershell_history.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def options(self, _, module_options):
2525
self.export = bool(module_options.get("EXPORT", False))
2626

2727
def on_admin_login(self, context, connection):
28-
for directory in connection.conn.listPath("C$", "Users\\*"):
28+
for directory in connection.conn.listPath("C$", "Users\\*"):
2929
if directory.get_longname() not in self.false_positive and directory.is_directory():
3030
try:
3131
powershell_history_dir = f"Users\\{directory.get_longname()}\\AppData\\Roaming\\Microsoft\\Windows\\PowerShell\\PSReadLine\\"
@@ -37,12 +37,8 @@ def on_admin_login(self, context, connection):
3737
connection.conn.getFile("C$", file_path, buf.write)
3838
buf.seek(0)
3939
file_content = buf.read().decode("utf-8", errors="ignore").lower()
40-
keywords = []
41-
for keyword in self.sensitive_keywords:
42-
if keyword in file_content:
43-
keywords.append(keyword.upper())
44-
45-
if keyword:
40+
keywords = [keyword.upper() for keyword in self.sensitive_keywords if keyword in file_content]
41+
if len(keywords):
4642
context.log.highlight(f"C:\\{file_path} [ {' '.join(keywords)} ]")
4743
else:
4844
context.log.highlight(f"C:\\{file_path}")

nxc/modules/shadowrdp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def on_admin_login(self, context, connection):
3838
remoteOps._RemoteOperations__rrp,
3939
regHandle,
4040
"Software\\Policies\\Microsoft\\Windows NT\\Terminal Services\\"
41-
)['phkResult']
41+
)["phkResult"]
4242

4343
# Checks if the key already exists or not
4444
try:

0 commit comments

Comments
 (0)