mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 14:41:38 -07:00
PUSHPROD 23.01.03 HF02
This commit is contained in:
@@ -1786,7 +1786,7 @@ def performNmapScan(devicesToScan):
|
|||||||
file_print(e.output)
|
file_print(e.output)
|
||||||
file_print(" Error - Nmap Scan - check logs")
|
file_print(" Error - Nmap Scan - check logs")
|
||||||
except subprocess.TimeoutExpired as timeErr:
|
except subprocess.TimeoutExpired as timeErr:
|
||||||
file_print(' Nmap TIMEOUT - the process forcefully terminated as timeout reached for', device["dev_LastIP"])
|
file_print(' Nmap TIMEOUT - the process forcefully terminated as timeout reached for ', device["dev_LastIP"])
|
||||||
|
|
||||||
if output == "": # check if the subprocess failed
|
if output == "": # check if the subprocess failed
|
||||||
file_print('[', timeNow(), '] Scan: Nmap FAIL - check logs')
|
file_print('[', timeNow(), '] Scan: Nmap FAIL - check logs')
|
||||||
@@ -2594,14 +2594,18 @@ def send_email (pText, pHTML):
|
|||||||
smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT)
|
smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT)
|
||||||
smtp_connection.ehlo()
|
smtp_connection.ehlo()
|
||||||
|
|
||||||
if not SafeParseGlobalBool("SMTP_SKIP_TLS"):
|
try:
|
||||||
smtp_connection.starttls()
|
if not SafeParseGlobalBool("SMTP_SKIP_TLS"):
|
||||||
smtp_connection.ehlo()
|
smtp_connection.starttls()
|
||||||
if not SafeParseGlobalBool("SMTP_SKIP_LOGIN"):
|
smtp_connection.ehlo()
|
||||||
smtp_connection.login (SMTP_USER, SMTP_PASS)
|
if not SafeParseGlobalBool("SMTP_SKIP_LOGIN"):
|
||||||
|
smtp_connection.login (SMTP_USER, SMTP_PASS)
|
||||||
|
|
||||||
|
smtp_connection.sendmail (REPORT_FROM, REPORT_TO, msg.as_string())
|
||||||
|
smtp_connection.quit()
|
||||||
|
except smtplib.SMTPAuthenticationError as e:
|
||||||
|
file_print(' ERROR: Couldn\'t connect to the SMTP, skipping Email')
|
||||||
|
|
||||||
smtp_connection.sendmail (REPORT_FROM, REPORT_TO, msg.as_string())
|
|
||||||
smtp_connection.quit()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def SafeParseGlobalBool(boolVariable):
|
def SafeParseGlobalBool(boolVariable):
|
||||||
@@ -3208,7 +3212,11 @@ def get_all_devices():
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def hide_email(email):
|
def hide_email(email):
|
||||||
m = email.split('@')
|
m = email.split('@')
|
||||||
return f'{m[0][0]}{"*"*(len(m[0])-2)}{m[0][-1] if len(m[0]) > 1 else ""}@{m[1]}'
|
|
||||||
|
if len(m) == 2:
|
||||||
|
return f'{m[0][0]}{"*"*(len(m[0])-2)}{m[0][-1] if len(m[0]) > 1 else ""}@{m[1]}'
|
||||||
|
|
||||||
|
return email
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Cron-like Scheduling
|
# Cron-like Scheduling
|
||||||
|
|||||||
Reference in New Issue
Block a user