Skip to content

Commit e14bbaf

Browse files
authored
Merge branch 'main' into remove-git-deps
2 parents cb40697 + 0eeddfb commit e14bbaf

8 files changed

Lines changed: 43 additions & 25 deletions

File tree

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Lint Python code with ruff
22
# Caching source: https://gist.github.com/gh640/233a6daf68e9e937115371c0ecd39c61?permalink_comment_id=4529233#gistcomment-4529233
33

4-
on: [push, pull_request]
4+
on:
5+
push:
56

67
jobs:
78
lint:
8-
name: Lint Python code with ruff
99
runs-on: ubuntu-latest
1010
if:
1111
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

.github/workflows/test.yml

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,48 @@
11
name: NetExec Tests
22

33
on:
4+
workflow_dispatch:
45
pull_request_review:
56
types: [submitted]
67

78
jobs:
89
build:
9-
name: NetExec Tests for Py${{ matrix.python-version }}
10+
name: Test for Py${{ matrix.python-version }}
11+
if: github.event.review.state == 'APPROVED'
1012
runs-on: ${{ matrix.os }}
1113
strategy:
1214
max-parallel: 5
1315
matrix:
1416
os: [ubuntu-latest]
15-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1618
steps:
17-
- uses: actions/checkout@v3
18-
- name: NetExec set up python on ${{ matrix.os }}
19-
uses: actions/setup-python@v4
20-
with:
21-
python-version: ${{ matrix.python-version }}
22-
- name: Install poetry
23-
run: |
24-
pipx install poetry --python python${{ matrix.python-version }}
25-
poetry --version
26-
poetry env info
27-
- name: Install libraries with dev group
28-
run: |
29-
poetry install --with dev
30-
- name: Run the e2e test
31-
run: |
32-
poetry run pytest tests
19+
- uses: actions/checkout@v3
20+
- name: Install poetry
21+
run: |
22+
pipx install poetry
23+
- name: NetExec set up python ${{ matrix.python-version }} on ${{ matrix.os }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache: poetry
28+
cache-dependency-path: poetry.lock
29+
- name: Install poetry
30+
run: |
31+
pipx install poetry --python python${{ matrix.python-version }}
32+
poetry --version
33+
poetry env info
34+
- name: Install libraries with dev group
35+
run: |
36+
poetry install --with dev
37+
- name: Load every protocol and module
38+
run: |
39+
poetry run netexec winrm 127.0.0.1
40+
poetry run netexec vnc 127.0.0.1
41+
poetry run netexec smb 127.0.0.1
42+
poetry run netexec ldap 127.0.0.1
43+
poetry run netexec wmi 127.0.0.1
44+
poetry run netexec rdp 127.0.0.1
45+
poetry run netexec mssql 127.0.0.1
46+
poetry run netexec ssh 127.0.0.1
47+
poetry run netexec ftp 127.0.0.1
48+
poetry run netexec smb 127.0.0.1 -M veeam

nxc/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def hash_login(self, domain, username, ntlm_hash):
163163
def proto_flow(self):
164164
self.logger.debug("Kicking off proto_flow")
165165
self.proto_logger()
166-
if self.create_conn_obj():
166+
if not self.create_conn_obj():
167+
self.logger.info(f"Failed to create connection object for target {self.host}, exiting...")
168+
else:
167169
self.logger.debug("Created connection object")
168170
self.enum_host_info()
169171
if self.print_host_info() and (self.login() or (self.username == "" and self.password == "")):

nxc/loaders/moduleloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def get_module_info(self, module_path):
9595
module_spec = spec.loader.load_module().NXCModule
9696

9797
module = {
98-
f"{module_spec.name.lower()}": {
98+
f"{module_spec.name}": {
9999
"path": module_path,
100100
"description": module_spec.description,
101101
"options": module_spec.options.__doc__,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class NXCModule:
1414
def options(self, context, module_options):
1515
pass
1616

17-
name = "MAQ"
17+
name = "maq"
1818
description = "Retrieves the MachineAccountQuota domain-level attribute"
1919
supported_protocols = ["ldap"]
2020
opsec_safe = True

nxc/netexec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def main():
186186
exit(0)
187187
elif args.module:
188188
nxc_logger.debug(f"Modules to be Loaded: {args.module}, {type(args.module)}")
189-
for m in map(str.lower, args.module):
189+
for m in args.module:
190190
if m not in modules:
191191
nxc_logger.error(f"Module not found: {m}")
192192
exit(1)

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Run `pytest` (or `poetry run pytest`)
66

77
### End to End Tests
8-
* Install nxc (either in venv or via Poetry)
8+
* Install nxc (either in venv or via Poetry): `poetry install --with dev`
99
* Run `python tests/e2e_tests.py -t $IP -u $USER -p $PASS`, with optional `-k` parameter
1010
* Poetry: `poetry run python tests/e2e_tests.py -t $IP -u $USER -p $PASS`
1111
* To see full errors (that might show real errors not caught by checking the exit code), run with the `--errors` flag
File renamed without changes.

0 commit comments

Comments
 (0)