Fix bug #2
This commit is contained in:
pucherot
2021-01-11 15:55:43 +01:00
parent 8bf95aed5b
commit 424cf11752
10 changed files with 30 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
VERSION = '2.51' VERSION = '2.52'
VERSION_YEAR = '2021' VERSION_YEAR = '2021'
VERSION_DATE = '2021-01-11' VERSION_DATE = '2021-01-11'

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# Pi.Alert v2.51 / 2021-01-11 # Pi.Alert v2.52 / 2021-01-11
# Puche 2020 # Puche 2020
# GNU GPLv3 # GNU GPLv3
@@ -645,11 +645,12 @@ def create_new_devices ():
# Pi-hole - Insert events for new devices # Pi-hole - Insert events for new devices
# NOT STRICYLY NECESARY (Devices can be created through Current_Scan) # NOT STRICYLY NECESARY (Devices can be created through Current_Scan)
# Bugfix #2 - Pi-hole devices w/o IP
print_log ('New devices - 3 Pi-hole Events') print_log ('New devices - 3 Pi-hole Events')
sql.execute ("""INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute ("""INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime,
eve_EventType, eve_AdditionalInfo, eve_EventType, eve_AdditionalInfo,
eve_PendingAlertEmail) eve_PendingAlertEmail)
SELECT PH_MAC, PH_IP, ?, 'New Device', SELECT PH_MAC, IFNULL (PH_IP,'-'), ?, 'New Device',
'(Pi-Hole) ' || PH_Vendor, 1 '(Pi-Hole) ' || PH_Vendor, 1
FROM PiHole_Network FROM PiHole_Network
WHERE NOT EXISTS (SELECT 1 FROM Devices WHERE NOT EXISTS (SELECT 1 FROM Devices
@@ -657,13 +658,14 @@ def create_new_devices ():
(startTime, ) ) (startTime, ) )
# Pi-hole - Create New Devices # Pi-hole - Create New Devices
# Bugfix #2 - Pi-hole devices w/o IP
print_log ('New devices - 4 Pi-hole Create devices') print_log ('New devices - 4 Pi-hole Create devices')
sql.execute ("""INSERT INTO Devices (dev_MAC, dev_name, dev_Vendor, sql.execute ("""INSERT INTO Devices (dev_MAC, dev_name, dev_Vendor,
dev_LastIP, dev_FirstConnection, dev_LastConnection, dev_LastIP, dev_FirstConnection, dev_LastConnection,
dev_ScanCycle, dev_AlertEvents, dev_AlertDeviceDown, dev_ScanCycle, dev_AlertEvents, dev_AlertDeviceDown,
dev_PresentLastScan) dev_PresentLastScan)
SELECT PH_MAC, PH_Name, PH_Vendor, PH_IP, ?, ?, SELECT PH_MAC, PH_Name, PH_Vendor, IFNULL (PH_IP,'-'),
1, 1, 0, 1 ?, ?, 1, 1, 0, 1
FROM PiHole_Network FROM PiHole_Network
WHERE NOT EXISTS (SELECT 1 FROM Devices WHERE NOT EXISTS (SELECT 1 FROM Devices
WHERE dev_MAC = PH_MAC) """, WHERE dev_MAC = PH_MAC) """,

View File

@@ -16,7 +16,7 @@
<td> <td>
<table width=100% border=0 bgcolor=#FFD966 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 16px; text-align:center; color:#5F5000"> <table width=100% border=0 bgcolor=#FFD966 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 16px; text-align:center; color:#5F5000">
<tr> <tr>
<td width=33%> Report Date: <b>2021-01-11 08:00</b> </td> <td width=33%> Report Date: <b>2021-01-01 08:00</b> </td>
<td width=34%> Scan Cycle: <b>Internet</b> </td> <td width=34%> Scan Cycle: <b>Internet</b> </td>
<td width=33%> Server: <b>pi4</b> </td> <td width=33%> Server: <b>pi4</b> </td>
</tr> </tr>
@@ -39,7 +39,7 @@
<tr> <tr>
<td> Internet IP Changed </td> <td> Internet IP Changed </td>
<td> 2021-01-02 08:20:00 </td> <td> 2021-01-01 08:00:00 </td>
<td style="font-size: 24px; color:#D02020"> 1.1.1.0 </td> <td style="font-size: 24px; color:#D02020"> 1.1.1.0 </td>
<td> Previous Internet IP: 1.1.0.0 </td> <td> Previous Internet IP: 1.1.0.0 </td>
</tr> </tr>
@@ -59,7 +59,7 @@
<table width=100% border=0 bgcolor=#70AD47 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 12px; font-weight: bold; color:#385723"> <table width=100% border=0 bgcolor=#70AD47 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 12px; font-weight: bold; color:#385723">
<tr> <tr>
<td width=25% style="text-align:Left"> Puche 2021</td> <td width=25% style="text-align:Left"> Puche 2021</td>
<td width=50% style="text-align:center"> Pi.Alert 2.51 &nbsp; / &nbsp; 2021-01-11 </td> <td width=50% style="text-align:center"> Pi.Alert 2.50 &nbsp; / &nbsp; 2021-01-01 </td>
<td width=25% style="text-align:right"> GNU GPLv3</td> <td width=25% style="text-align:right"> GNU GPLv3</td>
</tr> </tr>
</table> </table>

View File

@@ -16,7 +16,7 @@
<td> <td>
<table width=100% border=0 bgcolor=#FFD966 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 16px; text-align:center; color:#5F5000"> <table width=100% border=0 bgcolor=#FFD966 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 16px; text-align:center; color:#5F5000">
<tr> <tr>
<td width=33%> Report Date: <b>2021-01-11 08:00</b> </td> <td width=33%> Report Date: <b>2021-01-01 08:00</b> </td>
<td width=34%> Scan Cycle: <b>1</b> </td> <td width=34%> Scan Cycle: <b>1</b> </td>
<td width=33%> Server: <b>pi4</b> </td> <td width=33%> Server: <b>pi4</b> </td>
</tr> </tr>
@@ -43,13 +43,13 @@
<tr> <tr>
<td> f8:d0:27:00:00:00 </td> <td> f8:d0:27:00:00:00 </td>
<td> 2021-01-02 08:20:00 </td> <td> 2021-01-01 08:00:00 </td>
<td> 192.168.1.20 </td> <td> 192.168.1.20 </td>
<td> Seiko Epson Corporation </td> <td> Seiko Epson Corporation </td>
</tr> </tr>
<tr> <tr>
<td> c8:6c:3d:00:00:00 </td> <td> c8:6c:3d:00:00:00 </td>
<td> 2021-01-02 08:20:00 </td> <td> 2021-01-01 08:00:00 </td>
<td> 192.168.1.181 </td> <td> 192.168.1.181 </td>
<td> Amazon Technologies Inc. </td> <td> Amazon Technologies Inc. </td>
</tr> </tr>
@@ -72,7 +72,7 @@
<tr> <tr>
<td> 0c:ee:99:00:00:00 </td> <td> 0c:ee:99:00:00:00 </td>
<td> 2021-01-02 08:20:00 </td> <td> 2021-01-01 08:00:00 </td>
<td> 192.168.1.171 </td> <td> 192.168.1.171 </td>
<td> Alexa - Echo </td> <td> Alexa - Echo </td>
</tr> </tr>
@@ -97,7 +97,7 @@
<tr> <tr>
<td> 94:0c:98:00:00:00 </td> <td> 94:0c:98:00:00:00 </td>
<td> 2021-01-02 08:20:00 </td> <td> 2021-01-01 08:00:00 </td>
<td> 192.168.1.132 </td> <td> 192.168.1.132 </td>
<td> Connected </td> <td> Connected </td>
<td> Person 1 - iPhone 11 </td> <td> Person 1 - iPhone 11 </td>
@@ -105,7 +105,7 @@
</tr> </tr>
<tr> <tr>
<td> 5c:41:5a:00:00:00 </td> <td> 5c:41:5a:00:00:00 </td>
<td> 2021-01-02 08:20:00 </td> <td> 2021-01-01 08:00:00 </td>
<td> 192.168.1.170 </td> <td> 192.168.1.170 </td>
<td> IP Changed </td> <td> IP Changed </td>
<td> Alexa Dot </td> <td> Alexa Dot </td>
@@ -122,7 +122,7 @@
<table width=100% border=0 bgcolor=#70AD47 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 12px; font-weight: bold; color:#385723"> <table width=100% border=0 bgcolor=#70AD47 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 12px; font-weight: bold; color:#385723">
<tr> <tr>
<td width=25% style="text-align:Left"> Puche 2021</td> <td width=25% style="text-align:Left"> Puche 2021</td>
<td width=50% style="text-align:center"> Pi.Alert 2.51 &nbsp; / &nbsp; 2021-01-11 </td> <td width=50% style="text-align:center"> Pi.Alert 2.50 &nbsp; / &nbsp; 2021-01-01 </td>
<td width=25% style="text-align:right"> GNU GPLv3</td> <td width=25% style="text-align:right"> GNU GPLv3</td>
</tr> </tr>
</table> </table>

View File

@@ -4,7 +4,7 @@
&copy; 2021 Puche &copy; 2021 Puche
<!-- To the right --> <!-- To the right -->
<div class="pull-right no-hidden-xs"> <div class="pull-right no-hidden-xs">
Pi.alert&nbsp&nbsp2.51&nbsp&nbsp<small>(2021-01-11)</small> Pi.alert&nbsp&nbsp2.52&nbsp&nbsp<small>(2021-01-11)</small>
</div> </div>
</footer> </footer>

View File

@@ -1,9 +1,16 @@
# #
PIALERT_VERSION=2.50 PIALERT_VERSION=2.52
PIALERT_DEV_PATH=/media/WD_4TB/dev PIALERT_DEV_PATH=/media/WD_4TB/dev
cd $PIALERT_DEV_PATH cd $PIALERT_DEV_PATH
tar tvf pialert/install/pialert_$PIALERT_VERSION.tar | wc -l tar tvf pialert/install/pialert_$PIALERT_VERSION.tar | wc -l
rm pialert/install/pialert_$PIALERT_VERSION.tar rm pialert/install/pialert_$PIALERT_VERSION.tar
tar cvf pialert/install/pialert_$PIALERT_VERSION.tar --exclude="pialert/install" --exclude="pialert/.git" pialert | wc -l tar cvf pialert/install/pialert_$PIALERT_VERSION.tar --exclude="pialert/install" --exclude="pialert/.git" pialert | wc -l
rm pialert/install/pialert_latest.tar
ln -s pialert_$PIALERT_VERSION.tar pialert/install/pialert_latest.tar

Binary file not shown.

View File

@@ -16,7 +16,7 @@
<td> <td>
<table width=100% border=0 bgcolor=#FFD966 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 16px; text-align:center; color:#5F5000"> <table width=100% border=0 bgcolor=#FFD966 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 16px; text-align:center; color:#5F5000">
<tr> <tr>
<td width=33%> Report Date: <b>2021-01-04 18:08</b> </td> <td width=33%> Report Date: <b>2021-01-01 08:00</b> </td>
<td width=34%> Scan Cycle: <b>1</b> </td> <td width=34%> Scan Cycle: <b>1</b> </td>
<td width=33%> Server: <b>pi4</b> </td> <td width=33%> Server: <b>pi4</b> </td>
</tr> </tr>
@@ -35,7 +35,7 @@
<table width=100% border=0 bgcolor=#70AD47 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 12px; font-weight: bold; color:#385723"> <table width=100% border=0 bgcolor=#70AD47 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 12px; font-weight: bold; color:#385723">
<tr> <tr>
<td width=25% style="text-align:Left"> Puche 2021</td> <td width=25% style="text-align:Left"> Puche 2021</td>
<td width=50% style="text-align:center"> Pi.Alert DEV 2.51 &nbsp; / &nbsp; 2021-01-11 </td> <td width=50% style="text-align:center"> Pi.Alert 2.50 &nbsp; / &nbsp; 2021-01-01 </td>
<td width=25% style="text-align:right"> GNU GPLv3</td> <td width=25% style="text-align:right"> GNU GPLv3</td>
</tr> </tr>
</table> </table>

View File

@@ -2,7 +2,7 @@
Pi.Alert Report Pi.Alert Report
======================================== ========================================
Report Date: 2021-01-11 00:00 Report Date: 2021-01-01 08:00
Scan Cycle: 1 Scan Cycle: 1
Server: pi4 Server: pi4
@@ -12,4 +12,4 @@ Events
---------------------------------------------------------------------- ----------------------------------------------------------------------
Puche 2021 Pi.Alert 2.51 / 2021-01-11 GNU GPLv3 Puche 2021 Pi.Alert 2.50 / 2021-01-01 GNU GPLv3