Skip to content

Commit

Permalink
Merge pull request #535 from Pennyw0rth/neff-patch-1
Browse files Browse the repository at this point in the history
Update license file and lint py version
  • Loading branch information
mpgn authored Jan 6, 2025
2 parents 1bfe964 + a562430 commit 3ee33cd
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, Marshall-Hallenbeck, NeffIsBack, zblurx, mpgn_x64
Copyright (c) 2025, Marshall-Hallenbeck, NeffIsBack, zblurx, mpgn_x64
Copyright (c) 2022, byt3bl33d3r
All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion nxc/modules/wcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, name, description="", checkers=None, checker_args=None, check
self.reasons = []

def run(self):
for checker, args, kwargs in zip(self.checkers, self.checker_args, self.checker_kwargs):
for checker, args, kwargs in zip(self.checkers, self.checker_args, self.checker_kwargs, strict=True):
if checker is None:
checker = HostChecker.check_registry

Expand Down
3 changes: 1 addition & 2 deletions nxc/modules/winscp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# - https://github.com/rapid7/metasploit-framework/blob/master/lib/rex/parser/winscp.rb

import traceback
from typing import Tuple
from impacket.dcerpc.v5.rpcrt import DCERPCException
from impacket.dcerpc.v5 import rrp
from impacket.examples.secretsdump import RemoteOperations
Expand Down Expand Up @@ -98,7 +97,7 @@ def decrypt_passwd(self, host: str, username: str, password: str) -> str:
clearpass = clearpass[len(key):]
return clearpass

def dec_next_char(self, pass_bytes) -> "Tuple[int, bytes]":
def dec_next_char(self, pass_bytes) -> tuple[int, bytes]:
"""
Decrypts the first byte of the password and returns the decrypted byte and the remaining bytes.
Expand Down
2 changes: 1 addition & 1 deletion nxc/nxcdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def do_export(self, line):
if cred[4] == "hash":
usernames.append(cred[2])
passwords.append(cred[3])
output_list = [":".join(combination) for combination in zip(usernames, passwords)]
output_list = [":".join(combination) for combination in zip(usernames, passwords, strict=True)]
write_list(filename, output_list)
else:
print(f"[-] No such export option: {line[1]}")
Expand Down
2 changes: 1 addition & 1 deletion nxc/protocols/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ def printTable(items, header):
rbcdRights.append(str(rbcd.get("sAMAccountName")))
rbcdObjType.append(str(rbcd.get("objectCategory")))

for rights, objType in zip(rbcdRights, rbcdObjType):
for rights, objType in zip(rbcdRights, rbcdObjType, strict=True):
answers.append([rights, objType, "Resource-Based Constrained", sAMAccountName])

if delegation in ["Unconstrained", "Constrained", "Constrained w/ Protocol Transition"]:
Expand Down
2 changes: 1 addition & 1 deletion nxc/protocols/mssql/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def add_admin_user(self, credtype, domain, username, password, host, user_id=Non
nxc_logger.debug(f"Hosts: {hosts}")

if users is not None and hosts is not None:
for user, host in zip(users, hosts):
for user, host in zip(users, hosts, strict=True):
user_id = user[0]
host_id = host[0]
link = {"userid": user_id, "hostid": host_id}
Expand Down
4 changes: 2 additions & 2 deletions nxc/protocols/nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def shares(self):
# Mount shares and check permissions
self.logger.highlight(f"{'UID':<11}{'Perms':<9}{'Storage Usage':<17}{'Share':<30} {'Access List':<15}")
self.logger.highlight(f"{'---':<11}{'-----':<9}{'-------------':<17}{'-----':<30} {'-----------':<15}")
for share, network in zip(shares, networks):
for share, network in zip(shares, networks, strict=True):
try:
mnt_info = self.mount.mnt(share, self.auth)
self.logger.debug(f"Mounted {share} - {mnt_info}")
Expand Down Expand Up @@ -225,7 +225,7 @@ def enum_shares(self):
networks = self.export_info(self.mount.export())

self.logger.display("Enumerating NFS Shares Directories")
for share, network in zip(shares, networks):
for share, network in zip(shares, networks, strict=True):
try:
mount_info = self.mount.mnt(share, self.auth)
self.logger.debug(f"Mounted {share} - {mount_info}")
Expand Down
15 changes: 7 additions & 8 deletions nxc/protocols/smb/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
import warnings
from datetime import datetime
from typing import Optional

from sqlalchemy import func, Table, select, delete
from sqlalchemy.dialects.sqlite import Insert # used for upsert
Expand Down Expand Up @@ -350,7 +349,7 @@ def add_admin_user(self, credtype, domain, username, password, host, user_id=Non
hosts = self.get_hosts(host)

if users and hosts:
for user, host in zip(users, hosts):
for user, host in zip(users, hosts, strict=True):
user_id = user[0]
host_id = host[0]
link = {"userid": user_id, "hostid": host_id}
Expand Down Expand Up @@ -693,7 +692,7 @@ def add_domain_backupkey(self, domain: str, pvk: bytes):
except Exception as e:
nxc_logger.debug(f"Issue while inserting DPAPI Backup Key: {e}")

def get_domain_backupkey(self, domain: Optional[str] = None):
def get_domain_backupkey(self, domain: str | None = None):
"""
Get domain backupkey
:domain is the domain fqdn
Expand Down Expand Up @@ -748,11 +747,11 @@ def add_dpapi_secrets(
def get_dpapi_secrets(
self,
filter_term=None,
host: Optional[str] = None,
dpapi_type: Optional[str] = None,
windows_user: Optional[str] = None,
username: Optional[str] = None,
url: Optional[str] = None,
host: str | None = None,
dpapi_type: str | None = None,
windows_user: str | None = None,
username: str | None = None,
url: str | None = None,
):
"""Get dpapi secrets from nxcdb"""
q = select(self.DpapiSecrets)
Expand Down
2 changes: 1 addition & 1 deletion nxc/protocols/smb/samrfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_local_administrators(self):
member_sids = self.samr_query.get_alias_members(domain_handle, self.groups["Administrators"])
member_names = self.lsa_query.lookup_sids(member_sids)

for sid, name in zip(member_sids, member_names):
for sid, name in zip(member_sids, member_names, strict=True):
print(f"{name} - {sid}")


Expand Down
2 changes: 1 addition & 1 deletion nxc/protocols/ssh/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def add_admin_user(self, credtype, username, secret, host_id=None, cred_id=None)
hosts = self.get_hosts(host_id)

if creds and hosts:
for cred, host in zip(creds, hosts):
for cred, host in zip(creds, hosts, strict=True):
cred_id = cred[0]
host_id = host[0]
link = {"credid": cred_id, "hostid": host_id}
Expand Down
2 changes: 1 addition & 1 deletion nxc/protocols/winrm/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def add_admin_user(self, credtype, domain, username, password, host, user_id=Non
hosts = self.get_hosts(host)

if users and hosts:
for user, host in zip(users, hosts):
for user, host in zip(users, hosts, strict=True):
user_id = user[0]
host_id = host[0]
link = {"userid": user_id, "hostid": host_id}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ line-length = 65000
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

target-version = "py37"
target-version = "py310"

[tool.ruff.flake8-quotes]
docstring-quotes = "double"
Expand Down

0 comments on commit 3ee33cd

Please sign in to comment.