fix: inform user if impersonate file doesnt exist
parent
25e4248ccb
commit
d638b17c44
|
@ -6,6 +6,7 @@
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
from sys import exit
|
from sys import exit
|
||||||
from os import path
|
from os import path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class NXCModule:
|
class NXCModule:
|
||||||
|
@ -47,8 +48,13 @@ class NXCModule:
|
||||||
def on_admin_login(self, context, connection):
|
def on_admin_login(self, context, connection):
|
||||||
if self.useembeded:
|
if self.useembeded:
|
||||||
file_to_upload = "/tmp/Impersonate.exe"
|
file_to_upload = "/tmp/Impersonate.exe"
|
||||||
|
|
||||||
|
try:
|
||||||
with open(file_to_upload, "wb") as impersonate:
|
with open(file_to_upload, "wb") as impersonate:
|
||||||
impersonate.write(self.impersonate_embedded)
|
impersonate.write(self.impersonate_embedded)
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
context.log.fail(f"Impersonate file specified '{file_to_upload}' does not exist!")
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
if path.isfile(self.imp_exe):
|
if path.isfile(self.imp_exe):
|
||||||
file_to_upload = self.imp_exe
|
file_to_upload = self.imp_exe
|
||||||
|
|
Loading…
Reference in New Issue