Back 2.50

This commit is contained in:
pucherot
2021-01-05 11:22:16 +01:00
committed by GitHub
parent 15b52ab024
commit fe27c7f633
5 changed files with 1522 additions and 0 deletions

28
back/pialert.conf Normal file
View File

@@ -0,0 +1,28 @@
VERSION = '2.50'
VERSION_YEAR = '2020'
VERSION_DATE = '2020-12-30'
DB_PATH = '/home/pi/pialert/db/dev.db'
LOG_PATH = '/home/pi/pialert/log'
VENDORS_DB = '/usr/share/arp-scan/ieee-oui.txt'
PA_FRONT_URL = 'http://pi.alert/deviceDetails.php?mac='
PRINT_LOG = False
SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587
SMTP_USER = 'user@gmail.com'
SMTP_PASS = 'password'
REPORT_MAIL = False
REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>'
REPORT_TO = 'user@gmail.com'
DDNS_DOMAIN = 'your_domain.freeddns.org'
DDNS_USER = 'dynu_user'
DDNS_PASSWORD = 'A0000000B0000000C0000000D0000000'
DDNS_UPDATE_URL = 'https://api.dynu.com/nic/update?'
PIHOLE_ACTIVE = True
PIHOLE_DB = '/etc/pihole/pihole-FTL.db'
DHCP_ACTIVE = True
DHCP_LEASES = '/etc/pihole/dhcp.leases'

1299
back/pialert.py Normal file

File diff suppressed because it is too large Load Diff

114
back/report_template.html Normal file
View File

@@ -0,0 +1,114 @@
<html>
<head>
</head>
<body>
<font face=sans-serif>
<table align=center width=80% border=1 bordercolor=#909090 cellpadding=0 cellspacing=0 style="border-collapse: collapse; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.5)">
<tr>
<td bgcolor=#EFB956 align=center style="padding: 20px 10px 10px 10px; font-size: 36px; font-weight: bold; color:#7F6000; text-shadow: 4px 4px 6px #909090">
Pi.Alert Report
</td>
</tr>
<tr>
<td>
<table width=100% border=0 bgcolor=#FFD966 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 16px; text-align:center; color:#5F5000">
<tr>
<td width=33%> Report Date: <b><REPORT_DATE></b> </td>
<td width=34%> Scan Cycle: <b><SCAN_CYCLE></b> </td>
<td width=33%> Server: <b><SERVER_NAME></b> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor=#F5F5F5 height=200 valign=top style="padding: 10px">
<SECTION_INTERNET>
<p style="font-size: 24px; font-weight: bold; color:#C04040; text-shadow: 2px 2px 4px #A0A0A0"> Internet: </p>
<table width=100% border=1 bordercolor=#C0C0C0 cellpadding=3px cellspacing=0 style="border-collapse: collapse; font-size: 12px; color:#707070; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<tr bgcolor=#909090 style="color:#F0F0F0">
<th width=140> Event Type </th>
<th width=130> Datetime </th>
<th width=100> IP </th>
<th> Additional Info </th>
</tr>
<TABLE_INTERNET>
</table>
<br>
</SECTION_INTERNET>
<SECTION_NEW_DEVICES>
<p style="font-size: 14px; font-weight: bold; color:#C04040; text-shadow: 2px 2px 4px #A0A0A0"> New Devices: </p>
<table width=100% border=1 bordercolor=#C0C0C0 cellpadding=3px cellspacing=0 style="border-collapse: collapse; font-size: 12px; color:#707070; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<tr bgcolor=#909090 style="color:#F0F0F0">
<th width=140> MAC </th>
<th width=130> Datetime </th>
<th width=100> IP </th>
<th width=140> Device Name </th>
<th> Vendor </th>
</tr>
<TABLE_NEW_DEVICES>
</table>
<br>
</SECTION_NEW_DEVICES>
<SECTION_DEVICES_DOWN>
<p style="font-size: 14px; font-weight: bold; color:#C04040; text-shadow: 2px 2px 4px #A0A0A0"> Devices Down: </p>
<table width=100% border=1 bordercolor=#C0C0C0 cellpadding=3px cellspacing=0 style="border-collapse: collapse; font-size: 12px; color:#707070; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<tr bgcolor=#909090 style="color:#F0F0F0">
<th width=140> MAC </th>
<th width=130> Datetime </th>
<th width=100> IP </th>
<th> Device Name </th>
</tr>
<TABLE_DEVICES_DOWN>
</table>
<br>
</SECTION_DEVICES_DOWN>
<SECTION_EVENTS>
<p style="font-size: 14px; font-weight: bold; color:#409040; text-shadow: 2px 2px 4px #A0A0A0"> Events: </p>
<table width=100% border=1 bordercolor=#C0C0C0 cellpadding=3px cellspacing=0 style="border-collapse: collapse; font-size: 12px; color:#707070; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<tr bgcolor=#909090 style="color:#F0F0F0">
<th width=140> MAC </th>
<th width=130> Datetime </th>
<th width=100> IP </th>
<th width=100> Event Type </th>
<th width=140> Device Name </th>
<th> Additional Info </th>
</tr>
<TABLE_EVENTS>
</table>
</SECTION_EVENTS>
</td>
</tr>
<tr>
<td>
<table width=100% border=0 bgcolor=#70AD47 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 12px; font-weight: bold; color:#385723">
<tr>
<td width=25% style="text-align:Left"> Puche <PIALERT_YEAR></td>
<td width=50% style="text-align:center"> Pi.Alert <PIALERT_VERSION> &nbsp; / &nbsp; <PIALERT_VERSION_DATE> </td>
<td width=25% style="text-align:right"> GNU GPLv3</td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</body>
</html>

