Skip to content

Commit

Permalink
Fix issue #134 which occurs on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
NeffIsBack committed Dec 4, 2023
1 parent 388208d commit da603de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nxc/protocols/smb/firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import hmac
import json
import ntpath
import os
import sqlite3
import tempfile
from Cryptodome.Cipher import AES, DES3
Expand Down Expand Up @@ -121,7 +122,10 @@ def get_login_data(self, logins_data):
]

def get_key(self, key4_data, master_password=b""):
fh = tempfile.NamedTemporaryFile()
# Instead of disabling "delete" and removing the file manually,
# in the future (py3.12) we could use "delete_on_close=False" as a cleaner solution
# Related issue: #134
fh = tempfile.NamedTemporaryFile(delete=False)
fh.write(key4_data)
fh.seek(0)
db = sqlite3.connect(fh.name)
Expand Down Expand Up @@ -149,7 +153,9 @@ def get_key(self, key4_data, master_password=b""):
self.logger.debug(e)
fh.close()
return b""
db.close()
fh.close()
os.remove(fh.name)

def is_master_password_correct(self, key_data, master_password=b""):
try:
Expand Down

0 comments on commit da603de

Please sign in to comment.