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")