Skip to content

Commit 34063e3

Browse files
committed
Increase readability
1 parent 84d896e commit 34063e3

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

nxc/modules/handlekatz.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,15 @@ def on_admin_login(self, context, connection):
9797
context.log.fail("Process lsass.exe error un dump, try with verbose")
9898
dump = False
9999

100-
if dump:
100+
if not dump:
101+
self.delete_handlekatz_binary(connection, context)
102+
return
103+
else:
101104
regex = r"([A-Za-z0-9-]*\.log)"
102105
matches = re.search(regex, str(p), re.MULTILINE)
103106
if not matches:
104107
context.log.display("Error getting the lsass.dmp file name")
105-
sys.exit(1)
108+
return
106109

107110
machine_name = matches.group()
108111
context.log.display(f"Copy {machine_name} to host")
@@ -115,7 +118,6 @@ def on_admin_login(self, context, connection):
115118
context.log.fail(f"Error while get file: {e}")
116119

117120
self.delete_handlekatz_binary()
118-
119121
try:
120122
connection.conn.deleteFile(self.share, self.tmp_share + machine_name)
121123
context.log.success(f"Deleted lsass.dmp file on the {self.share} share")
@@ -180,9 +182,6 @@ def on_admin_login(self, context, connection):
180182
except Exception as e:
181183
context.log.fail(f"Error opening dump file: {e}")
182184

183-
else:
184-
self.delete_handlekatz_binary(connection, context)
185-
186185
def delete_handlekatz_binary(self, connection, context):
187186
try:
188187
connection.conn.deleteFile(self.share, self.tmp_share + self.handlekatz)

0 commit comments

Comments
 (0)