Skip to content

Commit 3c8bb13

Browse files
authored
Merge pull request Pennyw0rth#838 from Pennyw0rth/neff-linting
Add 'Warning' rule to linting
2 parents 8ca5874 + 8ec8830 commit 3c8bb13

56 files changed

Lines changed: 120 additions & 121 deletions

Some content is hidden

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

nxc/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def gen_cli_args():
6060
6161
The network execution tool
6262
Maintained as an open source project by @NeffIsBack, @MJHallenbeck, @_zblurx
63-
63+
6464
For documentation and usage examples, visit: https://www.netexec.wiki/
6565
6666
{highlight('Version', 'red')} : {highlight(VERSION)}

nxc/database.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def initialize_db():
110110

111111
# Even if the default workspace exists, we still need to check if every protocol has a database (in case of a new protocol)
112112
init_protocol_dbs("default")
113-
113+
114114

115115
def format_host_query(q, filter_term, HostsTable):
116116
"""One annoying thing is that if you search for an ip such as '10.10.10.5',
@@ -127,16 +127,16 @@ def format_host_query(q, filter_term, HostsTable):
127127
else:
128128
nxc_logger.debug("Neither 'ip' nor 'host' columns found in the table")
129129
return q
130-
131-
# first we check if its an ip address
130+
131+
# first we check if its an ip address
132132
try:
133133
ipaddress.ip_address(filter_term)
134134
nxc_logger.debug(f"filter_term is an IP address: {filter_term}")
135135
q = q.filter(ip_column == filter_term)
136136
except ValueError:
137137
nxc_logger.debug(f"filter_term is not an IP address: {filter_term}")
138138
like_term = func.lower(f"%{filter_term}%")
139-
139+
140140
# check if the hostname column exists for hostname searching
141141
q = q.filter(ip_column.like(like_term) | func.lower(HostsTable.c.hostname).like(like_term)) if hasattr(HostsTable.c, "hostname") else q.filter(ip_column.like(like_term))
142142

nxc/helpers/even6_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ def xml(self, template=None):
145145
return ""
146146

147147
attrs = filter(lambda x: x is not None, (x.xml(template) for x in self._attributes))
148-
148+
149149
attrs = " ".join(attrs)
150150
if len(attrs) > 0:
151151
attrs = " " + attrs
152-
152+
153153
if self._empty:
154154
return f"<{self._name.val}{attrs}/>"
155155
else:

nxc/helpers/misc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,3 @@ def detect_if_ip(target):
145145
return True
146146
except Exception:
147147
return False
148-

nxc/helpers/ntlm_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ def parse_challenge(challange):
3131
target_info["os_version"] = f"{WIN_VERSIONS[product_build]} Build {product_build}"
3232
else:
3333
target_info["os_version"] = f"{major_version}.{minor_version} Build {product_build}"
34-
return target_info
34+
return target_info

nxc/modules/add-computer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def on_login(self, context, connection):
8686
# If SAMR fails now try over LDAPS
8787
if not self.noLDAPRequired:
8888
self.do_ldaps_add(connection, context)
89-
89+
9090
def do_samr_add(self, context):
9191
"""
9292
Connects to a target server and performs various operations related to adding or deleting machine accounts.

nxc/modules/bitlocker.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def __init__(self, context=None, module_options=None):
1515
self.module_options = module_options
1616

