diff --git a/back/pialert.py b/back/pialert.py index f9f59b28..1a1e5da7 100644 --- a/back/pialert.py +++ b/back/pialert.py @@ -374,7 +374,7 @@ def scan_network (): read_DHCP_leases () # Load current scan data - print ('\nProcesising scan results...') + print ('\nProcessing scan results...') print_log ('Save scanned devices') save_scanned_devices (arpscan_devices, cycle_interval) @@ -598,10 +598,12 @@ def save_scanned_devices (p_arpscan_devices, p_cycle_interval): # 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() - - sql.execute ("INSERT INTO CurrentScan (cur_ScanCycle, cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod) "+ - "VALUES ( ?, ?, ?, Null, 'local_MAC') ", (cycle, local_mac, local_ip) ) + # Check if local mac has been detected with other methods + sql.execute ("SELECT COUNT(*) FROM CurrentScan WHERE cur_ScanCycle = ? AND cur_MAC = ? ", (cycle, local_mac) ) + if sql.fetchone()[0] == 0 : + sql.execute ("INSERT INTO CurrentScan (cur_ScanCycle, cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod) "+ + "VALUES ( ?, ?, ?, Null, 'local_MAC') ", (cycle, local_mac, local_ip) ) #------------------------------------------------------------------------------- def print_scan_stats (): diff --git a/config/version.conf b/config/version.conf index c34c55b3..95646137 100644 --- a/config/version.conf +++ b/config/version.conf @@ -1,3 +1,3 @@ -VERSION = '3.01' +VERSION = '3.02' VERSION_YEAR = '2021' -VERSION_DATE = '2021-04-22' +VERSION_DATE = '2021-04-24' diff --git a/docs/INSTALL.md b/docs/INSTALL.md index a9a72127..f0a78a41 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -93,7 +93,7 @@ Estimated time: 20' ``` or this one if have severals interfaces ``` - ip -o route get 1 | sed -n 's/.*src \([0-9.]\+\).*/\1/p' + ip -o route get 1 | sed 's/^.*src \([^ ]*\).*$/\1/;q' ``` - http://192.168.1.x/admin/ @@ -108,7 +108,7 @@ Estimated time: 20' ``` or this one if have severals interfaces ``` - ip -o route get 1 | sed -n 's/.*src \([0-9.]\+\).*/\1/p' + ip -o route get 1 | sed 's/^.*src \([^ ]*\).*$/\1/;q' ``` - Pi-hole admin portal -> Local DNS -> DNS Records -> Add new domain /IP @@ -129,27 +129,37 @@ Estimated time: 20' If you have installed Pi.hole, lighttpd and PHP are already installed and this block is not necessary -3.1 - Install lighttpd +3.1 - Install apt-utils + ``` + sudo apt-get install apt-utils -y + ``` + +3.2 - Install lighttpd ``` sudo apt-get install lighttpd -y ``` -3.2 - If Pi.Alert will be the only site available in this webserver, you can +3.3 - If Pi.Alert will be the only site available in this webserver, you can redirect the default server page to pialert subfolder ``` sudo mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old sudo ln -s ~/pialert/install/index.html /var/www/html/index.html ``` -3.3 - Install PHP +3.4 - Install PHP ``` sudo apt-get install php php-cgi php-fpm php-sqlite3 -y ``` -3.4 - Activate PHP +3.5 - Activate PHP ``` sudo lighttpd-enable-mod fastcgi-php - sudo /etc/init.d/lighttpd restart + sudo service lighttpd restart + ``` + +3.6 - Install sqlite3 + ``` + sudo apt-get install sqlite3 -y ``` @@ -161,9 +171,9 @@ block is not necessary sudo arp-scan -l ``` -4.2 - Install dnsutils utility +4.2 - Install dnsutils & net-tools utilities ``` - sudo apt-get install dnsutils -y + sudo apt-get install dnsutils net-tools -y ``` 4.3 - Test Python @@ -235,9 +245,11 @@ block is not necessary - If you want to use email reporting, configure this parameters ```ini REPORT_MAIL = True + REPORT_TO = 'user@gmail.com' + SMTP_SERVER = 'smtp.gmail.com' + SMTP_PORT = 587 SMTP_USER = 'user@gmail.com' SMTP_PASS = 'password' - REPORT_TO = 'user@gmail.com' ``` - If you want to update your Dynamic DNS, configure this parameters @@ -303,7 +315,7 @@ block is not necessary ``` or this one if have severals interfaces ``` - ip -o route get 1 | sed -n 's/.*src \([0-9.]\+\).*/\1/p' + ip -o route get 1 | sed 's/^.*src \([^ ]*\).*$/\1/;q' ``` - Pi-hole admin portal -> Local DNS -> DNS Records -> Add new domain /IP - pi.alert 192.168.1.x diff --git a/docs/VERSIONS_HISTORY.md b/docs/VERSIONS_HISTORY.md index 8dd67cb5..94c34ac5 100644 --- a/docs/VERSIONS_HISTORY.md +++ b/docs/VERSIONS_HISTORY.md @@ -14,6 +14,12 @@ | v2.50 | First public release | +## Pi.Alert v3.02 + + **PENDING UPDATE DOC** + - Fixed: UNIQUE constraint failed with Local MAC #114 + + ## Pi.Alert v3.01 **PENDING UPDATE DOC** diff --git a/install/pialert_install.sh b/install/pialert_install.sh index b2d2490b..1dc56ec9 100644 --- a/install/pialert_install.sh +++ b/install/pialert_install.sh @@ -330,7 +330,7 @@ install_lighttpd() { fi print_msg "- Restarting lighttpd..." - sudo sudo service lighttpd restart 2>&1 >> "$LOG" + sudo service lighttpd restart 2>&1 >> "$LOG" # sudo /etc/init.d/lighttpd restart 2>&1 >> "$LOG" print_msg "- Installing sqlite3..." diff --git a/tar/create_tar.sh b/tar/create_tar.sh index aecfd4fb..b0735de3 100644 --- a/tar/create_tar.sh +++ b/tar/create_tar.sh @@ -8,12 +8,10 @@ # Puche 2021 pi.alert.application@gmail.com GNU GPLv3 # ------------------------------------------------------------------------------ -PIALERT_VERSION=`awk '$1=="VERSION" { print $3 }' ../config/version.conf | tr -d \'` PIALERT_DEV_PATH=/media/WD_4TB/dev - -# ------------------------------------------------------------------------------ cd $PIALERT_DEV_PATH pwd +PIALERT_VERSION=`awk '$1=="VERSION" { print $3 }' pialert/config/version.conf | tr -d \'` # ------------------------------------------------------------------------------ ls -l pialert/tar/pialert*.tar diff --git a/tar/pialert_3.01.tar b/tar/pialert_3.02.tar similarity index 99% rename from tar/pialert_3.01.tar rename to tar/pialert_3.02.tar index c30e712e..ae163da4 100644 Binary files a/tar/pialert_3.01.tar and b/tar/pialert_3.02.tar differ diff --git a/tar/pialert_latest.tar b/tar/pialert_latest.tar index c30e712e..ae163da4 100644 Binary files a/tar/pialert_latest.tar and b/tar/pialert_latest.tar differ