From ecad15e85a7f11a4c5c6e8b4ca1a1c1bc04a1a98 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Thu, 3 Apr 2025 08:44:51 -0400 Subject: [PATCH 1/3] Fix left handside indent from powershell output --- nxc/protocols/smb.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nxc/protocols/smb.py b/nxc/protocols/smb.py index dcbd77a301..f820fde71a 100755 --- a/nxc/protocols/smb.py +++ b/nxc/protocols/smb.py @@ -818,9 +818,8 @@ def execute(self, payload=None, get_output=False, methods=None) -> str: if (self.args.execute or self.args.ps_execute): self.logger.success(f"Executed command via {current_method}") if output: - output_lines = StringIO(output).readlines() - for line in output_lines: - self.logger.highlight(line.strip()) + for line in output.split("\n"): + self.logger.highlight(line) return output else: self.logger.fail(f"Execute command failed with {current_method}") From 1248552ef872c4c73dba37c6a3e5353eeaef15f5 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Thu, 3 Apr 2025 09:00:33 -0400 Subject: [PATCH 2/3] Linting --- nxc/modules/recent_files.py | 2 +- nxc/protocols/smb.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/nxc/modules/recent_files.py b/nxc/modules/recent_files.py index 0a1059e069..d7a7771842 100644 --- a/nxc/modules/recent_files.py +++ b/nxc/modules/recent_files.py @@ -18,7 +18,7 @@ def options(self, context, module_options): def on_admin_login(self, context, connection): lnks = [] - for directory in connection.conn.listPath("C$", "Users\\*"): + for directory in connection.conn.listPath("C$", "Users\\*"): if directory.get_longname() not in self.false_positive and directory.is_directory(): context.log.highlight(f"C:\\{directory.get_longname()}") recent_files_dir = f"Users\\{directory.get_longname()}\\AppData\\Roaming\\Microsoft\\Windows\\Recent\\" diff --git a/nxc/protocols/smb.py b/nxc/protocols/smb.py index f820fde71a..4d107e3174 100755 --- a/nxc/protocols/smb.py +++ b/nxc/protocols/smb.py @@ -2,7 +2,6 @@ import binascii import os import re -from io import StringIO from Cryptodome.Hash import MD4 from impacket.smbconnection import SMBConnection, SessionError From d5978062ffe638f807a7b9eb620e7dffa265e1d4 Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Thu, 3 Apr 2025 09:27:03 -0400 Subject: [PATCH 3/3] Allow linting pipeline to run on review submittions like the test pipeline --- .github/workflows/lint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f747ec587d..4661533cc0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,12 +4,14 @@ name: Lint Python code with ruff on: push: workflow_dispatch: + pull_request_review: + types: [submitted] jobs: lint: runs-on: ubuntu-latest if: - github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event_name == 'workflow_dispatch' steps: - uses: actions/checkout@v4