27
back/report_template.txt Normal file
View File

@@ -0,0 +1,27 @@
========================================
Pi.Alert Report
========================================
Report Date: <REPORT_DATE>
Scan Cycle: <SCAN_CYCLE>
Server: <SERVER_NAME>
<SECTION_INTERNET>
Internet
----------------------------------------------------------------------
<TABLE_INTERNET>
</SECTION_INTERNET><SECTION_NEW_DEVICES>
New Devices
----------------------------------------------------------------------
<TABLE_NEW_DEVICES>
</SECTION_NEW_DEVICES><SECTION_DEVICES_DOWN>
Devices Down
----------------------------------------------------------------------
<TABLE_DEVICES_DOWN>
</SECTION_DEVICES_DOWN><SECTION_EVENTS>
Events
----------------------------------------------------------------------
<TABLE_EVENTS>
</SECTION_EVENTS>
----------------------------------------------------------------------
Puche <PIALERT_YEAR> Pi.Alert <PIALERT_VERSION> / <PIALERT_VERSION_DATE> GNU GPLv3

54
back/vendors_db_update.sh Normal file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
#
# Update MAC Vendor DB
#
# /usr/share/arp-scan
# /usr/share/ieee-data
# /var/lib/ieee-data
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
echo Updating... /usr/share/ieee-data/
cd /usr/share/ieee-data/
sudo mkdir -p 2_backup
sudo cp *.txt 2_backup
sudo cp *.csv 2_backup
sudo curl -# -O http://standards-oui.ieee.org/iab/iab.csv
sudo curl -# -O http://standards-oui.ieee.org/iab/iab.txt
sudo curl -# -O http://standards-oui.ieee.org/oui28/mam.csv
sudo curl -# -O http://standards-oui.ieee.org/oui28/mam.txt
sudo curl -# -O http://standards-oui.ieee.org/oui36/oui36.csv
sudo curl -# -O http://standards-oui.ieee.org/oui36/oui36.txt
sudo curl -# -O http://standards-oui.ieee.org/oui/oui.csv
sudo curl -# -O http://standards-oui.ieee.org/oui/oui.txt
# ----------------------------------------------------------------------
echo ""
echo Updating... /usr/share/arp-scan/
cd /usr/share/arp-scan
sudo mkdir -p 2_backup
sudo cp *.txt 2_backup
# Update from /usb/lib/ieee-data
sudo get-iab -v
sudo get-oui -v
# Update from ieee website
# sudo get-iab -v -u http://standards-oui.ieee.org/iab/iab.txt
# sudo get-oui -v -u http://standards-oui.ieee.org/oui/oui.txt
# Update from ieee website develop
# sudo get-iab -v -u http://standards.ieee.org/develop/regauth/iab/iab.txt
# sudo get-oui -v -u http://standards.ieee.org/develop/regauth/oui/oui.txt
# Update from Sanitized oui (linuxnet.ca)
# sudo get-oui -v -u https://linuxnet.ca/ieee/oui.txt