From 78c18aa100d183627105c91a19eb108fd41778d2 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sun, 8 Oct 2023 22:49:50 +1100 Subject: [PATCH] =?UTF-8?q?Notification=20rework=20-=20SMTP=20v0.3=20-=20W?= =?UTF-8?q?IP=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pialert/device.py | 11 ++--------- pialert/reporting.py | 6 ++++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/pialert/device.py b/pialert/device.py index 580e52fa..5ed3d7ab 100755 --- a/pialert/device.py +++ b/pialert/device.py @@ -14,17 +14,10 @@ def save_scanned_devices (db): sql = db.sql #TO-DO - # #76 Add Local MAC of default local interface - # BUGFIX #106 - Device that pialert is running - # local_mac_cmd = ["bash -lc ifconfig `ip route list default | awk {'print $5'}` | grep ether | awk '{print $2}'"] - # local_mac_cmd = ["/sbin/ifconfig `ip route list default | sort -nk11 | head -1 | awk {'print $5'}` | grep ether | awk '{print $2}'"] + # Add Local MAC of default local interface local_mac_cmd = ["/sbin/ifconfig `ip -o route get 1 | sed 's/^.*dev \\([^ ]*\\).*$/\\1/;q'` | grep ether | awk '{print $2}'"] local_mac = subprocess.Popen (local_mac_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0].decode().strip() - # local_dev_cmd = ["ip -o route get 1 | sed 's/^.*dev \\([^ ]*\\).*$/\\1/;q'"] - # local_dev = subprocess.Popen (local_dev_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0].decode().strip() - - # local_ip_cmd = ["ip route list default | awk {'print $7'}"] local_ip_cmd = ["ip -o route get 1 | sed 's/^.*src \\([^ ]*\\).*$/\\1/;q'"] local_ip = subprocess.Popen (local_ip_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0].decode().strip() @@ -149,7 +142,7 @@ def create_new_devices (db): FROM CurrentScan""" - # mylog('debug',f'[New Devices] 2 Create devices SQL: {sqlQuery}') + mylog('debug',f'[New Devices] 2 Create devices SQL: {sqlQuery}') sql.execute (sqlQuery, (startTime, startTime) ) diff --git a/pialert/reporting.py b/pialert/reporting.py index 4dc99941..510af85e 100755 --- a/pialert/reporting.py +++ b/pialert/reporting.py @@ -259,10 +259,12 @@ def get_notifications (db): write_file (logPath + '/report_output.txt', final_text) write_file (logPath + '/report_output.html', final_html) + mylog('minimal', ['[Notification] Udating API files']) + send_api() + return noti_obj(final_json, final_text, final_html) - # mylog('minimal', ['[Notification] Udating API files']) - # send_api() + # if conf.REPORT_MAIL and check_config('email'): # updateState("Send: Email")