Skip to content

Commit 8f4dd9b

Browse files
committed
Updated poetry.lock
2 parents 8353979 + f3fd612 commit 8f4dd9b

61 files changed

Lines changed: 1523 additions & 1077 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.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

netexec.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ a = Analysis(
3838
'nxc.protocols.smb.smbspider',
3939
'nxc.protocols.smb.passpol',
4040
'nxc.protocols.mssql.mssqlexec',
41+
'nxc.parsers.ldap_results',
4142
'nxc.helpers.bash',
4243
'nxc.helpers.bloodhound',
4344
'nxc.helpers.msada_guids',
@@ -71,6 +72,7 @@ a = Analysis(
7172
'dploot.lib.smb',
7273
'pyasn1_modules.rfc5652',
7374
'unicrypto.backends.pycryptodomex',
75+
'dateutil.relativedelta',
7476
'sspilib.raw._text',
7577
],
7678
hookspath=['./nxc/.hooks'],

nxc/cli.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,26 @@
99
from nxc.paths import NXC_PATH
1010
from nxc.loaders.protocolloader import ProtocolLoader
1111
from nxc.helpers.logger import highlight
12-
from nxc.logger import nxc_logger
12+
from nxc.logger import nxc_logger, setup_debug_logging
1313
import importlib.metadata
1414

1515

1616
def gen_cli_args():
17-
VERSION = importlib.metadata.version("netexec")
17+
setup_debug_logging()
18+
19+
try:
20+
VERSION, COMMIT = importlib.metadata.version("netexec").split("+")
21+
except ValueError:
22+
VERSION = importlib.metadata.version("netexec")
23+
COMMIT = ""
1824
CODENAME = "nxc4u"
25+
nxc_logger.debug(f"NXC VERSION: {VERSION} - {CODENAME} - {COMMIT}")
1926

20-
parser = argparse.ArgumentParser(description=f"""
27+
parser = argparse.ArgumentParser(description=rf"""
2128
. .
2229
.| |. _ _ _ _____
2330
|| || | \ | | ___ | |_ | ____| __ __ ___ ___
24-
\\\( )// | \| | / _ \ | __| | _| \ \/ / / _ \ / __|
31+
\\( )// | \| | / _ \ | __| | _| \ \/ / / _ \ / __|
2532
.=[ ]=. | |\ | | __/ | |_ | |___ > < | __/ | (__
2633
/ /ॱ-ॱ\ \ |_| \_| \___| \__| |_____| /_/\_\ \___| \___|
2734
ॱ \ / ॱ
@@ -34,9 +41,10 @@ def gen_cli_args():
3441
3542
{highlight('Version', 'red')} : {highlight(VERSION)}
3643
{highlight('Codename', 'red')}: {highlight(CODENAME)}
44+
{highlight('Commit', 'red')} : {highlight(COMMIT)}
3745
""", formatter_class=RawTextHelpFormatter)
3846

39-
parser.add_argument("-t", type=int, dest="threads", default=100, help="set how many concurrent threads to use (default: 100)")
47+
parser.add_argument("-t", type=int, dest="threads", default=256, help="set how many concurrent threads to use (default: 256)")
4048
parser.add_argument("--timeout", default=None, type=int, help="max timeout in seconds of each thread (default: None)")
4149
parser.add_argument("--jitter", metavar="INTERVAL", type=str, help="sets a random delay between each connection (default: None)")
4250
parser.add_argument("--no-progress", action="store_true", help="Not displaying progress bar during scan")
@@ -95,7 +103,7 @@ def gen_cli_args():
95103
sys.exit(1)
96104

97105
if args.version:
98-
print(f"{VERSION} - {CODENAME}")
106+
print(f"{VERSION} - {CODENAME} - {COMMIT}")
99107
sys.exit(1)
100108

101109
return args

nxc/connection.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from impacket.dcerpc.v5 import transport
1616
import sys
17+
import contextlib
1718

1819
sem = BoundedSemaphore(1)
1920
global_failed_logins = 0
@@ -121,7 +122,14 @@ def __init__(self, args, db, host):
121122
try:
122123
self.proto_flow()
123124
except Exception as e:
124-
self.logger.exception(f"Exception while calling proto_flow() on target {self.host}: {e}")
125+
if "ERROR_DEPENDENT_SERVICES_RUNNING" in str(e):
126+
self.logger.error(f"Exception while calling proto_flow() on target {self.host}: {e}")
127+
else:
128+
self.logger.exception(f"Exception while calling proto_flow() on target {self.host}: {e}")
129+
finally:
130+
self.logger.debug(f"Closing connection to: {host}")
131+
with contextlib.suppress(Exception):
132+
self.conn.close()
125133

126134
@staticmethod
127135
def proto_args(std_parser, module_parser):
@@ -163,7 +171,9 @@ def hash_login(self, domain, username, ntlm_hash):
163171
def proto_flow(self):
164172
self.logger.debug("Kicking off proto_flow")
165173
self.proto_logger()
166-
if self.create_conn_obj():
174+
if not self.create_conn_obj():
175+
self.logger.info(f"Failed to create connection object for target {self.host}, exiting...")
176+
else:
167177
self.logger.debug("Created connection object")
168178
self.enum_host_info()
169179
if self.print_host_info() and (self.login() or (self.username == "" and self.password == "")):

nxc/data/nxc.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bh_enabled = False
1313
bh_uri = 127.0.0.1
1414
bh_port = 7687
1515
bh_user = neo4j
16-
bh_pass = neo4j
16+
bh_pass = bloodhoundcommunityedition
1717

1818
[Empire]
1919
api_host = 127.0.0.1

nxc/helpers/bloodhound.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ def add_user_bh(user, domain, logger, config):
5252
_add_with_domain(user_info, domain, tx, logger)
5353
except AuthError:
5454
logger.fail(f"Provided Neo4J credentials ({config.get('BloodHound', 'bh_user')}:{config.get('BloodHound', 'bh_pass')}) are not valid.")
55-
return
55+
exit()
5656
except ServiceUnavailable:
5757
logger.fail(f"Neo4J does not seem to be available on {uri}.")
58-
return
58+
exit()
5959
except Exception as e:
6060
logger.fail(f"Unexpected error with Neo4J: {e}")
61-
return
62-
driver.close()
61+
finally:
62+
driver.close()
6363

6464

6565
def _add_with_domain(user_info, domain, tx, logger):

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__,

0 commit comments

Comments
 (0)