Skip to content

Commit aa9b044

Browse files
Merge pull request Pennyw0rth#308 from Pennyw0rth/marshall-hash-spider-fix
Fix: hash_spider Lsassy Parser syntax
2 parents e3baadb + 34c3c29 commit aa9b044

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
data/nxc.db
22
hash_spider_default.sqlite3
3+
hash_spider_testing.sqlite3
34
*.bak
45
*.log
56
.venv

nxc/modules/hash_spider.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ def create_db(local_admins, dbconnection, cursor):
7070

7171

7272
def process_creds(context, connection, credentials_data, dbconnection, cursor, driver):
73-
if connection.args.local_auth:
74-
context.log.extra["host"] = connection.conn.getServerDNSDomainName()
75-
else:
76-
context.log.extra["host"] = connection.domain
77-
context.log.extra["hostname"] = connection.host.upper()
73+
domain = connection.conn.getServerDNSDomainName() if connection.args.local_auth else connection.domain
7874
for result in credentials_data:
7975
username = result["username"].upper().split("@")[0]
8076
nthash = result["nthash"]
@@ -85,7 +81,7 @@ def process_creds(context, connection, credentials_data, dbconnection, cursor, d
8581
"UPDATE admin_users SET password = ? WHERE username LIKE '" + username + "%'",
8682
[password],
8783
)
88-
username = f"{username.upper()}@{context.log.extra['host'].upper()}"
84+
username = f"{username.upper()}@{domain.upper()}"
8985
dbconnection.commit()
9086
session = driver.session()
9187
session.run('MATCH (u) WHERE (u.name = "' + username + '") SET u.owned=True RETURN u,u.name,u.owned')
@@ -99,7 +95,7 @@ def process_creds(context, connection, credentials_data, dbconnection, cursor, d
9995
[nthash],
10096
)
10197
dbconnection.commit()
102-
username = f"{username.upper()}@{context.log.extra['host'].upper()}"
98+
username = f"{username.upper()}@{domain.upper()}"
10399
session = driver.session()
104100
session.run('MATCH (u) WHERE (u.name = "' + username + '") SET u.owned=True RETURN u,u.name,u.owned')
105101
path_to_da = session.run("MATCH p=shortestPath((n)-[*1..]->(m)) WHERE n.owned=true AND m.name=~ '.*DOMAIN ADMINS.*' RETURN p")
@@ -202,7 +198,7 @@ def run_lsassy(self, context, connection, cursor): # copied and pasted from lsa
202198
if file is None:
203199
context.log.fail("Unable to dump lsass")
204200
return False
205-
credentials, tickets, masterkeys = Parser(file).parse()
201+
credentials, tickets, masterkeys = Parser(host, file).parse()
206202
file.close()
207203
ImpacketFile.delete(session, file.get_file_path())
208204
if credentials is None:

0 commit comments

Comments
 (0)