1717
def options(self, context, module_options):
18-
"""
18+
"""
1919
USAGE:
20-
20+
2121
NetExec smb <IP> -u <username> -p <password> -M bitlocker
2222
NetExec wmi <IP> -u <username> -p <password> -M bitlocker (Better option to use on real life.)
2323
"""
@@ -43,18 +43,18 @@ def check_bitlocker_status(self):
4343
try:
4444
# Executing the PowerShell command to get BitLocker volumes status.
4545
check_bitlocker_command_str_output = self.connection.execute(check_bitlocker_command_str, True)
46-
46+
4747
if "'Get-BitLockerVolume' is not recognized" in check_bitlocker_command_str_output:
4848
self.context.log.fail("BitLockerVolume not found on target.")
4949
return
5050

5151
# Splitting the output into lines.
5252
lines = str(check_bitlocker_command_str_output).splitlines()
5353
data_lines = [line for line in lines if re.match(r"\w:", line)]
54-
54+
5555
for line in data_lines:
5656
# Checking every line for starting with drive
57-
if line[1] == ":":
57+
if line[1] == ":":
5858
parts = line.split()
5959
MountPoint, EncryptionMethod, protection_status = parts[0], parts[1], parts[2]
6060

@@ -85,15 +85,15 @@ def check_bitlocker_status(self):
8585
oxidResolver=True,
8686
doKerberos=self.connection.kerberos,
8787
kdcHost=self.connection.kdcHost)
88-
88+
8989
try:
9090
# CoCreateInstanceEx for WMI login
9191
i_interface = dcom_conn.CoCreateInstanceEx(wmi.CLSID_WbemLevel1Login, wmi.IID_IWbemLevel1Login)
9292
iWbemLevel1Login = wmi.IWbemLevel1Login(i_interface)
9393

9494
# Specify the namespace for BitLocker
9595
bitlockerNamespace = "root\\CIMv2\\Security\\MicrosoftVolumeEncryption"
96-
96+
9797
# NTLM login for WMI
9898
iWbemServices = iWbemLevel1Login.NTLMLogin(bitlockerNamespace, NULL, NULL)
9999

@@ -113,7 +113,7 @@ def check_bitlocker_status(self):
113113
6: "XTS_AES_128",
114114
7: "XTS_AES_256_WITH_DIFFUSER"
115115
}
116-
116+
117117
try:
118118
while True:
119119
iWbemClassObject = iEnumWbemClassObject.Next(0xffffffff, 1)

nxc/modules/daclread.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def __init__(self, context=None, module_options=None):
220220

221221
def options(self, context, module_options):
222222
"""
223-
Be careful, this module cannot read the DACLS recursively.
223+
Be careful, this module cannot read the DACLS recursively.
224224
For example, if an object has particular rights because it belongs to a group, the module will not be able to see it directly, you have to check the group rights manually.
225225
226226
TARGET The objects that we want to read or backup the DACLs, specified by its SamAccountName
@@ -269,7 +269,7 @@ def options(self, context, module_options):
269269

270270
if "ACE_TYPE" in module_options:
271271
self.ace_type = module_options["ACE_TYPE"]
272-
272+
273273
if "RIGHTS" in module_options:
274274
self.rights = module_options["RIGHTS"]
275275

nxc/modules/dfscoerce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ def options(self, context, module_options):
1515
self.listener = module_options["LISTENER"]
1616

1717
def on_login(self, context, connection):
18-
context.log.fail('[REMOVED] This module moved to the new module "coerce_plus"')
18+
context.log.fail('[REMOVED] This module moved to the new module "coerce_plus"')

nxc/modules/dpapi_hash.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ def on_admin_login(self, context, connection):
3434
no_pass=True,
3535
use_kcache=getattr(connection, "use_kcache", False),
3636
)
37-
37+
3838
conn = upgrade_to_dploot_connection(connection=connection.conn, target=target)
3939
if conn is None:
4040
context.log.debug("Could not upgrade connection")
4141
return
42-
42+
4343
try:
4444
context.log.display("Collecting DPAPI masterkeys, grab a coffee and be patient...")
4545
masterkeys_triage = MasterkeysTriage(
@@ -57,6 +57,6 @@ def on_admin_login(self, context, connection):
5757
else:
5858
for mkhash in [mkhash for masterkey in masterkeys_triage.all_looted_masterkeys for mkhash in masterkey.generate_hash()]:
5959
context.log.highlight(mkhash)
60-
60+
6161
except Exception as e:
62-
context.log.debug(f"Could not get masterkeys: {e}")
62+
context.log.debug(f"Could not get masterkeys: {e}")

0 commit comments

Comments
 (0)