Skip to content

Commit dd7cbb6

Browse files
committed
fix ruff warnings
1 parent 85c44fa commit dd7cbb6

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

nxc/modules/vnc.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def upgrade_connection(self, target: Target, connection=None):
8989
conn.connect()
9090
return conn
9191

92-
def reg_query_value(self, remote_ops, path, key, hku = False):
92+
def reg_query_value(self, remote_ops, path, key, hku=False):
9393
if remote_ops._RemoteOperations__rrp:
9494
ans = rrp.hOpenUsers(remote_ops._RemoteOperations__rrp) if hku else rrp.hOpenLocalMachine(remote_ops._RemoteOperations__rrp)
9595
reg_handle = ans["phKey"]
@@ -118,13 +118,13 @@ def vnc_client_proxyconf_extract(self, dploot_conn, remote_ops=None):
118118
for user, sid in users.items():
119119
ntuser_dat_path = ntpath.join(f"Users\\{user}\\NTUSER.DAT")
120120
try:
121-
ntuser_dat_bytes = dploot_conn.readFile(self.share,ntuser_dat_path)
121+
ntuser_dat_bytes = dploot_conn.readFile(self.share, ntuser_dat_path)
122122
except Exception as e:
123123
self.context.log.debug(f"Error while getting NTUSER.DAT file for {user}: {e}")
124124
for vnc_name, registry_path, registry_keys in vnc_client_softwares:
125125
cred = {}
126126
if ntuser_dat_bytes is None and remote_ops is not None:
127-
user_registry_path = ntpath.join(sid,registry_path)
127+
user_registry_path = ntpath.join(sid, registry_path)
128128
try:
129129
password = self.reg_query_value(remote_ops, user_registry_path, registry_keys[1], hku=True).encode().rstrip(b"\x00").decode()
130130
cred["password"] = self.recover_vncpassword(unhexlify(password)).decode("latin-1")
@@ -142,10 +142,10 @@ def vnc_client_proxyconf_extract(self, dploot_conn, remote_ops=None):
142142
parent_key = reg.findKey(registry_path)
143143
if parent_key is None:
144144
continue
145-
cred["user"] = reg.getValue(ntpath.join(registry_path,registry_keys[0]))[1].decode("latin-1")
146-
password = reg.getValue(ntpath.join(registry_path,registry_keys[1]))[1].decode("utf-16le").rstrip("\0").encode()
145+
cred["user"] = reg.getValue(ntpath.join(registry_path, registry_keys[0]))[1].decode("latin-1")
146+
password = reg.getValue(ntpath.join(registry_path, registry_keys[1]))[1].decode("utf-16le").rstrip("\0").encode()
147147
cred["password"] = self.recover_vncpassword(unhexlify(password)).decode("latin-1")
148-
cred["server"] = reg.getValue(ntpath.join(registry_path,registry_keys[2]))[1].decode("latin-1")
148+
cred["server"] = reg.getValue(ntpath.join(registry_path, registry_keys[2]))[1].decode("latin-1")
149149

150150
self.context.log.highlight(f"[{vnc_name}] {cred['user']}:{cred['password']}@{cred['server']}")
151151

@@ -271,12 +271,12 @@ def get_users(self, conn):
271271
break
272272
except Exception as e:
273273
self.context.debug(f"Error while listing users from HKU: {e}")
274-
i +=1
274+
i += 1
275275
rrp.hBaseRegCloseKey(conn._RemoteOperations__rrp, keyHandle)
276276
for sid in sids:
277-
ans = rrp.hBaseRegOpenKey(conn._RemoteOperations__rrp, regHandle, ntpath.join(userlist_key,sid), samDesired=rrp.MAXIMUM_ALLOWED | rrp.KEY_ENUMERATE_SUB_KEYS | rrp.KEY_QUERY_VALUE)
277+
ans = rrp.hBaseRegOpenKey(conn._RemoteOperations__rrp, regHandle, ntpath.join(userlist_key, sid), samDesired=rrp.MAXIMUM_ALLOWED | rrp.KEY_ENUMERATE_SUB_KEYS | rrp.KEY_QUERY_VALUE)
278278
keyHandle = ans["phkResult"]
279-
_, profile_path = rrp.hBaseRegQueryValue(conn._RemoteOperations__rrp, keyHandle, "ProfileImagePath")
279+
_, profile_path = rrp.hBaseRegQueryValue(conn._RemoteOperations__rrp, keyHandle, "ProfileImagePath")
280280
if r"%systemroot%" in profile_path:
281281
continue
282282
users[ntpath.basename(profile_path.rstrip("\0"))] = sid.rstrip("\0")

nxc/protocols/smb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
from dploot.triage.backupkey import BackupkeyTriage
5656
from dploot.lib.target import Target
5757
from dploot.lib.smb import DPLootSMBConnection
58-
from dploot.triage.sccm import SCCMTriage, SCCMCollection, SCCMCred, SCCMSecret
58+
from dploot.triage.sccm import SCCMTriage
5959

6060
from pywerview.cli.helpers import get_localdisks, get_netsession, get_netgroupmember, get_netgroup, get_netcomputer, get_netloggedon, get_netlocalgroup
6161

nxc/protocols/smb/proto_args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def proto_args(parser, std_parser, module_parser):
2222
cgroup.add_argument("--lsa", action="store_true", help="dump LSA secrets from target systems")
2323
cgroup.add_argument("--ntds", choices={"vss", "drsuapi"}, nargs="?", const="drsuapi", help="dump the NTDS.dit from target DCs using the specifed method\n(default: drsuapi)")
2424
cgroup.add_argument("--dpapi", choices={"cookies", "nosystem"}, nargs="*", help='dump DPAPI secrets from target systems, can dump cookies if you add "cookies", will not dump SYSTEM dpapi if you add nosystem\n')
25-
cgroup.add_argument("--sccm", choices={"wmi","disk"}, nargs="?", const="disk", help="dump SCCM secrets from target systems")
25+
cgroup.add_argument("--sccm", choices={"wmi", "disk"}, nargs="?", const="disk", help="dump SCCM secrets from target systems")
2626

2727
ngroup = smb_parser.add_argument_group("Credential Gathering", "Options for gathering credentials")
2828
ngroup.add_argument("--mkfile", action="store", help="DPAPI option. File with masterkeys in form of {GUID}:SHA1")

0 commit comments

Comments
 (0)