Compare commits
194 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5faf6fb419 | ||
|
|
b1f946e1e6 | ||
|
|
bcea3e1a97 | ||
|
|
bcda186cbe | ||
|
|
02215c87eb | ||
|
|
024e97f138 | ||
|
|
c56c7609cc | ||
|
|
d723b37622 | ||
|
|
b461bf4ef7 | ||
|
|
6e8bb4c2ea | ||
|
|
0446f6302e | ||
|
|
a0b0c0ba19 | ||
|
|
cb0a62396f | ||
|
|
3315994356 | ||
|
|
c3798ff102 | ||
|
|
43c0df086a | ||
|
|
98745805d3 | ||
|
|
1dbdf425d6 | ||
|
|
b3d05332e5 | ||
|
|
98fb02282b | ||
|
|
536d789535 | ||
|
|
d0284a0603 | ||
|
|
4d433b633f | ||
|
|
388844f2bc | ||
|
|
2fc63daf23 | ||
|
|
c9bc3e9447 | ||
|
|
4a754cdae5 | ||
|
|
1bb1d528f4 | ||
|
|
770d9bfe4a | ||
|
|
8e3aa0407a | ||
|
|
acb756a871 | ||
|
|
85e6319760 | ||
|
|
66ffb5ebca | ||
|
|
e548138b9f | ||
|
|
2a5a2693ce | ||
|
|
efee89dcc1 | ||
|
|
74894b519f | ||
|
|
1a08a88b9e | ||
|
|
e3e0e62d77 | ||
|
|
235264ed1e | ||
|
|
a5aa3d550d | ||
|
|
79b5429a01 | ||
|
|
45dd94e5d5 | ||
|
|
e0d5970643 | ||
|
|
1fc11cd49f | ||
|
|
e5be488b3f | ||
|
|
77ba2e1362 | ||
|
|
89aa38ecc1 | ||
|
|
0c35577a68 | ||
|
|
cd9e244efd | ||
|
|
ae876484a4 | ||
|
|
7720bba5dc | ||
|
|
d1b1f078aa | ||
|
|
8839ed5932 | ||
|
|
c5987778b6 | ||
|
|
abe9ff5b2c | ||
|
|
e231600b88 | ||
|
|
3ccad7a564 | ||
|
|
8cf034ed29 | ||
|
|
9784092c7f | ||
|
|
ef3fe4dd52 | ||
|
|
7530fb0e23 | ||
|
|
49211719f0 | ||
|
|
430e53820a | ||
|
|
170772eb7c | ||
|
|
6f1d795c60 | ||
|
|
3d1178bd16 | ||
|
|
17f2421836 | ||
|
|
c61a5bedcf | ||
|
|
a318a15cad | ||
|
|
f430587965 | ||
|
|
de3b0c7ffc | ||
|
|
689f54cdc3 | ||
|
|
cee24e0b6c | ||
|
|
2e713bf1d0 | ||
|
|
d774901b6d | ||
|
|
7d7f3df226 | ||
|
|
07c2cd1af4 | ||
|
|
ddd28a0607 | ||
|
|
fa92df6567 | ||
|
|
76a3efe039 | ||
|
|
601ed15f20 | ||
|
|
2a3b505dff | ||
|
|
9550227672 | ||
|
|
89c0750463 | ||
|
|
0fa71362b8 | ||
|
|
d8df097e83 | ||
|
|
67c20cabc3 | ||
|
|
5867961383 | ||
|
|
649e280ce1 | ||
|
|
9d982eff1b | ||
|
|
6ac8225b19 | ||
|
|
55ed3c4ae0 | ||
|
|
5d0804639c | ||
|
|
6edb623b9c | ||
|
|
8c2a1e17d9 | ||
|
|
2a2f96d726 | ||
|
|
ec705df38b | ||
|
|
cb20fad13b | ||
|
|
969cae0343 | ||
|
|
f9652258e9 | ||
|
|
6bb891f830 | ||
|
|
4659d2c941 | ||
|
|
8644818949 | ||
|
|
de62956c40 | ||
|
|
3547aec75f | ||
|
|
21b5d775d2 | ||
|
|
0973bc538e | ||
|
|
bf2c4b87ab | ||
|
|
b03087c1c5 | ||
|
|
b814a856d0 | ||
|
|
f6b69a63e2 | ||
|
|
df499ea33c | ||
|
|
007611c429 | ||
|
|
12bf4c7bcc | ||
|
|
5b05be24ad | ||
|
|
f50e3d4e92 | ||
|
|
7177cdd51d | ||
|
|
a71f16ee37 | ||
|
|
070e31ef19 | ||
|
|
42df2b255a | ||
|
|
52027c65b3 | ||
|
|
a2f2bce3ab | ||
|
|
ebcf6fa49b | ||
|
|
c14c762bde | ||
|
|
fd50ab7deb | ||
|
|
0db7521bee | ||
|
|
3adfa2c268 | ||
|
|
e27610a199 | ||
|
|
bd43a16975 | ||
|
|
eb56126224 | ||
|
|
7945fce65d | ||
|
|
8a7ddfbb47 | ||
|
|
03163e424f | ||
|
|
d5b7023927 | ||
|
|
884aca149a | ||
|
|
1836567f97 | ||
|
|
78f71abd31 | ||
|
|
0f63497847 | ||
|
|
8a1e472fed | ||
|
|
3831b5a50a | ||
|
|
3756e1a327 | ||
|
|
c9eb866acd | ||
|
|
55530c05f9 | ||
|
|
422997be9b | ||
|
|
13ff086412 | ||
|
|
298b5ac03e | ||
|
|
e9af2efbd1 | ||
|
|
4027970975 | ||
|
|
0ca7116167 | ||
|
|
1474cf424b | ||
|
|
b763d75703 | ||
|
|
a0501d88ec | ||
|
|
f62d94ba61 | ||
|
|
e99d855284 | ||
|
|
31b78ff106 | ||
|
|
ae0c45a716 | ||
|
|
0105844410 | ||
|
|
07e8395536 | ||
|
|
6c8fc093af | ||
|
|
95a7dcc7fc | ||
|
|
c54156ca1e | ||
|
|
941a8ef661 | ||
|
|
fc79ffc956 | ||
|
|
8e86343942 | ||
|
|
bb87e65745 | ||
|
|
d1989acd5c | ||
|
|
e5bc4ad41b | ||
|
|
927bdc2f2b | ||
|
|
2ff57d8272 | ||
|
|
49baf4b613 | ||
|
|
a573fd9841 | ||
|
|
e91b640bff | ||
|
|
8ee47e2fcc | ||
|
|
092797e75c | ||
|
|
816a01f8af | ||
|
|
3578bbfcad | ||
|
|
b4b15af887 | ||
|
|
c74ef127d1 | ||
|
|
90b3a491c7 | ||
|
|
ad41d02eeb | ||
|
|
19fe48c7ec | ||
|
|
f3d05ca222 | ||
|
|
4aa1848ece | ||
|
|
2176c58cb5 | ||
|
|
2b95daa248 | ||
|
|
e7c0bcf419 | ||
|
|
063682510e | ||
|
|
8542d05f66 | ||
|
|
42aa89971d | ||
|
|
abd607ea10 | ||
|
|
5936ba4626 | ||
|
|
a6c2b9254b | ||
|
|
62669fd181 |
46
.github/ISSUE_TEMPLATE/i-have-an-issue.md
vendored
@@ -7,40 +7,40 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the issue**
|
||||
## Describe the issue
|
||||
|
||||
> When submitting an issue ❗[enable debug](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/DEBUG_TIPS.md)❗ and [have a look at the docs](https://github.com/jokob-sk/Pi.Alert/tree/main/docs)
|
||||
|
||||
**Paste last few lines from `pialert.log`**
|
||||
[describe your issue]
|
||||
|
||||
## Paste your `pialert.conf` (remove personal info)
|
||||
|
||||
```
|
||||
|
||||
paste here
|
||||
|
||||
paste_here
|
||||
```
|
||||
|
||||
**Paste your `pialert.conf` (remove personal info)**
|
||||
|
||||
```
|
||||
|
||||
paste here
|
||||
|
||||
```
|
||||
|
||||
**Paste your `docker-compose.yml` and `.env` (remove personal info)**
|
||||
## Paste your `docker-compose.yml` and `.env` (remove personal info)
|
||||
|
||||
`docker-compose.yml`
|
||||
```
|
||||
|
||||
paste here
|
||||
|
||||
```
|
||||
|
||||
paste_here
|
||||
```
|
||||
|
||||
`.env`
|
||||
```
|
||||
|
||||
paste here
|
||||
|
||||
```
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
paste_here
|
||||
```
|
||||
|
||||
## Screenshots
|
||||
|
||||
[If applicable, add screenshots to help explain your problem.]
|
||||
|
||||
## Paste last few lines from `pialert.log`
|
||||
|
||||
> You can use `tail -100 /home/pi/pialert/front/log/pialert.log`
|
||||
|
||||
```bash
|
||||
|
||||
# paste code below
|
||||
|
||||
25
.github/workflows/docker_cache-cleaner.yml
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
name: ci-package-cleaner
|
||||
|
||||
on:
|
||||
|
||||
workflow_dispatch: # manual option
|
||||
|
||||
schedule:
|
||||
- cron: '15 22 * * 1' # every Monday 10.15pm UTC (~11.15am Tuesday NZT)
|
||||
|
||||
jobs:
|
||||
|
||||
package-cleaner:
|
||||
name: package-cleaner
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
|
||||
- uses: actions/delete-package-versions@v4
|
||||
with:
|
||||
package-name: pi.alert
|
||||
package-type: container
|
||||
min-versions-to-keep: 0
|
||||
delete-only-untagged-versions: true
|
||||
17
.github/workflows/docker_dev.yml
vendored
@@ -14,7 +14,13 @@ on:
|
||||
jobs:
|
||||
docker_dev:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.head_commit.message, 'PUSHPROD') != 'True'
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
if: >
|
||||
contains(github.event.head_commit.message, 'PUSHPROD') != 'True' &&
|
||||
github.repository == 'jokob-sk/Pi.Alert'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -47,6 +53,13 @@ jobs:
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
- name: Log in to Github Container registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: jokob-sk
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
@@ -62,3 +75,5 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache
|
||||
cache-to: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache,mode=max
|
||||
|
||||
21
.github/workflows/docker_prod.yml
vendored
@@ -17,6 +17,10 @@ on:
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -31,6 +35,13 @@ jobs:
|
||||
id: getargs
|
||||
run: echo "version=$(cat ./stable/VERSION)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get release version
|
||||
id: get_version
|
||||
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
|
||||
|
||||
- name: Create .VERSION file
|
||||
run: echo "${{ steps.get_version.outputs.version }}" >> .VERSION
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
@@ -46,6 +57,14 @@ jobs:
|
||||
type=ref,event=branch,suffix=-{{ sha }}
|
||||
type=ref,event=pr
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
|
||||
|
||||
- name: Log in to Github Container registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: jokob-sk
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
@@ -61,3 +80,5 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache
|
||||
cache-to: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache,mode=max
|
||||
|
||||
10
.gitignore
vendored
@@ -2,7 +2,15 @@
|
||||
.DS_Store
|
||||
config/pialert.conf
|
||||
db/*
|
||||
db/pialert.db
|
||||
front/log/*
|
||||
front/plugins/**/*.log
|
||||
**/plugins/**/*.log
|
||||
**/%40eaDir/
|
||||
**/@eaDir/
|
||||
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
**/last_result.log
|
||||
**/script.log
|
||||
10
Dockerfile
@@ -1,13 +1,14 @@
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
# default UID and GID
|
||||
ENV USER=pi USER_ID=1000 USER_GID=1000 TZ=Europe/London PORT=20211
|
||||
ENV USER=pi USER_ID=1000 USER_GID=1000 PORT=20211
|
||||
#TZ=Europe/London
|
||||
|
||||
# Todo, figure out why using a workdir instead of full paths don't work
|
||||
# Todo, do we still need all these packages? I can already see sudo which isn't needed
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends tini ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools python3 iproute2 nmap python3-pip zip -y \
|
||||
&& apt-get install --no-install-recommends tini snmp ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools python3 iproute2 nmap python3-pip zip -y \
|
||||
&& pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi \
|
||||
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
|
||||
&& apt-get clean autoclean \
|
||||
@@ -46,3 +47,8 @@ RUN rm /etc/nginx/sites-available/default \
|
||||
ENTRYPOINT ["tini", "--"]
|
||||
|
||||
CMD ["/home/pi/pialert/dockerfiles/start.sh"]
|
||||
|
||||
|
||||
|
||||
|
||||
## command to build docker: DOCKER_BUILDKIT=1 docker build . --iidfile dockerID
|
||||
23
README.md
@@ -14,7 +14,7 @@ Scans for devices connected to your WIFI / LAN and alerts you if new and unknown
|
||||
[](https://hub.docker.com/r/jokobsk/pi.alert)
|
||||
[](https://hub.docker.com/r/jokobsk/pi.alert)
|
||||
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) | 📚 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases)
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📑 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases) | 📚 [All Docs](https://github.com/jokob-sk/Pi.Alert/tree/main/docs)
|
||||
|
||||
## 🔍 Scan Methods
|
||||
The system continuously scans the network for, **New devices**, **New connections** (re-connections), **Disconnections**, **"Always Connected" devices down**, Devices **IP changes** and **Internet IP address changes**. Scanning methods are:
|
||||
@@ -31,8 +31,8 @@ The system continuously scans the network for, **New devices**, **New connection
|
||||
|
||||
## 🧩 Integrations
|
||||
- [Apprise](https://hub.docker.com/r/caronc/apprise), [Pushsafer](https://www.pushsafer.com/), [NTFY](https://ntfy.sh/)
|
||||
- [Webhooks](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/WEBHOOK_N8N.md) ([sample JSON](docs/webhook_json_sample.json))
|
||||
- Home Assistant via [MQTT](https://www.home-assistant.io/integrations/mqtt/) - discovery ~10s per device, use [MQTT Explorer](https://mqtt-explorer.com/) to delete devices
|
||||
- [Webhooks](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/WEBHOOK_N8N.md)
|
||||
- [Home Assistant](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/HOME_ASSISTANT.md)
|
||||
- [API endpoint](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/API.md)
|
||||
- [Plugin system](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins) for custom script monitoring
|
||||
|
||||
@@ -51,13 +51,14 @@ The system continuously scans the network for, **New devices**, **New connection
|
||||
- Theme Selection (blue, red, green, yellow, black, purple) and Light/Dark-Mode Switch
|
||||
- DB maintenance, Backup, Restore tools and CSV Export / Import
|
||||
- Simple login Support
|
||||
- 🌟(Experimental) [Plugin system](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins)
|
||||
- 🌟[Plugin system](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins)
|
||||
- Create custom plugins with automatically generated settings and UI.
|
||||
- Monitor anything for changes
|
||||
- Check the instructions carefully if you are up for a challenge! Current plugins include:
|
||||
- Detecting Rogue DHCP servers
|
||||
- Check the [instructions](https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins) carefully if you are up for a challenge! Current plugins include:
|
||||
- Detecting Rogue DHCP servers via NMAP
|
||||
- Monitoring HTTP status changes of domains/URLs
|
||||
- Import devices from DHCP.leases files or a UniFi controller
|
||||
- Import devices from DHCP.leases files, a UniFi controller, or an SNMP enabled router
|
||||
- Creation of dummy devices to visualize your [network map](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md)
|
||||
|
||||
| ![Screen 1][screen1] | ![Screen 2][screen2] | ![Screen 5][screen5] |
|
||||
|----------------------|----------------------| ----------------------|
|
||||
@@ -70,9 +71,10 @@ The system continuously scans the network for, **New devices**, **New connection
|
||||
- [WatchYourLAN](https://github.com/aceberg/WatchYourLAN) - Lightweight network IP scanner with web GUI (Open source)
|
||||
- [Fing](https://www.fing.com/) - Network scanner app for your Internet security (Commercial, Phone App, Proprietary hardware)
|
||||
|
||||
### Old docs
|
||||
### 📚 Documentation
|
||||
|
||||
Device Management [instructions](docs/DEVICE_MANAGEMENT.md) | Old Versions [History](docs/VERSIONS_HISTORY.md)
|
||||
- Initial Docker Setup: [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md)
|
||||
- App Usage and Configuration: [All Documentation](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/README.md)
|
||||
|
||||
### License
|
||||
GPL 3.0 | [Read more here](LICENSE.txt) | Source of the [animated GIF (Loading Animation)](https://commons.wikimedia.org/wiki/File:Loading_Animation.gif) | Source of the [selfhosted Fonts](https://github.com/adobe-fonts/source-sans)
|
||||
@@ -85,7 +87,8 @@ Device Management [instructions](docs/DEVICE_MANAGEMENT.md) | Old Versions [Hist
|
||||
- [leiweibau](https://github.com/leiweibau/Pi.Alert): Dark mode (and much more)
|
||||
- [Macleykun](https://github.com/Macleykun): Help with Dockerfile clean-up
|
||||
- [Final-Hawk](https://github.com/Final-Hawk): Help with NTFY, styling and other fixes
|
||||
- [TeroRERO](https://github.com/terorero): Spanish translation
|
||||
- [TeroRERO](https://github.com/terorero): Spanish translation
|
||||
- [Data-Monkey](https://github.com/Data-Monkey): Split-up of the python.py file and more
|
||||
- Please see the [Git contributors](https://github.com/jokob-sk/Pi.Alert/graphs/contributors) for a full list of people and their contributions to the project
|
||||
|
||||
## ☕ Support me
|
||||
|
||||
4309
back/pialert.py
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# repot_template.html - Back module. Template to email reporting in HTML format
|
||||
#-------------------------------------------------------------------------------
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||
# Puche 2021 GNU GPLv3
|
||||
#--------------------------------------------------------------------------- -->
|
||||
<html>
|
||||
<head></head>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# repot_template.html - Back module. Template to email reporting in HTML format
|
||||
#-------------------------------------------------------------------------------
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||
# Puche 2021 GNU GPLv3
|
||||
#--------------------------------------------------------------------------- -->
|
||||
|
||||
<html>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# repot_template.html - Back module. Template to email reporting in HTML format
|
||||
#-------------------------------------------------------------------------------
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||
# Puche 2021 GNU GPLv3
|
||||
#--------------------------------------------------------------------------- -->
|
||||
|
||||
<html>
|
||||
|
||||
@@ -2,23 +2,30 @@ version: "3"
|
||||
services:
|
||||
pialert:
|
||||
privileged: true
|
||||
build: .
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
cache_from:
|
||||
- type=registry,ref=docker.io/jokob-sk/pi.alert:buildcache
|
||||
container_name: pialert
|
||||
network_mode: "host"
|
||||
network_mode: host
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ${APP_DATA_LOCATION}/pialert2/config:/home/pi/pialert/config
|
||||
# - ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db
|
||||
- ${APP_DATA_LOCATION}/pialert2/db:/home/pi/pialert/db
|
||||
# - ${APP_DATA_LOCATION}/pialert_dev/config:/home/pi/pialert/config
|
||||
- ${APP_DATA_LOCATION}/pialert/config:/home/pi/pialert/config
|
||||
# - ${APP_DATA_LOCATION}/pialert_dev/db:/home/pi/pialert/db
|
||||
- ${APP_DATA_LOCATION}/pialert/db:/home/pi/pialert/db
|
||||
# (optional) useful for debugging if you have issues setting up the container
|
||||
- ${LOGS_LOCATION}:/home/pi/pialert/front/log
|
||||
# ---------------------------------------------------------------------------
|
||||
# DELETE START anyone trying to use this file: comment out / delete BELOW lines, they are only for development purposes
|
||||
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp1.leases:/mnt/dhcp1.leases
|
||||
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp2.leases:/mnt/dhcp2.leases
|
||||
- ${DEV_LOCATION}/back/pialert.py:/home/pi/pialert/back/pialert.py
|
||||
- ${DEV_LOCATION}/back/report_template.html:/home/pi/pialert/back/report_template.html
|
||||
- ${DEV_LOCATION}/back/report_template_new_version.html:/home/pi/pialert/back/report_template_new_version.html
|
||||
- ${DEV_LOCATION}/back/report_template.txt:/home/pi/pialert/back/report_template.txt
|
||||
# - ${DEV_LOCATION}/back/pialert.py:/home/pi/pialert/back/pialert.py
|
||||
- ${DEV_LOCATION}/pialert:/home/pi/pialert/pialert
|
||||
# - ${DEV_LOCATION}/back/report_template.html:/home/pi/pialert/back/report_template.html
|
||||
# - ${DEV_LOCATION}/back/report_template_new_version.html:/home/pi/pialert/back/report_template_new_version.html
|
||||
# - ${DEV_LOCATION}/back/report_template.txt:/home/pi/pialert/back/report_template.txt
|
||||
- ${DEV_LOCATION}/pholus:/home/pi/pialert/pholus
|
||||
- ${DEV_LOCATION}/dockerfiles:/home/pi/pialert/dockerfiles
|
||||
- ${APP_DATA_LOCATION}/pialert/php.ini:/etc/php/7.4/fpm/php.ini
|
||||
@@ -31,14 +38,16 @@ services:
|
||||
- ${DEV_LOCATION}/front/devices.php:/home/pi/pialert/front/devices.php
|
||||
- ${DEV_LOCATION}/front/events.php:/home/pi/pialert/front/events.php
|
||||
- ${DEV_LOCATION}/front/plugins.php:/home/pi/pialert/front/plugins.php
|
||||
- ${DEV_LOCATION}/front/pluginsCore.php:/home/pi/pialert/front/pluginsCore.php
|
||||
- ${DEV_LOCATION}/front/help_faq.php:/home/pi/pialert/front/help_faq.php
|
||||
- ${DEV_LOCATION}/front/index.php:/home/pi/pialert/front/index.php
|
||||
- ${DEV_LOCATION}/front/maintenance.php:/home/pi/pialert/front/maintenance.php
|
||||
- ${DEV_LOCATION}/front/network.php:/home/pi/pialert/front/network.php
|
||||
- ${DEV_LOCATION}/front/presence.php:/home/pi/pialert/front/presence.php
|
||||
- ${DEV_LOCATION}/front/settings.php:/home/pi/pialert/front/settings.php
|
||||
- ${DEV_LOCATION}/front/plugins:/home/pi/pialert/front/plugins
|
||||
- ${DEV_LOCATION}/front/settings.php:/home/pi/pialert/front/settings.php
|
||||
- ${DEV_LOCATION}/front/plugins:/home/pi/pialert/front/plugins
|
||||
# DELETE END anyone trying to use this file: comment out / delete ABOVE lines, they are only for development purposes
|
||||
# ---------------------------------------------------------------------------
|
||||
environment:
|
||||
- TZ=${TZ}
|
||||
- PORT=${PORT}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
# 🐳 A docker image for Pi.Alert
|
||||
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) | 📚 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases)
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📑 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases) | 📚 [All Docs](https://github.com/jokob-sk/Pi.Alert/tree/main/docs)
|
||||
|
||||
<a href="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/devices_split.png" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/devices_split.png" width="300px" />
|
||||
@@ -53,39 +53,28 @@ docker run -d --rm --network=host \
|
||||
|
||||
### Config (`pialert.conf`)
|
||||
|
||||
- The preferred wy is to manage the configuration via Settings
|
||||
- YOu can modify [pialert.conf](https://github.com/jokob-sk/Pi.Alert/tree/main/config) directly if needed
|
||||
- ❗ To use the arp-scan method, you need to set the `SCAN_SUBNETS` variable. ()
|
||||
* The adapter will probably be `eth0` or `eth1`. (Run `iwconfig` to find your interface name(s))
|
||||
* Specify the network filter (which **significantly** speeds up the scan process). For example, the filter `192.168.1.0/24` covers IP ranges 192.168.1.0 to 192.168.1.255.
|
||||
* Examples for one and two subnets (❗ Note the `['...', '...']` format):
|
||||
* One subnet: `SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth0']`
|
||||
* Two subnets: `SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth0', '192.168.1.0/24 --interface=eth1']`
|
||||
* More documentation on how to [setup vlans](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SUBNETS.md)
|
||||
- If unavailable, the app generates a default `pialert.conf` and `pialert.db` file on the first run.
|
||||
- The preferred way is to manage the configuration via the Settings section in the UI.
|
||||
- You can modify [pialert.conf](https://github.com/jokob-sk/Pi.Alert/tree/main/config) directly, if needed.
|
||||
|
||||
#### Important settings
|
||||
|
||||
### 🛑 **Common issues**
|
||||
These are the most important settings to get at least some output in your Devices screen. Usually, only one approach is used, but you should be able to combine these approaches.
|
||||
|
||||
##### For arp-scan: ENABLE_ARPSCAN, SCAN_SUBNETS
|
||||
|
||||
- ❗ To use the arp-scan method, you need to set the `SCAN_SUBNETS` variable. See the documentation on how [to setup SUBNETS, VLANs & limitations](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SUBNETS.md)
|
||||
|
||||
##### For pihole: PIHOLE_ACTIVE, DHCP_ACTIVE
|
||||
|
||||
* `PIHOLE_ACTIVE`: You need to map `:/etc/pihole/pihole-FTL.db in the docker-compose.yml` file if you enable this setting.
|
||||
* `DHCP_ACTIVE` : You need to map `:/etc/pihole/dhcp.leases in the docker-compose.yml` file if you enable this setting.
|
||||
|
||||
### **Common issues**
|
||||
|
||||
💡 Before creating a new issue, please check if a similar issue was [already resolved](https://github.com/jokob-sk/Pi.Alert/issues?q=is%3Aissue+is%3Aclosed).
|
||||
|
||||
**Permissions**
|
||||
|
||||
* If facing issues (AJAX errors, can't write to DB, empty screen, etc,) make sure permissions are set correctly, and check the logs under `/home/pi/pialert/front/log`.
|
||||
* To solve permission issues you can also try to create a DB backup and then run a DB Restore via the **Maintenance > Backup/Restore** section.
|
||||
* You can try also setting the owner and group of the `pialert.db` by executing the following on the host system: `docker exec pialert chown -R www-data:www-data /home/pi/pialert/db/pialert.db`.
|
||||
* Map to local User and Group IDs. Specify the enviroment variables `HOST_USER_ID` and `HOST_USER_GID` if needed.
|
||||
* Map the pialert.db file (⚠ not folder) to `:/home/pi/pialert/db/pialert.db` (see Examples below for details)
|
||||
|
||||
**Container restarts / crashes**
|
||||
|
||||
* Check the logs for details. Often a required setting for a notification method is missing.
|
||||
|
||||
**unable to resolve host**
|
||||
|
||||
* Check that your `SCAN_SUBNETS` variable is using the correct mask and `--interface` as outlined in the instructions above.
|
||||
|
||||
|
||||
Docker-compose examples can be found below.
|
||||
⚠ Check also common issues and [debugging tips](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/DEBUG_TIPS.md).
|
||||
|
||||
## 📄 Examples
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/bin/sh
|
||||
/home/pi/pialert/dockerfiles/user-mapping.sh
|
||||
|
||||
# if custom variables not set we do not need to do anything
|
||||
if [ -n "${TZ}" ]; then
|
||||
FILECONF=/home/pi/pialert/config/pialert.conf
|
||||
if [ -f "$FILECONF" ]; then
|
||||
sed -ie "s|Europe/Berlin|${TZ}|g" /home/pi/pialert/config/pialert.conf
|
||||
else
|
||||
sed -ie "s|Europe/Berlin|${TZ}|g" /home/pi/pialert/back/pialert.conf_bak
|
||||
fi
|
||||
fi
|
||||
# # if custom variables not set we do not need to do anything
|
||||
# if [ -n "${TZ}" ]; then
|
||||
# FILECONF=/home/pi/pialert/config/pialert.conf
|
||||
# if [ -f "$FILECONF" ]; then
|
||||
# sed -ie "s|Europe/Berlin|${TZ}|g" /home/pi/pialert/config/pialert.conf
|
||||
# else
|
||||
# sed -ie "s|Europe/Berlin|${TZ}|g" /home/pi/pialert/back/pialert.conf_bak
|
||||
# fi
|
||||
# fi
|
||||
|
||||
if [ -n "${PORT}" ]; then
|
||||
sed -ie 's/listen 20211/listen '${PORT}'/g' /etc/nginx/sites-available/default
|
||||
@@ -28,4 +28,6 @@ chmod -R a+rw /home/pi/pialert/config
|
||||
/etc/init.d/nginx start
|
||||
|
||||
# cron -f
|
||||
python /home/pi/pialert/back/pialert.py
|
||||
#python /home/pi/pialert/back/pialert.py
|
||||
# echo "[DEBUG] DATA MONKEY VERSION ..."
|
||||
python /home/pi/pialert/pialert/
|
||||
|
||||
@@ -5,12 +5,7 @@ PiAlert comes with a simple API. These API endpoints are static files, that are
|
||||
|
||||
### When are the endpoints updated
|
||||
|
||||
Once you enable the API (`ENABLE_API` setting), the endpoints are updated during these events:
|
||||
|
||||
1) Always during a notification event.
|
||||
2) (optional) If `API_RUN` is set to `schedule` on a specified cron-like schedule specified by the `API_RUN_SCHD` setting.
|
||||
3) (optional) If `API_RUN` is set to `interval` every N seconds specified by the `API_RUN_INTERVAL` setting (minimum 5).
|
||||
|
||||
Once you enable the API (`ENABLE_API` setting), the endpoints are updated when objects in the API endpoints are changed:
|
||||
|
||||
### Location of the endpoints
|
||||
|
||||
|
||||
47
docs/DATABASE.md
Executable file
@@ -0,0 +1,47 @@
|
||||
|
||||
# A high-level description of the datbase structure
|
||||
|
||||
⚠ Disclaimer: As I'm not the original author, some of the information might be inaccurate. Feel free to submit a PR to correct anything within this page or documentation in general.
|
||||
|
||||
The MAC address is used as a foreign key in most cases.
|
||||
|
||||
## 🔍Tables overview
|
||||
|
||||
| Table name | Description | Sample data |
|
||||
|----------------------|----------------------| ----------------------|
|
||||
| CurrentScan | Result of the current scan | ![Screen1][screen1] |
|
||||
| Devices | The main devices database that also contains the Network tree mappings. If `ScanCycle` is set to `0` device is not scanned. | ![Screen2][screen2] |
|
||||
| DHCP_Leases | Used for importing devices from DHCP_Leases files. Also leveraged by some plugins. | ![Screen3][screen3] |
|
||||
| Events | Used to collect connection/disconnection events. | ![Screen4][screen4] |
|
||||
| Nmap_Scan | Contains results of the scheduled Nmap scan, that is also displayed in the Nmap tab on each device. | ![Screen5][screen5] |
|
||||
| Online_History | Used to display the `Device presence over time` chart | ![Screen6][screen6] |
|
||||
| Parameters | Used to pass values between the frontend and backend. | ![Screen7][screen7] |
|
||||
| Pholus_Scan | Scan results of the Pholus python network penetration script. | ![Screen8][screen8] |
|
||||
| PiHole_Network | Table to copy the devices from the PiHole database | ![Screen9][screen9] |
|
||||
| Plugins_Events | For capturing events exposed by a plugin via the `last_result.log` file. If unique then saved into the `Plugins_Objects` table. Entries are deleted once processed and stored in the `Plugins_History` and/or `Plugins_Objects` tables. | ![Screen10][screen10] |
|
||||
| Plugins_History | History of all entries from the `Plugins_Events` table | ![Screen11][screen11] |
|
||||
| Plugins_Language_Strings | Language strings colelcted from the plugin `config.json` files used for string resolution in the frontend. | ![Screen12][screen12] |
|
||||
| Plugins_Objects | Unique objects detected by individual plugins. | ![Screen13][screen13] |
|
||||
| ScanCycles | (obsolete) Used to determine and identify different scan cycles. | ![Screen14][screen14] |
|
||||
| Sessions | Used to display sessions in the charts | ![Screen15][screen15] |
|
||||
| Settings | Database representation of the sum of all settings from `pialert.conf` and plugins coming from `config.json` files. | ![Screen16][screen16] |
|
||||
|
||||
|
||||
|
||||
[screen1]: /docs/img/DATABASE/CurrentScan.png
|
||||
[screen2]: /docs/img/DATABASE/Devices.png
|
||||
[screen3]: /docs/img/DATABASE/DHCP_Leases.png
|
||||
[screen4]: /docs/img/DATABASE/Events.png
|
||||
[screen5]: /docs/img/DATABASE/Nmap_Scan.png
|
||||
[screen6]: /docs/img/DATABASE/Online_History.png
|
||||
[screen7]: /docs/img/DATABASE/Parameters.png
|
||||
[screen8]: /docs/img/DATABASE/Pholus_Scan.png
|
||||
[screen9]: /docs/img/DATABASE/PiHole_Network.png
|
||||
[screen10]: /docs/img/DATABASE/Plugins_Events.png
|
||||
[screen11]: /docs/img/DATABASE/Plugins_History.png
|
||||
[screen12]: /docs/img/DATABASE/Plugins_Language_Strings.png
|
||||
[screen13]: /docs/img/DATABASE/Plugins_Objects.png
|
||||
[screen14]: /docs/img/DATABASE/ScanCycles.png
|
||||
[screen15]: /docs/img/DATABASE/Sessions.png
|
||||
[screen16]: /docs/img/DATABASE/Settings.png
|
||||
|
||||
84
docs/DEBUG_TIPS.md
Executable file
@@ -0,0 +1,84 @@
|
||||
# Debugging and troubleshooting
|
||||
|
||||
Please follow tips 1 - 4 to get a more detailed error.
|
||||
|
||||
## 1. More Logging 📃
|
||||
|
||||
When debugging an issue always set the highest log level:
|
||||
|
||||
`LOG_LEVEL='debug'`
|
||||
|
||||
|
||||
## 2. Surfacing errors when container restarts 🔁
|
||||
|
||||
Start the container via the **terminal** with a command similar to this one:
|
||||
|
||||
```bash
|
||||
docker run --rm --network=host \
|
||||
-v local/path/pialert/config:/home/pi/pialert/config \
|
||||
-v local/path/pialert/db:/home/pi/pialert/db \
|
||||
-e TZ=Europe/Berlin \
|
||||
-e PORT=20211 \
|
||||
jokobsk/pi.alert:latest
|
||||
|
||||
```
|
||||
|
||||
> ⚠ Please note, don't use the `-d` parameter so you see the error when the container crashes. Use this error in your issue description.
|
||||
|
||||
## 3. Check the _dev image and open issues ❓
|
||||
|
||||
If possible, check if your issue got fixed in the `_dev` image before opening a new issue. The container is:
|
||||
|
||||
`jokobsk/pi.alert_dev:latest`
|
||||
|
||||
> ⚠ Please backup your DB and config beforehand!
|
||||
|
||||
Please also search [open issues](https://github.com/jokob-sk/Pi.Alert/issues).
|
||||
|
||||
## 4. Disable restart behavior 🛑
|
||||
|
||||
To prevent a Docker container from automatically restarting in a Docker Compose file, specify the restart policy as `no`:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
your-service:
|
||||
image: your-image:tag
|
||||
restart: no
|
||||
# Other service configurations...
|
||||
```
|
||||
|
||||
## 📃Common issues
|
||||
|
||||
### Permissions
|
||||
|
||||
* If facing issues (AJAX errors, can't write to DB, empty screen, etc,) make sure permissions are set correctly, and check the logs under `/home/pi/pialert/front/log`.
|
||||
* To solve permission issues you can try setting the owner and group of the `pialert.db` by executing the following on the host system: `docker exec pialert chown -R www-data:www-data /home/pi/pialert/db/pialert.db`.
|
||||
* Map to local User and Group IDs. Specify the enviroment variables `HOST_USER_ID` and `HOST_USER_GID` if needed.
|
||||
* If still facing issues, try to map the pialert.db file (⚠ not folder) to `:/home/pi/pialert/db/pialert.db` (see Examples below for details)
|
||||
|
||||
### Container restarts / crashes
|
||||
|
||||
* Check the logs for details. Often a required setting for a notification method is missing.
|
||||
|
||||
### unable to resolve host
|
||||
|
||||
* Check that your `SCAN_SUBNETS` variable is using the correct mask and `--interface` as outlined in the instructions above.
|
||||
|
||||
### Invalid JSON
|
||||
|
||||
Check the [Invalid JSON errors debug help](/docs/DEBUG_INVALID_JSON.md) docs on how to proceed.
|
||||
|
||||
### sudo execution failing (e.g.: on arpscan) on a Raspberry Pi 4
|
||||
|
||||
> sudo: unexpected child termination condition: 0
|
||||
|
||||
Resolution based on [this issue](https://github.com/linuxserver/docker-papermerge/issues/4#issuecomment-1003657581)
|
||||
|
||||
```
|
||||
wget ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.3-2_armhf.deb
|
||||
sudo dpkg -i libseccomp2_2.5.3-2_armhf.deb
|
||||
```
|
||||
|
||||
The link above will probably break in time too. Go to https://packages.debian.org/sid/armhf/libseccomp2/download to find the new version number and put that in the url.
|
||||
@@ -18,7 +18,7 @@ To edit device information:
|
||||
- **Owner**: Device owner (The list is self-populated with existing owners)
|
||||
- **Type**: Select a device type from the dropdown list (Smartphone, Table,
|
||||
Laptop, TV, router, ....) or type a new device type
|
||||
- **Vendor**: Automatically updated by Pi.Alert
|
||||
- **Vendor**: Automatically updated by Pi.Alert when empty or unknown
|
||||
- **Favorite**: Mark the device as favorite and then it will appears at the
|
||||
begining of the device list
|
||||
- **Group**: Select a grouper ('Always on', 'Personal', Friends') or type
|
||||
@@ -81,9 +81,17 @@ decides to change the MAC).
|
||||
GPL 3.0
|
||||
[Read more here](../LICENSE.txt)
|
||||
|
||||
### Contact
|
||||
pi.alert.application@gmail.com
|
||||
### Contact
|
||||
|
||||
Always use the Issue tracker for the correct fork, for example:
|
||||
|
||||
[jokob-sk/Pi.Alert](https://github.com/jokob-sk/Pi.Alert/issues). Please also follow the guidelines on:
|
||||
|
||||
- ➕ [Pull Request guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-pull-requests-prs)
|
||||
- 🙏 [Feature request guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-feature-requests)
|
||||
- 🐛 [Issue guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-submitting-an-issue-or-bug)
|
||||
|
||||
|
||||
***Suggestions and comments are welcome***
|
||||
|
||||
|
||||
|
||||
42
docs/HOME_ASSISTANT.md
Executable file
@@ -0,0 +1,42 @@
|
||||
# Overview
|
||||
|
||||
PiAlert comes with MQTT support, allowing you to show all detected devices as devices in Home Assistant. It also supplies a collection of stats, such as number of online devices.
|
||||
|
||||
## ⚠ Note
|
||||
|
||||
- Please note that discovery takes about ~10s per device.
|
||||
- Deleting of devices is not handled automatically. Please use [MQTT Explorer](https://mqtt-explorer.com/) to delete devices in the broker (Home Assistant), if needed.
|
||||
|
||||
|
||||
## 🧭 Guide
|
||||
|
||||
> 💡 This guide was tested only with the Mosquitto MQTT broker
|
||||
|
||||
1. Enable Mosquitto MQTT in Home Assistant by following the [documentation](https://www.home-assistant.io/integrations/mqtt/)
|
||||
|
||||
2. Configure a user name and password on your broker.
|
||||
|
||||
3. Note down the following details that you will need to configure PiAlert:
|
||||
- MQTT host url (usually your Home Assistant IP)
|
||||
- MQTT broker port
|
||||
- User
|
||||
- Password
|
||||
|
||||
4. Ope the `PiAlert` > `Settings` > `MQTT` settings group
|
||||
- Enable MQTT
|
||||
- Fill in the details from above
|
||||
- Fill in remaining settings as per description
|
||||
|
||||
|
||||
## 📷 Screenshots
|
||||
|
||||
| ![Screen 1][sensors] | ![Screen 2][history] |
|
||||
|----------------------|----------------------|
|
||||
| ![Screen 3][list] | ![Screen 4][overview] |
|
||||
|
||||
|
||||
[sensors]: /docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Device-as-Sensors.png "sensors"
|
||||
[history]: /docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Device-Presence-History.png "history"
|
||||
[list]: /docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Devices-List.png "list"
|
||||
[overview]: /docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Overview-Card.png "overview"
|
||||
|
||||
30
docs/ICONS.md
Executable file
@@ -0,0 +1,30 @@
|
||||
## Icons overview
|
||||
|
||||
Icons are used to visually distinguish devices in the app in most of the device listing tables and the [network tree](/docs/NETWORK_TREE.md). Currently only free [Font Awesome](https://fontawesome.com/search?o=r&m=free) icons (up-to v 6.4.0) are supported (I have an unblockable [sponsorship goal](https://github.com/sponsors/jokob-sk) to add the material design icon pack).
|
||||
|
||||

|
||||
|
||||
## ⚙ How to use custom device Icons
|
||||
|
||||
You can assign icons individually on each device in the Details tab.
|
||||
|
||||

|
||||
|
||||
- You can click into the `Icon` field or click the Pencil (2) icon in the above screenshot to enter any text. Only [free Font Awesome](https://fontawesome.com/search?o=r&m=free) icons in the following format will work:
|
||||
|
||||
1. For any value that is only prefixed with `fa-`, you can enter the value directly, such as `server`, `tv`, `ethernet`.
|
||||
2. If you want to add another classname, e.g. `fa-brands`, you can enter `brands fa-[fontawesome-icon-name]`, so for `apple` that is using the syntax`fa-brands fa-apple`, you would enter `brands fa-apple`.
|
||||
|
||||
- If you want to mass-apply an icon to all devices of the same device type (Field marked (4) in the above screenshot), you can click the copy button (Marked (1) in the above screenshot). A confirmation prompt is displayed. If you proceed, icons of all devices set to the same device type as the current device, will be overwritten with the current device's icon.
|
||||
|
||||
- The dropdown (3) contains all icons already used in the app for device icons. You need to navigate away or refresh the page once you add a new icon.
|
||||
|
||||
## 🌟 Pro Font Awesome icons
|
||||
|
||||
If you own the premium package of Font Awesome icons you can mount it in your Docker container the following way:
|
||||
|
||||
```yaml
|
||||
/font-awesome:/home/pi/pialert/front/lib/AdminLTE/bower_components/font-awesome:ro
|
||||
```
|
||||
|
||||
You can use the full range of Font Awesome icons afterwards.
|
||||
@@ -1,8 +1,19 @@
|
||||
## How to setup your Network page
|
||||
|
||||
Make sure you have a root device with the MAC `Internet` (No other MAC addresses are currently support as root)
|
||||
Make sure you have a root device with the MAC `Internet` (No other MAC addresses are currently supported as the root node).
|
||||
|
||||
To setup a device named `rapberrypi` as a `Switch` in our network.
|
||||
## ⚡Quick setup:
|
||||
|
||||
* Go to Devices > Device Details.
|
||||
* Find the device(s) you want to use as network devices (network nodes).
|
||||
* Set the Type of such a device to one of the following: AP, Firewall, Gateway, PLC, Powerline, Router, Switch, USB LAN Adapter, USB WIFI Adapter and WLAN.
|
||||
* Save and go to Network where the devices you've marked as network devices (by selecting the Type as mentioned above) will show up as tabs.
|
||||
* You can now assign the Unassigend devices to the correct network node.
|
||||
|
||||
|
||||
## 🔍Detailed example:
|
||||
|
||||
In this example you will setup a device named `rapberrypi` as a `Switch` in our network.
|
||||
|
||||
### 1) Device details page
|
||||
|
||||
@@ -13,7 +24,7 @@ To setup a device named `rapberrypi` as a `Switch` in our network.
|
||||
- In the (2) `Details` tab navigate to the the `Type` (3) dropdown and select the type `Switch` (4).
|
||||
|
||||
> Note: Only the following device types will show up as selectable Network nodes ( = devices you can connect other devices to):
|
||||
> AP, Firewall, Gateway, PLC, Powerline, Router, Switch, USB LAN Adapter, USB WIFI Adapter and WLAN.
|
||||
> AP, Firewall, Gateway, Hypervisor, PLC, Powerline, Router, Switch, USB LAN Adapter, USB WIFI Adapter and WLAN.
|
||||
|
||||
- Assign a device to your root device from the `Node` (5) dropdown which has the MAC `Internet` (6) (Your name may differ, but the MAC needs to be set to `Internet` - this is done by default).
|
||||
|
||||
|
||||
@@ -33,7 +33,14 @@ decides to change the MAC).
|
||||
[Read more here](../LICENSE.txt)
|
||||
|
||||
### Contact
|
||||
pi.alert.application@gmail.com
|
||||
Always use the Issue tracker for the correct fork, for example:
|
||||
|
||||
[jokob-sk/Pi.Alert](https://github.com/jokob-sk/Pi.Alert/issues). Please also follow the guidelines on:
|
||||
|
||||
- ➕ [Pull Request guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-pull-requests-prs)
|
||||
- 🙏 [Feature request guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-feature-requests)
|
||||
- 🐛 [Issue guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-submitting-an-issue-or-bug)
|
||||
|
||||
|
||||
***Suggestions and comments are welcome***
|
||||
|
||||
|
||||
109
docs/README.md
Executable file
@@ -0,0 +1,109 @@
|
||||
## Documentation overview
|
||||
|
||||
In the app hover over settings or fields/labels or click blue in-app ❔ (question-mark) icons to get to relevant documentation pages.
|
||||
|
||||

|
||||
|
||||
There is also an in-app Help / FAQ section that should be answering frequently asked questions.
|
||||
|
||||
### 📥 Installation
|
||||
|
||||
⚠ Only tested as a [docker container - follow these instructions here](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md).
|
||||
> Check out [leiweibau's fork](https://github.com/leiweibau/Pi.Alert/) if you want to install Pi.Alert on the server directly or original instructions for [pucherot's original code](https://github.com/pucherot/Pi.Alert/)
|
||||
|
||||
|
||||
### 📚 Table of contents
|
||||
|
||||
#### 🐛 Debugging help & tips
|
||||
|
||||
- [Debugging tips](/docs/DEBUG_TIPS.md)
|
||||
- [Invalid JSON errors debug help](/docs/DEBUG_INVALID_JSON.md)
|
||||
|
||||
#### 🔝 Popular/Suggested
|
||||
|
||||
- [API endpoints details](/docs/API.md)
|
||||
- [Plugin system details and how to develop your own](/front/plugins/README.md)
|
||||
- [Network treemap configuration](/docs/NETWORK_TREE.md)
|
||||
- [Gmail as SMTP server for sending emails](/docs/SMTP_GMAIL.md)
|
||||
- [Subnets and VLANs configuration for arp-scan](/docs/SUBNETS.md)
|
||||
- [Home Assistant](/docs/HOME_ASSISTANT.md)
|
||||
|
||||
#### ⚙ System Management
|
||||
|
||||
- [Manage devices (legacy docs)](/docs/DEVICE_MANAGEMENT.md)
|
||||
- [Random MAC/MAC icon meaning (legacy docs)](/docs/RANDOM_MAC.md)
|
||||
- [Custom Icons configuration and support](/docs/ICONS.md)
|
||||
|
||||
#### 🔎 Examples
|
||||
|
||||
- [N8N webhook example](/docs/WEBHOOK_N8N.md)
|
||||
|
||||
#### ♻ Misc
|
||||
|
||||
- [New Version notifications](/docs/VERSIONS.md)
|
||||
- [Version history (legacy)](/docs/VERSIONS_HISTORY.md)
|
||||
- [Database structure](/docs/DATABASE.md)
|
||||
- [Reverse proxy with SWAG](/docs/REVERSE_PROXY.md)
|
||||
|
||||
Feel free to suggest or submit new docs via a PR.
|
||||
|
||||
## 👨💻 Development priorities
|
||||
|
||||
Priorities from highest to lowest:
|
||||
|
||||
* 🔼 Fixing core functionality bugs not solvable with workarounds
|
||||
* 🔵 New core functionality unlocking other opportunities (e.g.: plugins)
|
||||
* 🔵 Refactoring enabling faster implementation of future functionality
|
||||
* 🔽 (low) UI functionality & improvements (PRs welcome 😉)
|
||||
|
||||
Design philosophy: Focus on core functionality and leverage existing apps and tools to make PiAlert integrate into other workflows.
|
||||
|
||||
Examples:
|
||||
|
||||
1. Supporting apprise makes more sense than implementing multiple individual notification gateways
|
||||
2. Implementing regular expression support across settings for validation makes more sense than validating one setting with a specific expression.
|
||||
|
||||
UI-specific requests are a low priority as the framework picked by the original developer is not very extensible (and afaik doesn't support components) and has limited mobile support. Also, I argue the value proposition is smaller than working on something else.
|
||||
|
||||
Feel free to submit PRs if interested. try to **keep the PRs small/on-topic** so they are easier to review and approve.
|
||||
|
||||
That being said, I'd reconsider if more people and or recurring sponsors file a request 😉.
|
||||
|
||||
## 🙏 Feature requests
|
||||
|
||||
Please be as detailed as possible with **workarounds** you considered and why a native feature is the better way. This gives me better context and will make it more likely to be implemented. Ideally, a feature request should be in the format "I want to be able to do XYZ so that ZYX. I considered these approaches XYZ".
|
||||
|
||||
## ➕ Pull requests (PRs)
|
||||
|
||||
If you submit a PR please:
|
||||
|
||||
1. Check that your changes are backward compatible with existing installations and with a blank setup.
|
||||
2. Existing features should always be preserved.
|
||||
3. Keep the PR small, on-topic and don't change code that is not necessary for the PR to work
|
||||
4. New features code should ideally be re-usable for different purposes, not be for a very narrow use-case.
|
||||
5. New functionality should ideally be implemented via the Plugins system, if possible.
|
||||
|
||||
Suggested test cases:
|
||||
|
||||
- Blank setup with no DB or config
|
||||
- Existing DB / config
|
||||
- Sending a notification (e. g. Delete a device and wait for a scan to run) and testing all notification gateways, especially:
|
||||
- Email, Apprise (e.g. via Telegram), webhook (e.g. via Discord), MQTT (e.g. via HomeAssitant)
|
||||
- Saving settings
|
||||
- Test a couple of plugins
|
||||
- Check the Error log for anything unusual
|
||||
|
||||
Some additional context:
|
||||
|
||||
* Permanent settings/config is stored in the `pialert.conf` file
|
||||
* Currently temporary (session?) settings are stored in the `Parameters` DB table as key-value pairs. This table is wiped during a container rebuild/restart and its values are re-initialized from cookies/session data from the browser.
|
||||
|
||||
## 🐛 Submitting an issue or bug
|
||||
|
||||
Before submitting a new issue please spend a couple of minutes on research:
|
||||
|
||||
* Check [🛑 Common issues](https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#-common-issues)
|
||||
* Check [💡 Closed issues](https://github.com/jokob-sk/Pi.Alert/issues?q=is%3Aissue+is%3Aclosed) if a similar issue was solved in the past.
|
||||
* When submitting an issue ❗[enable debug](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/DEBUG_TIPS.md)❗
|
||||
|
||||
⚠ Please follow the pre-defined issue template to resolve your issue faster.
|
||||
65
docs/REVERSE_PROXY.md
Executable file
@@ -0,0 +1,65 @@
|
||||
# Reverse Proxy Configuration
|
||||
|
||||
Reverse proxy example by using LinuxServer's SWAG container.
|
||||
|
||||
> Submitted by [s33d1ing](https://github.com/s33d1ing). 🙏
|
||||
|
||||
## [linuxserver/swag](https://github.com/linuxserver/docker-swag)
|
||||
|
||||
In the SWAG container create `/config/nginx/proxy-confs/pialert.subfolder.conf` with the following contents:
|
||||
|
||||
``` nginx
|
||||
## Version 2023/02/05
|
||||
# make sure that your pialert container is named pialert
|
||||
# pialert does not require a base url setting
|
||||
|
||||
# Since Pi.Alert uses a Host network, you may need to use the IP address of the system running Pi.Alert for $upstream_app.
|
||||
|
||||
location /pialert {
|
||||
return 301 $scheme://$host/pialert/;
|
||||
}
|
||||
|
||||
location ^~ /pialert/ {
|
||||
# enable the next two lines for http auth
|
||||
#auth_basic "Restricted";
|
||||
#auth_basic_user_file /config/nginx/.htpasswd;
|
||||
|
||||
# enable for ldap auth (requires ldap-server.conf in the server block)
|
||||
#include /config/nginx/ldap-location.conf;
|
||||
|
||||
# enable for Authelia (requires authelia-server.conf in the server block)
|
||||
#include /config/nginx/authelia-location.conf;
|
||||
|
||||
# enable for Authentik (requires authentik-server.conf in the server block)
|
||||
#include /config/nginx/authentik-location.conf;
|
||||
|
||||
include /config/nginx/proxy.conf;
|
||||
include /config/nginx/resolver.conf;
|
||||
|
||||
set $upstream_app pialert;
|
||||
set $upstream_port 20211;
|
||||
set $upstream_proto http;
|
||||
|
||||
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
|
||||
proxy_redirect ~^/(.*)$ /pialert/$1;
|
||||
rewrite ^/pialert/?(.*)$ /$1 break;
|
||||
|
||||
sub_filter_once off;
|
||||
sub_filter_types *;
|
||||
|
||||
sub_filter 'href="/' 'href="/pialert/';
|
||||
|
||||
sub_filter '(?>$host)/css' '/pialert/css';
|
||||
sub_filter '(?>$host)/js' '/pialert/js';
|
||||
|
||||
sub_filter '/img' '/pialert/img';
|
||||
sub_filter '/lib' '/pialert/lib';
|
||||
sub_filter '/php' '/pialert/php';
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,48 @@
|
||||
## Subnets configuration
|
||||
# Subnets configuration for arp-scan
|
||||
|
||||
You need to specify the network interface and the network mask. You can also configure multiple subnets and specify VLANS (see exceptions below).
|
||||
|
||||
## Examples
|
||||
|
||||
* Examples for one and two subnets (❗ Note the `['...', '...']` format):
|
||||
* One subnet: `SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth0']`
|
||||
* Two subnets: `SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth0', '192.168.1.0/24 --interface=eth1 -vlan=107']`
|
||||
|
||||
## Explanation
|
||||
|
||||
### Network mask
|
||||
|
||||
**Example value: `192.168.1.0/24`**
|
||||
|
||||
The arp-scan time itself depends on the number of IP addresses to check.
|
||||
The number of IPs to check depends on the [network mask](https://www.calculator.net/ip-subnet-calculator.html) you set on the `SCAN_SUBNETS` setting.
|
||||
|
||||
For example, a `/24` mask results in 256 IPs to check, where as a `/16` mask checks around 65,536. Every IP takes a couple seconds. This means that with an incorrect configuration the arp-scan will take hours to complete instead of seconds.
|
||||
> The number of IPs to check depends on the [network mask](https://www.calculator.net/ip-subnet-calculator.html) you set on the `SCAN_SUBNETS` setting.
|
||||
> For example, a `/24` mask results in 256 IPs to check, whereas a `/16` mask checks around 65,536. Every IP takes a couple of seconds. This means that with an incorrect configuration, the arp-scan will take hours to complete instead of seconds.
|
||||
|
||||
Specify the network filter (which **significantly** speeds up the scan process). For example, the filter `192.168.1.0/24` covers IP ranges 192.168.1.0 to 192.168.1.255.
|
||||
|
||||
### Network interface (adapter)
|
||||
|
||||
**Example value: `--interface=eth0`**
|
||||
|
||||
The adapter will probably be `eth0` or `eth1`. (Run `iwconfig` in the container to find your interface name(s))
|
||||
|
||||
> Run `iwconfig` in your container to find your interface name(s) (e.g.: `eth0`, `eth1`).
|
||||
|
||||
### VLANs
|
||||
|
||||
**Example value: `-vlan=107`**
|
||||
|
||||
- Specify the network mask. For example, the filter `192.168.1.0/24` covers IP ranges 192.168.1.0 to 192.168.1.255
|
||||
- Run `iwconfig` in your container to find your interface name(s) (e.g.: `eth0`, `eth1`).
|
||||
- Append e.g.: ` -vlan=107` to the interface field (e.g.: `eth0 -vlan=107`) for multiple vlans. More details in this [comment in this issue](https://github.com/jokob-sk/Pi.Alert/issues/170#issuecomment-1419902988)
|
||||
|
||||
### Example:
|
||||
#### VLAN 🔍Example:
|
||||
|
||||

|
||||
|
||||
### Support for VLANS
|
||||
#### Support for VLANS (& exceptions)
|
||||
|
||||
Please note about the accessibility of the macvlans when they are configured on the same computer. My understanding this is a general networking behavior, but feel free to clarify via a PR/issue.
|
||||
Please note the accessibility of the macvlans when they are configured on the same computer. My understanding this is a general networking behavior, but feel free to clarify via a PR/issue.
|
||||
|
||||
- Pi.Alert does not detect the macvlan container when it is running on the same computer.
|
||||
- Pi.Alert recognizes the macvlan container when it is running on a different computer.
|
||||
|
||||
|
||||
25
docs/VERSIONS.md
Executable file
@@ -0,0 +1,25 @@
|
||||
## Am I running the latest released version?
|
||||
|
||||
Since version 23.01.14 PiAlert uses a simple timestamp-based version check to verify if a new version is available. You can check the [current and past releases here](https://github.com/jokob-sk/Pi.Alert/releases), or have a look at what I'm [currently working on](https://github.com/jokob-sk/Pi.Alert/issues/138).
|
||||
|
||||
If you are not on the latest version, the app will notify you, that a new released version is avialable the following way:
|
||||
|
||||
### 📧 Via email on a notification event
|
||||
|
||||
If any notification occurs and an email is sent, the email will contain a note that a new version is available. See the sample email below:
|
||||
|
||||

|
||||
|
||||
### 🆕 In the UI
|
||||
|
||||
In the UI via a notification Icon and via a custom message in the Maintenance section.
|
||||
|
||||

|
||||
|
||||
For a comparison, this is how the UI looks like if you are on the latest stable image:
|
||||
|
||||

|
||||
|
||||
## Implementation details
|
||||
|
||||
During build a [/home/pi/pialert/front/buildtimestamp.txt](https://github.com/jokob-sk/Pi.Alert/blob/092797e75ccfa8359444ad149e727358ac4da05f/Dockerfile#L44) file is created. The app then periodically checks if a new release is available with a newer timestamp in GitHub's rest-based JSON endpoint (check the `def isNewVersion():` method in `pialert.py` for details).
|
||||
@@ -77,4 +77,11 @@
|
||||
[Read more here](../LICENSE.txt)
|
||||
|
||||
### Contact
|
||||
pi.alert.application@gmail.com
|
||||
Always use the Issue tracker for the correct fork, for example:
|
||||
|
||||
[jokob-sk/Pi.Alert](https://github.com/jokob-sk/Pi.Alert/issues). Please also follow the guidelines on:
|
||||
|
||||
- ➕ [Pull Request guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-pull-requests-prs)
|
||||
- 🙏 [Feature request guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-feature-requests)
|
||||
- 🐛 [Issue guidelines](https://github.com/jokob-sk/Pi.Alert/tree/main/docs#-submitting-an-issue-or-bug)
|
||||
|
||||
|
||||
BIN
docs/img/DATABASE/CurrentScan.png
Executable file
|
After Width: | Height: | Size: 58 KiB |
BIN
docs/img/DATABASE/DHCP_Leases.png
Executable file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
docs/img/DATABASE/Devices.png
Executable file
|
After Width: | Height: | Size: 85 KiB |
BIN
docs/img/DATABASE/Events.png
Executable file
|
After Width: | Height: | Size: 43 KiB |
BIN
docs/img/DATABASE/Nmap_Scan.png
Executable file
|
After Width: | Height: | Size: 44 KiB |
BIN
docs/img/DATABASE/Online_History.png
Executable file
|
After Width: | Height: | Size: 47 KiB |
BIN
docs/img/DATABASE/Parameters.png
Executable file
|
After Width: | Height: | Size: 39 KiB |
BIN
docs/img/DATABASE/Pholus_Scan.png
Executable file
|
After Width: | Height: | Size: 92 KiB |
BIN
docs/img/DATABASE/PiHole_Network.png
Executable file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/img/DATABASE/Plugins_Events.png
Executable file
|
After Width: | Height: | Size: 17 KiB |
BIN
docs/img/DATABASE/Plugins_History.png
Executable file
|
After Width: | Height: | Size: 72 KiB |
BIN
docs/img/DATABASE/Plugins_Language_Strings.png
Executable file
|
After Width: | Height: | Size: 42 KiB |
BIN
docs/img/DATABASE/Plugins_Objects.png
Executable file
|
After Width: | Height: | Size: 65 KiB |
BIN
docs/img/DATABASE/ScanCycles.png
Executable file
|
After Width: | Height: | Size: 35 KiB |
BIN
docs/img/DATABASE/Sessions.png
Executable file
|
After Width: | Height: | Size: 61 KiB |
BIN
docs/img/DATABASE/Settings.png
Executable file
|
After Width: | Height: | Size: 52 KiB |
BIN
docs/img/GENERAL/in-app-help.png
Executable file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Device-Presence-History.png
Executable file
|
After Width: | Height: | Size: 17 KiB |
BIN
docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Device-as-Sensors.png
Executable file
|
After Width: | Height: | Size: 14 KiB |
BIN
docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Devices-List.png
Executable file
|
After Width: | Height: | Size: 21 KiB |
BIN
docs/img/HOME_ASISSTANT/PiAlert-HomeAssistant-Overview-Card.png
Executable file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
docs/img/ICONS/device-icon.png
Executable file
|
After Width: | Height: | Size: 49 KiB |
BIN
docs/img/ICONS/devices-icons.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
docs/img/VERSIONS/latest-version-maintenance.png
Executable file
|
After Width: | Height: | Size: 60 KiB |
BIN
docs/img/VERSIONS/new-version-available-email.png
Executable file
|
After Width: | Height: | Size: 32 KiB |
BIN
docs/img/VERSIONS/new-version-available-maintenance.png
Executable file
|
After Width: | Height: | Size: 61 KiB |
0
front/buildtimestamp.txt
Executable file
@@ -773,6 +773,12 @@ height: 50px;
|
||||
margin: 2px;
|
||||
position: absolute;
|
||||
}
|
||||
#networkTree .netPort
|
||||
{
|
||||
width: 8px;;
|
||||
float:left;
|
||||
display:inline;
|
||||
}
|
||||
#networkTree
|
||||
{
|
||||
margin-left: 16px;
|
||||
@@ -814,25 +820,35 @@ height: 50px;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.plugin-content
|
||||
{
|
||||
padding-bottom: 7px;
|
||||
}
|
||||
.plugin-content #tabs-content-location
|
||||
{
|
||||
margin-top: 20px;
|
||||
margin-left: 7px;
|
||||
.plugin-filters
|
||||
{
|
||||
margin: 7px;
|
||||
margin-right: 7px;
|
||||
margin-bottom: 9px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.plugin-content
|
||||
{
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.plugin-content .left-nav{
|
||||
width: 100%;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.plugin-content #tabs-content-location
|
||||
{
|
||||
margin: 0px;
|
||||
|
||||
}
|
||||
|
||||
.plugins-description
|
||||
{
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.login-page .login-custom
|
||||
{
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
<li> <a id="tabPresence" href="#panPresence" data-toggle="tab"> <?= lang('DevDetail_Tab_Presence');?> </a></li>
|
||||
<li> <a id="tabEvents" href="#panEvents" data-toggle="tab"> <?= lang('DevDetail_Tab_Events');?> </a></li>
|
||||
<li> <a id="tabPholus" href="#panPholus" data-toggle="tab"> <?= lang('DevDetail_Tab_Pholus');?> </a></li>
|
||||
<li> <a id="tabPlugins" href="#panPlugins" data-toggle="tab"> <?= lang('DevDetail_Tab_Plugins');?> </a></li>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-default" style="padding: 10px; min-width: 30px;"
|
||||
@@ -194,7 +195,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">
|
||||
<?= lang('DevDetail_Icon');?>
|
||||
<a href="https://fontawesome.com/search?q=laptop&o=r&m=free" target="_blank"> <span><i class="fa fa-fw fa-arrow-up-right-from-square"></i></a><span>
|
||||
<a href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/ICONS.md" target="_blank"> <span><i class="fa fa-circle-question"></i></a><span>
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
@@ -347,6 +348,8 @@
|
||||
<input class="form-control" id="txtNetworkPort" type="text" value="--">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -463,11 +466,35 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="bottom-border-aqua"><?= lang('DevDetail_Copy_Device_Title');?></h4>
|
||||
<div class="box-body form-horizontal">
|
||||
<label class="col-sm-3 control-label">
|
||||
<?= lang('Navigation_Devices');?>
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
<input class="form-control" title="<?= lang('DevDetail_Copy_Device_Tooltip');?>" id="txtFromDevice" type="text" value="--">
|
||||
<span class="input-group-addon" title='<?= lang('Gen_Copy');?>'><i class="fa fa-copy pointer" onclick="askCopyFromDevice();"></i></span>
|
||||
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="fa fa-caret-down"></span>
|
||||
</button>
|
||||
<ul id="dropdownDevices" class="dropdown-menu dropdown-menu-right">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Buttons -->
|
||||
<div class="col-xs-12">
|
||||
<div class="pull-right">
|
||||
@@ -675,6 +702,17 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- tab page 7 ------------------------------------------------------------ -->
|
||||
<div class="tab-pane fade table-responsive" id="panPlugins">
|
||||
|
||||
|
||||
<?php
|
||||
// Include the other page
|
||||
include 'pluginsCore.php';
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
</div>
|
||||
@@ -814,6 +852,7 @@ function main () {
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has ('mac') == true) {
|
||||
mac = urlParams.get ('mac');
|
||||
setCache("piaDeviceDetailsMac", mac); // set cookie
|
||||
} else {
|
||||
$('#pageTitle').html ('Device not found');
|
||||
}
|
||||
@@ -949,6 +988,7 @@ function initializeCombos () {
|
||||
initializeCombo ( '#dropdownNetworkNodeMac', 'getNetworkNodes', 'txtNetworkNodeMac', false);
|
||||
initializeCombo ( '#dropdownIcon', 'getIcons', 'txtIcon', false);
|
||||
initializeCombo ( '#dropdownAction', 'getActions', 'txtAction', false);
|
||||
initializeCombo ( '#dropdownDevices', 'getDevices', 'txtFromDevice', false);
|
||||
|
||||
// Initialize static combos
|
||||
initializeComboSkipRepeated ();
|
||||
@@ -1350,7 +1390,7 @@ function getDeviceData (readAllData=false) {
|
||||
|
||||
// Name
|
||||
if (deviceData['dev_Owner'] == null || deviceData['dev_Owner'] == '' ||
|
||||
(deviceData['dev_Name']).indexOf (deviceData['dev_Owner']) != -1 ) {
|
||||
(deviceData['dev_Name'].toString()).indexOf (deviceData['dev_Owner']) != -1 ) {
|
||||
$('#pageTitle').html (deviceData['dev_Name']);
|
||||
} else {
|
||||
$('#pageTitle').html (deviceData['dev_Name'] + ' ('+ deviceData['dev_Owner'] +')');
|
||||
@@ -1505,7 +1545,10 @@ function performSwitch(direction)
|
||||
|
||||
// get new mac from the devicesList. Don't change to the commented out line below, the mac query string in the URL isn't updated yet!
|
||||
// mac = params.mac;
|
||||
|
||||
mac = devicesList[pos].mac.toString();
|
||||
|
||||
setCache("piaDeviceDetailsMac", mac);
|
||||
|
||||
getDeviceData (true);
|
||||
|
||||
@@ -1623,6 +1666,29 @@ function deleteDeviceEvents () {
|
||||
$('#panDetails :input').attr('disabled', true);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function askCopyFromDevice() {
|
||||
// Ask
|
||||
showModalWarning('<?= lang('BackDevDetail_Copy_Title');?>', '<?= lang('BackDevDetail_Copy_Ask');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Run');?>', 'copyFromDevice');
|
||||
}
|
||||
|
||||
function copyFromDevice() {
|
||||
|
||||
// Execute
|
||||
$.get('php/server/devices.php?action=copyFromDevice&'
|
||||
+ '&macTo=' + $('#txtMAC').val()
|
||||
+ '&macFrom=' + $('#txtFromDevice').val()
|
||||
, function(msg) {
|
||||
showMessage (msg);
|
||||
|
||||
setTimeout(function() {
|
||||
window.location.reload();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function askRunAction() {
|
||||
// Ask
|
||||
|
||||
@@ -192,8 +192,8 @@
|
||||
var tableRows = 10;
|
||||
var tableOrder = [[3,'desc'], [0,'asc']];
|
||||
|
||||
var columnsStr = '[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]';
|
||||
var tableColumnOrder = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] ;
|
||||
var columnsStr = '[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]';
|
||||
var tableColumnOrder = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18];
|
||||
var tableColumnVisible = tableColumnOrder;
|
||||
|
||||
// Read parameters & Initialize components
|
||||
@@ -225,6 +225,8 @@ function main () {
|
||||
// save the columns order in the Devices page
|
||||
tableColumnOrder = numberArrayFromString(data);
|
||||
|
||||
|
||||
|
||||
//initialize the table headers in the correct order
|
||||
var headersDefaultOrder = [ '<?= lang('Device_TableHead_Name');?>',
|
||||
'<?= lang('Device_TableHead_Owner');?>',
|
||||
@@ -308,21 +310,13 @@ function mapIndx(oldIndex)
|
||||
function initializeDatatable () {
|
||||
for(i = 0; i < tableColumnOrder.length; i++)
|
||||
{
|
||||
// hide this column if not in the tableColumnVisible variable
|
||||
// hide this column if not in the tableColumnVisible variable (we need to keep the MAC address (index 11) for functionality reasons)
|
||||
if(tableColumnVisible.includes(tableColumnOrder[i]) == false)
|
||||
{
|
||||
tableColumnHide.push(mapIndx(tableColumnOrder[i]));
|
||||
}
|
||||
}
|
||||
|
||||
// If the device has a small width (mobile) only show name, ip, and status columns.
|
||||
if (window.screen.width < 400) {
|
||||
tableColumnHide = [11,12,13,1,2,4,5,6,7,9];
|
||||
}
|
||||
// else {
|
||||
// // var tableColumnHide = [11, 12, 13];
|
||||
// tableColumnHide = [11, 12, 13];
|
||||
// };
|
||||
|
||||
var table=
|
||||
$('#tableDevices').DataTable({
|
||||
'paging' : true,
|
||||
@@ -348,7 +342,7 @@ function initializeDatatable () {
|
||||
|
||||
// Device Name
|
||||
{targets: [mapIndx(0)],
|
||||
'createdCell': function (td, cellData, rowData, row, col) {
|
||||
'createdCell': function (td, cellData, rowData, row, col) {
|
||||
$(td).html ('<b class="anonymizeDev"><a href="deviceDetails.php?mac='+ rowData[mapIndx(11)] +'" class="">'+ cellData +'</a></b>');
|
||||
} },
|
||||
|
||||
|
||||
@@ -89,6 +89,19 @@
|
||||
<?= lang('HelpFAQ_Cat_General_103_text');?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion_net" href="#collapse601">
|
||||
<?= lang('HelpFAQ_Cat_Network_601_head');?></a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapse601" class="panel-collapse collapse" style="font-size: 16px;">
|
||||
<div class="panel-body">
|
||||
<?= lang('HelpFAQ_Cat_Network_601_text');?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -164,6 +177,7 @@
|
||||
<?= lang('HelpFAQ_Cat_Detail_303_text');?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -211,7 +225,7 @@
|
||||
<?= lang('HelpFAQ_Cat_Network_600_text');?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -35,18 +35,18 @@ function handleVersion(){
|
||||
|
||||
function getVersion()
|
||||
{
|
||||
release_timestamp = getCookie("release_timestamp")
|
||||
release_timestamp = getCookie("release_timestamp")
|
||||
|
||||
// no cached value available
|
||||
if(release_timestamp == "")
|
||||
{
|
||||
// get parameter value
|
||||
$.get('https://api.github.com/repos/jokob-sk/Pi.Alert/releases', function(data) {
|
||||
$.get('https://api.github.com/repos/jokob-sk/Pi.Alert/releases').done(function(response) {
|
||||
// Handle successful response
|
||||
var releases = response;
|
||||
|
||||
var releases = data;
|
||||
|
||||
if(releases.length > 0)
|
||||
{
|
||||
|
||||
release_datetime = releases[0].published_at;
|
||||
release_timestamp = new Date(release_datetime).getTime() / 1000;
|
||||
|
||||
@@ -55,6 +55,11 @@ function handleVersion(){
|
||||
|
||||
handleVersion();
|
||||
}
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
|
||||
$('.version').append(`<p>Github API: ${errorThrown} (${jqXHR.status}), ${jqXHR.responseJSON.message}</p>`)
|
||||
|
||||
});
|
||||
} else
|
||||
{
|
||||
|
||||
@@ -118,6 +118,30 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Table sizes -----------------------------------------------------------------
|
||||
|
||||
$tableSizesHTML = "";
|
||||
|
||||
// Open a connection to the SQLite database
|
||||
$db = new SQLite3($pia_db);
|
||||
|
||||
// Retrieve the table names from sqlite_master
|
||||
$query = "SELECT name FROM sqlite_master WHERE type='table'";
|
||||
$result = $db->query($query);
|
||||
|
||||
// Iterate over the tables and get the row counts
|
||||
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
$tableName = $row['name'];
|
||||
$query = "SELECT COUNT(*) FROM $tableName";
|
||||
$countResult = $db->querySingle($query);
|
||||
$tableSizesHTML = $tableSizesHTML . "$tableName (<b>$countResult</b>), ";
|
||||
}
|
||||
|
||||
// Close the database connection
|
||||
$db->close();
|
||||
|
||||
|
||||
|
||||
|
||||
// Language selector -----------------------------------------------------------------
|
||||
|
||||
@@ -131,8 +155,11 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
|
||||
</div>
|
||||
<div class="box-body" style="padding-bottom: 5px;">
|
||||
<div class="db_info_table">
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_version');?></div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_version');?>
|
||||
<a href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/VERSIONS.md" target="_blank"> <span><i class="fa fa-circle-question"></i></a><span>
|
||||
|
||||
</div>
|
||||
<div class="db_info_table_cell">
|
||||
<div class="version" id="version" data-build-time="<?php echo file_get_contents( "buildtimestamp.txt");?>"><?php echo '<span id="new-version-text" class="myhidden">' .lang('Maintenance_new_version').'</span>'.'<span id="current-version-text" class="myhidden">' .lang('Maintenance_current_version').'</span>';?></div>
|
||||
</div>
|
||||
@@ -147,7 +174,13 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
|
||||
<div class="db_info_table_cell"><?= lang('Maintenance_database_size');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo $pia_db_size;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell"><?= lang('Maintenance_database_rows');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo $tableSizesHTML;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell"><?= lang('Maintenance_database_lastmod');?></div>
|
||||
@@ -243,6 +276,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
|
||||
<option value="15"><?= lang('Device_TableHead_Connected_Devices');?></option>
|
||||
<option value="16"><?= lang('Device_TableHead_Location');?></option>
|
||||
<option value="17"><?= lang('Device_TableHead_Vendor');?></option>
|
||||
<option value="18"><?= lang('Device_TableHead_Port');?></option>
|
||||
</select>
|
||||
<span class="input-group-addon"><i title="<?= lang('Gen_Save');?>" class="fa fa-save pointer" onclick="saveSelectedColumns();"></i></span>
|
||||
</div>
|
||||
@@ -335,7 +369,17 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
|
||||
<div class="db_info_table">
|
||||
<div class="log-area">
|
||||
<div class="row logs-row">
|
||||
<textarea id="pialert_log" class="logs" cols="70" rows="10" wrap='off' readonly ><?php echo file_get_contents( "./log/pialert.log" ); ?>
|
||||
<textarea id="pialert_log" class="logs" cols="70" rows="10" wrap='off' readonly >
|
||||
<?php
|
||||
if(filesize("./log/pialert.log") > 2000000)
|
||||
{
|
||||
echo file_get_contents( "./log/pialert.log", false, null, -2000000);
|
||||
}
|
||||
else{
|
||||
echo file_get_contents( "./log/pialert.log" );
|
||||
}
|
||||
|
||||
?>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row logs-row" >
|
||||
@@ -364,7 +408,24 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="log-area">
|
||||
<div class="row logs-row">
|
||||
<textarea id="pialert_php_log" class="logs" cols="70" rows="10" wrap='off' readonly><?php echo file_get_contents( "./log/pialert.php_errors.log" ); ?>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row logs-row" >
|
||||
<div>
|
||||
<div class="log-file">pialert.php_errors.log<div class="logs-size"><?php echo number_format((filesize("./log/pialert.php_errors.log") / 1000000),2,",",".") . ' MB';?>
|
||||
<span class="span-padding"><a href="./log/pialert.php_errors.log"><i class="fa fa-download"></i> </a></span>
|
||||
</div></div>
|
||||
<div class="log-purge">
|
||||
<button class="btn btn-primary" onclick="logManage('pialert.php_errors.log','cleanLog')"><?= lang('Gen_Purge');?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="log-area">
|
||||
|
||||
<div class="row logs-row">
|
||||
@@ -702,12 +763,16 @@ function performLogManage() {
|
||||
// --------------------------------------------------------
|
||||
function scrollDown()
|
||||
{
|
||||
var areaIDs = ['pialert_log', 'pialert_front_log', 'IP_changes_log', 'stdout_log', 'stderr_log', 'pialert_pholus_log', 'pialert_pholus_lastrun_log'];
|
||||
var areaIDs = ['pialert_log', 'pialert_front_log', 'IP_changes_log', 'stdout_log', 'stderr_log', 'pialert_pholus_log', 'pialert_pholus_lastrun_log', 'pialert_php_log'];
|
||||
|
||||
for (let i = 0; i < areaIDs.length; i++) {
|
||||
|
||||
var tempArea = $('#' + areaIDs[i]);
|
||||
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
|
||||
|
||||
if (tempArea.length > 0)
|
||||
{
|
||||
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -715,8 +780,8 @@ function scrollDown()
|
||||
// --------------------------------------------------------
|
||||
// Manage displayed columns
|
||||
// --------------------------------------------------------
|
||||
colDefaultOrder = ['0','1','2','3','4','5','6','7','8','9','10','12','13','14','15','16','17'];
|
||||
colDefaultOrderTxt = '[0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17]';
|
||||
colDefaultOrder = ['0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17'];
|
||||
colDefaultOrderTxt = '[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]';
|
||||
|
||||
|
||||
function saveSelectedColumns () {
|
||||
@@ -724,9 +789,7 @@ function saveSelectedColumns () {
|
||||
// save full order of all columns to simplify mapping later on
|
||||
|
||||
colDisplayed = $('#columnsSelect').val();
|
||||
|
||||
|
||||
|
||||
colNewOrder = colDisplayed;
|
||||
|
||||
// append the remaining columns in the previous order
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
// / \
|
||||
// Smart TV (leaf) Switch 2 (node (for the PC) and leaf (for Switch 1))
|
||||
// \
|
||||
// PC (leaf)
|
||||
// PC (leaf) <------- leafs are not included in this SQL query
|
||||
|
||||
$sql = "SELECT node_name, node_mac, online, node_type, node_ports_count, parent_mac, node_icon
|
||||
FROM
|
||||
@@ -279,7 +279,7 @@
|
||||
a.dev_Network_Node_MAC_ADDR as parent_mac,
|
||||
a.dev_Icon as node_icon
|
||||
FROM Devices a
|
||||
WHERE a.dev_DeviceType in ('AP', 'Gateway', 'Firewall', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet')
|
||||
WHERE a.dev_DeviceType in ('AP', 'Gateway', 'Firewall', 'Hypervisor', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet')
|
||||
) t1
|
||||
LEFT JOIN
|
||||
(
|
||||
@@ -465,7 +465,8 @@
|
||||
"parentMac":item[14],
|
||||
"rowid":item[13],
|
||||
"status":item[10],
|
||||
"childrenQty":item[15]
|
||||
"childrenQty":item[15],
|
||||
"port":item[18]
|
||||
}})
|
||||
|
||||
setCache('devicesListNew', JSON.stringify(devicesListnew))
|
||||
@@ -541,6 +542,7 @@
|
||||
name: node.name,
|
||||
path: path,
|
||||
mac: node.mac,
|
||||
port: node.port,
|
||||
id: node.mac,
|
||||
parentMac: node.parentMac,
|
||||
icon: node.icon,
|
||||
@@ -628,7 +630,9 @@
|
||||
renderNode: nodeData => {
|
||||
var fontSize = "font-size:"+emSize+"em;";
|
||||
|
||||
// Build HTML for individual nodes in the network diagram
|
||||
deviceIcon = (!emptyArr.includes(nodeData.data.icon )) ? "<div class='netIcon ' ><i class='fa fa-"+nodeData.data.icon +"'></i></div>" : "";
|
||||
devicePort = (!emptyArr.includes(nodeData.data.port )) ? "<div class='netPort ' >"+nodeData.data.port +"</div>" : "";
|
||||
collapseExpandIcon = nodeData.data.hiddenChildren ? "square-plus" :"square-minus";
|
||||
collapseExpandHtml = (nodeData.data.hasChildren) ? "<div class='netCollapse' style='font-size:"+emSize*2.5+"em;' data-mytreepath='"+nodeData.data.path+"' data-mytreemac='"+nodeData.data.mac+"'><i class='fa fa-"+ collapseExpandIcon +" pointer'></i></div>" : "";
|
||||
statusCss = " netStatus-" + nodeData.data.status;
|
||||
@@ -648,7 +652,7 @@
|
||||
border-radius:5px;'\
|
||||
>\
|
||||
<div class='netNodeText '>\
|
||||
<strong>" + deviceIcon +
|
||||
<strong>" + devicePort + deviceIcon +
|
||||
"<span class='spanNetworkTree anonymizeDev'>"+nodeData.data.name+"</span>\
|
||||
</strong>"
|
||||
+collapseExpandHtml+
|
||||
|
||||
@@ -65,7 +65,7 @@ function OpenDB (...$DBPath) {
|
||||
die ('<div style="padding-left:150px">Error connecting to the database</div>');
|
||||
}
|
||||
|
||||
$db->exec('PRAGMA journal_mode = wal;');
|
||||
$db->exec('PRAGMA journal_mode = wal;');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
case 'overwriteIconType': overwriteIconType(); break;
|
||||
case 'getIcons': getIcons(); break;
|
||||
case 'getActions': getActions(); break;
|
||||
case 'getDevices': getDevices(); break;
|
||||
case 'copyFromDevice': copyFromDevice(); break;
|
||||
case 'wakeonlan': wakeonlan(); break;
|
||||
|
||||
default: logServerConsole ('Action: '. $action); break;
|
||||
@@ -477,6 +479,7 @@ function ImportCSV() {
|
||||
|
||||
global $db;
|
||||
|
||||
$skipped = "";
|
||||
$error = "";
|
||||
|
||||
// sql
|
||||
@@ -492,12 +495,13 @@ function ImportCSV() {
|
||||
|
||||
|
||||
// Parse data from CSV file line by line (max 10000 lines)
|
||||
$index = 0;
|
||||
foreach($data as $row)
|
||||
{
|
||||
// Check if not empty and skipping first line
|
||||
$rowArray = explode(',',$row);
|
||||
|
||||
if(count($rowArray) > 20)
|
||||
if(count($rowArray) > 23)
|
||||
{
|
||||
$cleanMac = str_replace("\"","",$rowArray[0]);
|
||||
|
||||
@@ -513,19 +517,21 @@ function ImportCSV() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else{
|
||||
$skipped = $skipped . ($index+1) . ",";
|
||||
}
|
||||
|
||||
$index = $index + 1;
|
||||
}
|
||||
|
||||
if($error == "")
|
||||
{
|
||||
// import succesful
|
||||
echo lang('BackDevices_DBTools_ImportCSV');
|
||||
echo lang('BackDevices_DBTools_ImportCSV') . " (Skipped lines: " .$skipped .") ";
|
||||
|
||||
}
|
||||
else{
|
||||
// an error occurred while writing to the DB, display the last error message
|
||||
echo lang('BackDevices_DBTools_ImportCSVError')."\n\n$sql \n\n".$result;
|
||||
echo lang('BackDevices_DBTools_ImportCSVError')."\n".$error."\n$sql \n\n".$result;
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -570,72 +576,6 @@ function getDevicesTotals() {
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Query the List of devices in a determined Status
|
||||
//------------------------------------------------------------------------------
|
||||
// function getDevicesListForNetworkTree() {
|
||||
// global $db;
|
||||
|
||||
// $sql = 'SELECT *, CASE
|
||||
// WHEN t1.dev_AlertDeviceDown=1 AND t1.dev_PresentLastScan=0 THEN "Down"
|
||||
// WHEN t1.dev_NewDevice=1 THEN "New"
|
||||
// WHEN t1.dev_PresentLastScan=1 THEN "On-line"
|
||||
// ELSE "Off-line" END AS dev_Status
|
||||
// FROM (Devices ) t1
|
||||
// LEFT JOIN
|
||||
// (
|
||||
// SELECT *,
|
||||
// count() as connected_devices
|
||||
// FROM Devices b
|
||||
// WHERE b.dev_Network_Node_MAC_ADDR NOT NULL group by b.dev_Network_Node_MAC_ADDR
|
||||
// ) t2
|
||||
// ON (t1.dev_MAC = t2.dev_MAC); ';
|
||||
|
||||
// $result = $db->query($sql);
|
||||
|
||||
// // arrays of rows
|
||||
// $tableData = array();
|
||||
// while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
|
||||
// $defaultOrder = array ($row['dev_Name'],
|
||||
// $row['dev_Owner'],
|
||||
// handleNull($row['dev_DeviceType']),
|
||||
// handleNull($row['dev_Icon'], "laptop"),
|
||||
// $row['dev_Favorite'],
|
||||
// $row['dev_Group'],
|
||||
// formatDate ($row['dev_FirstConnection']),
|
||||
// formatDate ($row['dev_LastConnection']),
|
||||
// $row['dev_LastIP'],
|
||||
// ( in_array($row['dev_MAC'][1], array("2","6","A","E","a","e")) ? 1 : 0),
|
||||
// $row['dev_Status'],
|
||||
// $row['dev_MAC'], // MAC (hidden)
|
||||
// formatIPlong ($row['dev_LastIP']), // IP orderable
|
||||
// $row['rowid'], // Rowid (hidden)
|
||||
// handleNull($row['dev_Network_Node_MAC_ADDR']), //
|
||||
// handleNull($row['connected_devices']) //
|
||||
// );
|
||||
|
||||
// $newOrder = array();
|
||||
|
||||
// // reorder columns based on user settings
|
||||
// for($index = 0; $index < count($columnOrderMapping); $index++)
|
||||
// {
|
||||
// array_push($newOrder, $defaultOrder[$columnOrderMapping[$index][2]]);
|
||||
// }
|
||||
|
||||
// $tableData['data'][] = $newOrder;
|
||||
// }
|
||||
|
||||
// // Control no rows
|
||||
// if (empty($tableData['data'])) {
|
||||
// $tableData['data'] = '';
|
||||
// }
|
||||
|
||||
// // Return json
|
||||
// echo (json_encode ($tableData));
|
||||
|
||||
// }
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Query the List of devices in a determined Status
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -649,7 +589,7 @@ function getDevicesList() {
|
||||
$forceDefaultOrder = TRUE;
|
||||
}
|
||||
|
||||
// This object is used to map from the old order ( second parameter, first number) to the 3rd parameter (Second number (here initialized to -1))
|
||||
// This object is used to map from the old order ( second parameter, first number) to the new mapping, that is represented by the 3rd parameter (Second number)
|
||||
$columnOrderMapping = array(
|
||||
array("dev_Name", 0, 0),
|
||||
array("dev_Owner", 1, 1),
|
||||
@@ -668,7 +608,8 @@ function getDevicesList() {
|
||||
array("dev_Network_Node_MAC_ADDR", 14, 14),
|
||||
array("connected_devices", 15, 15),
|
||||
array("dev_Location", 16, 16),
|
||||
array("dev_Vendor", 17, 17)
|
||||
array("dev_Vendor", 17, 17),
|
||||
array("dev_Network_Node_port", 18, 18)
|
||||
);
|
||||
|
||||
if($forceDefaultOrder == FALSE)
|
||||
@@ -684,9 +625,11 @@ function getDevicesList() {
|
||||
$orderedColumns = createArray($row[0]);
|
||||
|
||||
// init ordered columns
|
||||
for($i = 0; $i < count($orderedColumns); $i++) {
|
||||
$columnOrderMapping[$i][2] = $orderedColumns[$i];
|
||||
for($i = 0; $i < count($orderedColumns); $i++) {
|
||||
|
||||
$columnOrderMapping[$i][2] = $orderedColumns[$i];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,7 +675,8 @@ function getDevicesList() {
|
||||
handleNull($row['dev_Network_Node_MAC_ADDR']),
|
||||
handleNull($row['connected_devices']),
|
||||
handleNull($row['dev_Location']),
|
||||
handleNull($row['dev_Vendor'])
|
||||
handleNull($row['dev_Vendor']),
|
||||
handleNull($row['dev_Network_Node_port'])
|
||||
);
|
||||
|
||||
$newOrder = array();
|
||||
@@ -823,7 +767,7 @@ function getNetworkNodes() {
|
||||
global $db;
|
||||
|
||||
// Device Data
|
||||
$sql = 'SELECT * FROM Devices WHERE dev_DeviceType in ( "AP", "Gateway", "Firewall", "Powerline", "Switch", "WLAN", "PLC", "Router","USB LAN Adapter", "USB WIFI Adapter")';
|
||||
$sql = 'SELECT * FROM Devices WHERE dev_DeviceType in ( "AP", "Gateway", "Firewall", "Hypervisor", "Powerline", "Switch", "WLAN", "PLC", "Router","USB LAN Adapter", "USB WIFI Adapter")';
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@@ -883,6 +827,36 @@ function getActions() {
|
||||
echo (json_encode ($tableData));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function getDevices() {
|
||||
|
||||
global $db;
|
||||
|
||||
// Device Data
|
||||
$sql = 'select dev_MAC, dev_Name from Devices';
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
// arrays of rows
|
||||
$tableData = array();
|
||||
|
||||
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
$name = handleNull($row['dev_Name'], "(unknown)");
|
||||
$mac = handleNull($row['dev_MAC'], "(unknown)");
|
||||
// Push row data
|
||||
$tableData[] = array('id' => $mac,
|
||||
'name' => $name );
|
||||
}
|
||||
|
||||
// Control no rows
|
||||
if (empty($tableData)) {
|
||||
$tableData = [];
|
||||
}
|
||||
|
||||
// Return json
|
||||
echo (json_encode ($tableData));
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Query the List of types
|
||||
@@ -900,7 +874,7 @@ function getDeviceTypes() {
|
||||
"Laptop", "Mini PC", "PC", "Printer", "Server", "Singleboard Computer (SBC)", "NAS",
|
||||
"Domotic", "IP Camera", "Game Console", "SmartTV", "TV Decoder", "Virtual Assistance",
|
||||
"Clock", "House Appliance", "Phone", "Radio",
|
||||
"AP", "Gateway", "Firewall", "Powerline", "Switch", "WLAN", "PLC", "Router","USB LAN Adapter", "USB WIFI Adapter" )
|
||||
"AP", "Gateway", "Firewall", "Hypervisor", "Powerline", "Switch", "WLAN", "PLC", "Router","USB LAN Adapter", "USB WIFI Adapter" )
|
||||
|
||||
UNION SELECT 1 as dev_Order, "Smartphone"
|
||||
UNION SELECT 1 as dev_Order, "Tablet"
|
||||
@@ -929,6 +903,7 @@ function getDeviceTypes() {
|
||||
UNION SELECT 5 as dev_Order, "AP"
|
||||
UNION SELECT 5 as dev_Order, "Gateway"
|
||||
UNION SELECT 5 as dev_Order, "Firewall"
|
||||
UNION SELECT 5 as dev_Order, "Hypervisor"
|
||||
UNION SELECT 5 as dev_Order, "Powerline"
|
||||
UNION SELECT 5 as dev_Order, "Switch"
|
||||
UNION SELECT 5 as dev_Order, "WLAN"
|
||||
@@ -1233,6 +1208,56 @@ function wakeonlan() {
|
||||
echo lang('BackDevDetail_Tools_WOL_okay');
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Copy from device
|
||||
//------------------------------------------------------------------------------
|
||||
function copyFromDevice() {
|
||||
|
||||
$MAC_FROM = $_REQUEST['macFrom'];
|
||||
$MAC_TO = $_REQUEST['macTo'];
|
||||
|
||||
if ((false === filter_var($MAC_FROM , FILTER_VALIDATE_MAC) && $MAC_FROM != "Internet" && $MAC_FROM != "") ) {
|
||||
throw new Exception('Invalid mac address');
|
||||
}
|
||||
if ((false === filter_var($MAC_TO , FILTER_VALIDATE_MAC) && $MAC_TO != "Internet" && $MAC_TO != "") ) {
|
||||
throw new Exception('Invalid mac address');
|
||||
}
|
||||
|
||||
global $db;
|
||||
|
||||
// clean-up temporary table
|
||||
$sql = "DROP TABLE temp_devices ";
|
||||
$result = $db->query($sql);
|
||||
|
||||
// create temporary table with the source data
|
||||
$sql = "CREATE TABLE temp_devices AS SELECT * FROM Devices WHERE dev_MAC = '". $MAC_FROM . "';";
|
||||
$result = $db->query($sql);
|
||||
|
||||
// update temporary table with the correct target MAC
|
||||
$sql = "UPDATE temp_devices SET dev_MAC = '". $MAC_TO . "';";
|
||||
$result = $db->query($sql);
|
||||
|
||||
// delete previous entry
|
||||
$sql = "DELETE FROM Devices WHERE dev_MAC = '". $MAC_TO . "';";
|
||||
$result = $db->query($sql);
|
||||
|
||||
// insert new entry with the correct target MAC from the temporary table
|
||||
$sql = "INSERT INTO Devices SELECT * FROM temp_devices WHERE dev_MAC = '".$MAC_TO."'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
// clean-up temporary table
|
||||
$sql = "DROP TABLE temp_devices ";
|
||||
$result = $db->query($sql);
|
||||
|
||||
// check result
|
||||
if ($result == TRUE) {
|
||||
echo 'OK';
|
||||
} else {
|
||||
echo lang('BackDevices_Device_UpdDevError');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Status Where conditions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -274,11 +274,11 @@ function saveSettings()
|
||||
{
|
||||
if($group == $setting[0])
|
||||
{
|
||||
if($setting[2] == 'text' or $setting[2] == 'password' or $setting[2] == 'readonly' or $setting[2] == 'selecttext')
|
||||
if($setting[2] == 'text' or $setting[2] == 'password' or $setting[2] == 'readonly' or $setting[2] == 'text.select')
|
||||
{
|
||||
$val = encode_single_quotes($setting[3]);
|
||||
$txt = $txt.$setting[1]."='".$val."'\n" ;
|
||||
} elseif($setting[2] == 'integer' or $setting[2] == 'selectinteger')
|
||||
} elseif($setting[2] == 'integer' or $setting[2] == 'integer.select')
|
||||
{
|
||||
$txt = $txt.$setting[1]."=".$setting[3]."\n" ;
|
||||
} elseif($setting[2] == 'boolean')
|
||||
@@ -289,7 +289,7 @@ function saveSettings()
|
||||
$val = "True";
|
||||
}
|
||||
$txt = $txt.$setting[1]."=".$val."\n" ;
|
||||
}elseif($setting[2] == 'multiselect' or $setting[2] == 'subnets' or $setting[2] == 'list')
|
||||
}elseif($setting[2] == 'text.multiselect' or $setting[2] == 'subnets' or $setting[2] == 'list')
|
||||
{
|
||||
$temp = '[';
|
||||
|
||||
@@ -381,11 +381,11 @@ function handleNull ($text, $default = "") {
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
// Currently unused - should be source of truth for network types (or define somewhere else?)
|
||||
function getNetworkTypes(){
|
||||
|
||||
$array = array(
|
||||
"AP", "Gateway", "Firewall", "Powerline", "Switch", "WLAN", "PLC", "Router","USB LAN Adapter", "USB WIFI Adapter"
|
||||
"AP", "Gateway", "Firewall", "Hypervisor", "Powerline", "Switch", "WLAN", "PLC", "Router","USB LAN Adapter", "USB WIFI Adapter"
|
||||
);
|
||||
|
||||
return $array;
|
||||
|
||||
@@ -12,9 +12,38 @@
|
||||
<!-- Default to the left -->
|
||||
|
||||
<!-- © 2020 Puche -->
|
||||
<?php
|
||||
echo '<span style="display:inline-block; transform: rotate(180deg)">©</span> 2020 Puche (2022+ <a href="mailto:jokob@duck.com?subject=PiAlert">jokob-sk</a>)';
|
||||
?>
|
||||
<span style="display:inline-block; transform: rotate(180deg)">©</span>
|
||||
|
||||
|
||||
|
||||
2020 Puche (2022+ <a href="mailto:jokob@duck.com?subject=PiAlert">jokob-sk</a>) | <b>Built on: </b>
|
||||
|
||||
<?php
|
||||
|
||||
echo date("Y-m-d", ((int)file_get_contents( "buildtimestamp.txt")));
|
||||
|
||||
?>
|
||||
|
||||
| <b> Version: </b>
|
||||
|
||||
<?php
|
||||
|
||||
$filename = "/.VERSION";
|
||||
|
||||
if(file_exists($filename))
|
||||
{
|
||||
echo file_get_contents($filename);
|
||||
}
|
||||
else{
|
||||
echo "File not found";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
||||
<a href="https://github.com/jokob-sk/Pi.Alert/tree/main/docs" target="_blank">
|
||||
<span>Docs <i class="fa fa-circle-question"></i>
|
||||
</a><span>
|
||||
|
||||
<!-- To the right -->
|
||||
<div class="pull-right no-hidden-xs">
|
||||
|
||||
|
||||
@@ -8,15 +8,43 @@ $Pia_Graph_Device_Online = array();
|
||||
$Pia_Graph_Device_Down = array();
|
||||
$Pia_Graph_Device_Arch = array();
|
||||
|
||||
$statusesToShow = "'online', 'offline', 'archived'";
|
||||
|
||||
$statQuery = $db->query("SELECT * FROM Settings WHERE Code_Name = 'UI_PRESENCE'");
|
||||
|
||||
while($r = $statQuery->fetchArray(SQLITE3_ASSOC))
|
||||
{
|
||||
$statusesToShow = $r['Value'];
|
||||
}
|
||||
|
||||
$results = $db->query('SELECT * FROM Online_History ORDER BY Scan_Date DESC LIMIT 144');
|
||||
while ($row = $results->fetchArray()) {
|
||||
$time_raw = explode(' ', $row['Scan_Date']);
|
||||
$time = explode(':', $time_raw[1]);
|
||||
array_push($Pia_Graph_Device_Time, $time[0].':'.$time[1]);
|
||||
array_push($Pia_Graph_Device_Down, $row['Down_Devices']);
|
||||
array_push($Pia_Graph_Device_All, $row['All_Devices']);
|
||||
array_push($Pia_Graph_Device_Online, $row['Online_Devices']);
|
||||
array_push($Pia_Graph_Device_Arch, $row['Archived_Devices']);
|
||||
|
||||
while ($row = $results->fetchArray())
|
||||
{
|
||||
$time_raw = explode(' ', $row['Scan_Date']);
|
||||
$time = explode(':', $time_raw[1]);
|
||||
array_push($Pia_Graph_Device_Time, $time[0].':'.$time[1]);
|
||||
|
||||
// Offline
|
||||
if(strpos($statusesToShow, 'offline') !== false)
|
||||
{
|
||||
array_push($Pia_Graph_Device_Down, $row['Down_Devices']);
|
||||
}
|
||||
|
||||
// All
|
||||
array_push($Pia_Graph_Device_All, $row['All_Devices']);
|
||||
|
||||
// Online
|
||||
if(strpos($statusesToShow, 'online') !== false)
|
||||
{
|
||||
array_push($Pia_Graph_Device_Online, $row['Online_Devices']);
|
||||
}
|
||||
|
||||
// Archived
|
||||
if(strpos($statusesToShow, 'archived') !== false)
|
||||
{
|
||||
array_push($Pia_Graph_Device_Arch, $row['Archived_Devices']);
|
||||
}
|
||||
}
|
||||
function pia_graph_devices_data($Pia_Graph_Array) {
|
||||
$Pia_Graph_Array_rev = array_reverse($Pia_Graph_Array);
|
||||
|
||||
@@ -380,7 +380,7 @@ $lang['de_de'] = array(
|
||||
lösche ggf. die betreffende DHCP-Lease. Anschließend schaue, ebenfalls in Pi-hole, unter Tools -> Network, ob sich dort die immer wiederkehrenden Hosts finden lassen.
|
||||
Wenn ja, lösche diese dort ebenfalls. Nun kannst du Pi.Alert wieder starten. Jetzt sollte das Gerät/die Geräte nicht mehr auftauchen.',
|
||||
'HelpFAQ_Cat_Detail_300_head' => 'Was bedeutet ',
|
||||
'HelpFAQ_Cat_Detail_300_text_a' => 'meint ein Netzwerkgerät (welches den typ AP, Gateway, Firewall, Powerline, Switch, WLAN, PLC, Router,USB LAN Adapter, USB WIFI Adapter, or Internet eingestellt hat)',
|
||||
'HelpFAQ_Cat_Detail_300_text_a' => 'meint ein Netzwerkgerät (welches den typ AP, Gateway, Firewall, Hypervisor, Powerline, Switch, WLAN, PLC, Router,USB LAN Adapter, USB WIFI Adapter, or Internet eingestellt hat)',
|
||||
'HelpFAQ_Cat_Detail_300_text_b' => 'bezeichnet die Anschlussnummer/Portnummer, an der das gerade bearbeitete Gerät mit diesem Netzwerkgerät verbunden ist.',
|
||||
'HelpFAQ_Cat_Detail_301_head_a' => 'Wann wird nun gescannt? Bei ',
|
||||
'HelpFAQ_Cat_Detail_301_head_b' => ' steht 1min aber der Graph zeigt 5min - Abstände an.',
|
||||
|
||||
@@ -19,6 +19,7 @@ $lang['en_us'] = array(
|
||||
'Gen_Save' => 'Save',
|
||||
'Gen_Saved' => 'Saved',
|
||||
'Gen_Run' => 'Run',
|
||||
'Gen_Copy' => 'Run',
|
||||
'Gen_Action' => 'Action',
|
||||
'Gen_Purge' => 'Purge',
|
||||
'Gen_Backup' => 'Run Backup',
|
||||
@@ -27,7 +28,7 @@ $lang['en_us'] = array(
|
||||
'Gen_AreYouSure' => 'Are you sure?',
|
||||
'Gen_Upd' => 'Updated successfully',
|
||||
'Gen_Upd_Fail' => 'Update failed',
|
||||
'Gen_Help' => 'Need help?',
|
||||
'Gen_ReadDocs' => 'Read more in the docs.',
|
||||
'Gen_DataUpdatedUITakesTime' => 'OK - It may take a while for the UI to update if a scan is runnig.',
|
||||
'Gen_LockedDB' => 'ERROR - DB might be locked - Check F12 Dev tools -> Console or try later.',
|
||||
|
||||
@@ -80,6 +81,7 @@ $lang['en_us'] = array(
|
||||
'Device_TableHead_Connected_Devices' => 'Connected Devices',
|
||||
'Device_TableHead_Location' => 'Location',
|
||||
'Device_TableHead_Vendor' => 'Vendor',
|
||||
'Device_TableHead_Port' => 'Port',
|
||||
'Device_TableHead_Favorite' => 'Favorite',
|
||||
'Device_TableHead_Group' => 'Group',
|
||||
'Device_TableHead_FirstSession' => 'First Session',
|
||||
@@ -116,6 +118,7 @@ $lang['en_us'] = array(
|
||||
'Presence_CalHead_quarter' => 'quarter',
|
||||
'Presence_CalHead_month' => 'month',
|
||||
'Presence_CalHead_week' => 'week',
|
||||
'Presence_CalHead_day' => 'day',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Events Page
|
||||
@@ -173,6 +176,7 @@ $lang['en_us'] = array(
|
||||
'DevDetail_Tab_Events' => '<i class="fa fa-bolt"></i> Events',
|
||||
'DevDetail_Tab_Pholus' => '<i class="fa fa-search"></i> Pholus',
|
||||
'DevDetail_Tab_PholusEmpty' => 'Nothing sniffed out with Pholus for this device.',
|
||||
'DevDetail_Tab_Plugins' => '<i class="fa fa-plug"></i> Plugins',
|
||||
'DevDetail_Tab_NmapTableHeader' => 'Scheduled scan results',
|
||||
'DevDetail_Tab_NmapTableText' => 'Set up a schedule in <a href="/settings.php#NMAP_ACTIVE">Settings</a>',
|
||||
'DevDetail_Tab_NmapEmpty' => 'No ports detected with Nmap on this device.',
|
||||
@@ -214,7 +218,7 @@ $lang['en_us'] = array(
|
||||
'DevDetail_button_Reset' => 'Reset Changes',
|
||||
'DevDetail_button_Save' => 'Save',
|
||||
'DevDetail_button_OverwriteIcons' => 'Overwrite Icons',
|
||||
'DevDetail_button_OverwriteIcons_Tooltip' => 'Overwrite icons of all devices with the same type',
|
||||
'DevDetail_button_OverwriteIcons_Tooltip' => 'Overwrite icons of all devices with the same device type',
|
||||
'DevDetail_button_OverwriteIcons_Warning' => 'Are you sure you want to overwrite all icons of all devices with the same device type as the current device type?',
|
||||
'DevDetail_SessionTable_Order' => 'Order',
|
||||
'DevDetail_SessionTable_Connection' => 'Connection',
|
||||
@@ -243,17 +247,22 @@ $lang['en_us'] = array(
|
||||
'DevDetail_WOL_Title' => '<i class="fa fa-power-off"></i> Wake-on-LAN',
|
||||
'DevDetail_Run_Actions_Title' => '<i class="fa fa-play"></i> Run action on device',
|
||||
'DevDetail_Run_Actions_Tooltip' => 'Run an action on the current device from the dropdown list.',
|
||||
'DevDetail_Copy_Device_Title' => '<i class="fa fa-copy"></i> Copy details from device',
|
||||
'DevDetail_Copy_Device_Tooltip' => 'Copy details from device from the dropdown list. Everything on this page will be overwritten',
|
||||
'BackDevDetail_Copy_Title' => 'Copy details',
|
||||
'BackDevDetail_Copy_Ask' => 'Copy details from device from the dropdown list (Everything on this page will be overwritten)?',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Maintenance Page
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
'Maintenance_Title' => 'Maintenance tools',
|
||||
'Maintenance_version' => 'Application updates',
|
||||
'Maintenance_version' => 'App updates',
|
||||
'Maintenance_new_version' => '🆕 A new version is available. Check out the <a href="https://github.com/jokob-sk/Pi.Alert/releases" target="_blank">release notes</a>.',
|
||||
'Maintenance_current_version' => 'You are up-to-date. Check out what <a href="https://github.com/jokob-sk/Pi.Alert/issues/138" target="_blank">I\'m working on</a>.',
|
||||
'Maintenance_database_path' => 'Database-Path',
|
||||
'Maintenance_database_size' => 'Database-Size',
|
||||
'Maintenance_database_rows' => 'Table (Rows)',
|
||||
'Maintenance_database_lastmod' => 'Last Modification',
|
||||
'Maintenance_database_backup' => 'DB Backups',
|
||||
'Maintenance_database_backup_found' => 'backups were found',
|
||||
@@ -365,7 +374,7 @@ $lang['en_us'] = array(
|
||||
'BackDevices_DBTools_ImportCSV' => 'The devices from the CSV file were imported successfully.',
|
||||
'BackDevices_DBTools_ImportCSVError' => 'The CSV file couldn\'t be imported. Make sure the format is correct.',
|
||||
'BackDevices_DBTools_ImportCSVMissing' => 'The CSV file couldn\'t be found under <b>/config/devices.csv.</b>',
|
||||
'BackDevices_Device_UpdDevError' => 'Error updating devices, try later. The database is probable locked due to an ongoing task.',
|
||||
'BackDevices_Device_UpdDevError' => 'Error updating devices, try later. The database is probably locked due to an ongoing task.',
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
@@ -450,7 +459,7 @@ $lang['en_us'] = array(
|
||||
delete the DHCP lease if necessary. Then, also in Pi-hole, look under Tools -> Network to see if you can find the recurring hosts there.
|
||||
If yes, delete them there as well. Now you can start Pi.Alert again. Now the device(s) should not show up anymore.',
|
||||
'HelpFAQ_Cat_Detail_300_head' => 'What means ',
|
||||
'HelpFAQ_Cat_Detail_300_text_a' => 'means a network device (a device of the type AP, Gateway, Firewall, Powerline, Switch, WLAN, PLC, Router,USB LAN Adapter, USB WIFI Adapter, or Internet).',
|
||||
'HelpFAQ_Cat_Detail_300_text_a' => 'means a network device (a device of the type AP, Gateway, Firewall, Hypervisor, Powerline, Switch, WLAN, PLC, Router,USB LAN Adapter, USB WIFI Adapter, or Internet).',
|
||||
'HelpFAQ_Cat_Detail_300_text_b' => 'designates the port number where the currently edited device is connected to this network device. Read <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md">this guide</a> for more info.',
|
||||
'HelpFAQ_Cat_Detail_301_head_a' => 'When is scanning now? At ',
|
||||
'HelpFAQ_Cat_Detail_301_head_b' => ' says 1min but the graph shows 5min intervals.',
|
||||
@@ -474,6 +483,8 @@ $lang['en_us'] = array(
|
||||
'HelpFAQ_Cat_Network_600_head' => 'What is this page for?',
|
||||
'HelpFAQ_Cat_Network_600_text' => 'This page should offer you the possibility to map the assignment of your network devices. For this purpose, you can create one or more switches, WLANs, routers, etc., provide them with a port number if necessary and assign already detected
|
||||
devices to them. This assignment is done in the detailed view of the device to be assigned. So it is possible for you to quickly determine to which port a host is connected and if it is online. Read <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md">this guide</a> for more info.',
|
||||
'HelpFAQ_Cat_Network_601_head' => 'Are there other docs?',
|
||||
'HelpFAQ_Cat_Network_601_text' => 'Yes, there are! Check <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/">all docs</a> for more info.',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Front end events
|
||||
@@ -484,7 +495,7 @@ $lang['en_us'] = array(
|
||||
'run_event_tooltip' => 'Enable the setting and save your changes at first before you run it.',
|
||||
'run_event_icon' => 'fa-play',
|
||||
'general_event_title' => 'Executing an ad-hoc event',
|
||||
'general_event_description' => 'The event you\'ve triggered might take a while until background processes finish. The execution ended once you see <code>finished</code> below. Check the <a onclick=\'setCache(\"activeMaintenanceTab\", \"tab_Logging_id\")\' href=\"/maintenance.php#tab_Logging\">error log</a> if you didn\'t get the expected result. <br/> <br/> Status: ',
|
||||
'general_event_description' => ' The event you\'ve triggered might take a while until background processes finish. The execution ended once you see <code>finished</code> below. Check the <a href=\"/maintenance.php#tab_Logging\">error log</a> if you didn\'t get the expected result. <br/> <br/> Status: ',
|
||||
|
||||
|
||||
|
||||
@@ -494,7 +505,9 @@ $lang['en_us'] = array(
|
||||
|
||||
'Plugins_Unprocessed_Events' => 'Unprocessed Events',
|
||||
'Plugins_Objects' => 'Plugin Objects',
|
||||
'Plugins_DeleteAll' => 'Delete all (filters are ignored)',
|
||||
'Plugins_History' => 'Events History',
|
||||
'Plugins_Filters_Mac' => 'Mac Filter',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Settings
|
||||
@@ -515,7 +528,7 @@ $lang['en_us'] = array(
|
||||
'ENABLE_ARPSCAN_description' => 'Arp-scan is a command-line tool that uses the ARP protocol to discover and fingerprint IP hosts on the local network. An alternative to ARP scan is to enable the <a onclick="toggleAllSettings()" href="#PIHOLE_ACTIVE"><code>PIHOLE_ACTIVE</code>PiHole integration settings</a>.',
|
||||
'SCAN_SUBNETS_name' => 'Subnets to scan',
|
||||
'SCAN_SUBNETS_description' => '
|
||||
The arp-scan time itself depends on the number of IP addresses to check so set this up carefully with the appropriate network mask and interface. Check the <a href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SUBNETS.md" target="_blank">subnets documentation</a> for details.
|
||||
The arp-scan time itself depends on the number of IP addresses to check so set this up carefully with the appropriate network mask and interface. Check the <a href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SUBNETS.md" target="_blank">subnets documentation</a> for help on setting up VLANs, what VLANs are supported, or how to figure out the network mask and your interface.
|
||||
',
|
||||
'LOG_LEVEL_name' => 'Print additional logging',
|
||||
'LOG_LEVEL_description' => 'This setting will enable more verbose logging. Useful for debugging events writing into the database.',
|
||||
@@ -523,28 +536,35 @@ The arp-scan time itself depends on the number of IP addresses to check so set t
|
||||
'TIMEZONE_description' => 'Time zone to display stats correctly. Find your time zone <a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">here</a>.',
|
||||
'ENABLE_PLUGINS_name' => 'Enable Plugins',
|
||||
'ENABLE_PLUGINS_description' => 'Enables the <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins">plugins</a> functionality. Loading plugins requires more hardware resources so you might want to disable them on low-powered system.',
|
||||
'PLUGINS_KEEP_HIST_name' => 'Plugins History',
|
||||
'PLUGINS_KEEP_HIST_description' => 'How many entries of Plugins History scan results should be kept (globally, not device specific!).',
|
||||
'PIALERT_WEB_PROTECTION_name' => 'Enable login',
|
||||
'PIALERT_WEB_PROTECTION_description' => 'When enabled a login dialog is displayed. Read below carefully if you get locked out of your instance.',
|
||||
'PIALERT_WEB_PASSWORD_name' => 'Login password',
|
||||
'PIALERT_WEB_PASSWORD_description' => 'The default password is <code>123456</code>. To change the password run <code>/home/pi/pialert/back/pialert-cli</code> in the container',
|
||||
'INCLUDED_SECTIONS_name' => 'Notify on',
|
||||
'INCLUDED_SECTIONS_description' => 'Specifies which events trigger notifications. Remove the event type(s) you don\'t want to get notified on. This setting overrides device-specific settings in the UI. (<code>CTRL + Click</code> to select / deselect).',
|
||||
'INCLUDED_SECTIONS_description' => 'Specifies which events trigger notifications. Remove the event type(s) you don\'t want to get notified on. This setting overrides device-specific settings in the UI. (<code>CTRL + Click</code> to select/deselect).',
|
||||
'SCAN_CYCLE_MINUTES_name' => 'Scan cycle delay',
|
||||
'SCAN_CYCLE_MINUTES_description' => 'The delay between scans in minutes. If using arp-scan, the scan time itself depends on the number of IP addresses to check. This is influenced by the network mask set in the <a href="#SCAN_SUBNETS"><code>SCAN_SUBNETS</code> setting</a> at the top. Every IP takes a couple seconds to scan.',
|
||||
'DAYS_TO_KEEP_EVENTS_name' => 'Delete events older than',
|
||||
'DAYS_TO_KEEP_EVENTS_description' => 'This is a maintenance setting. This specifies the number of days worth of event entries that will be kept. All older events will be deleted periodically. Also applies on Plugin Events History.',
|
||||
'HRS_TO_KEEP_NEWDEV_name' => 'Keep new devices for',
|
||||
'HRS_TO_KEEP_NEWDEV_description' => 'This is a maintenance setting. If enabled (<code>0</code> is disabled), devices marked as <b>New Device</b> will be deleted if their <b>First Session</b> time was older than the specified hours in this setting. Use this setting if you want to auto-delete <b>New Devices</b> after <code>X</code> hours.',
|
||||
'REPORT_DASHBOARD_URL_name' => 'Pi.Alert URL',
|
||||
'REPORT_DASHBOARD_URL_description' => 'This URL is used as the base for generating links in the emails. Enter full URL starting with <code>http://</code> including the port number (no trailig slash <code>/</code>).',
|
||||
'DIG_GET_IP_ARG_name' => 'Internet IP discovery',
|
||||
'DIG_GET_IP_ARG_description' => 'Change the <a href="https://linux.die.net/man/1/dig" target="_blank">dig utility</a> arguments if you have issues resolving your Internet IP. Arguments are added at the end of the following command: <code>dig +short </code>.',
|
||||
'UI_LANG_name' => 'UI Language',
|
||||
'UI_LANG_description' => 'Select the preferred UI language.',
|
||||
'UI_PRESENCE_name' => 'Show in presence chart',
|
||||
'UI_PRESENCE_description' => 'Select what statuses should be shown in the <b>Device presence over time</b> chart in the <a href="/devices.php" target="_blank">Devices</a> page. (<code>CTRL + Click</code> to select/deselect)',
|
||||
|
||||
|
||||
//Email
|
||||
'Email_display_name' => 'Email',
|
||||
'Email_icon' => '<i class="fa fa-at"></i>',
|
||||
'REPORT_MAIL_name' => 'Enable email',
|
||||
'REPORT_MAIL_description' => 'If enabled an email is sent out with a list of changes you\'ve subscribed to. Please also fill out all remaining settings related to the SMTP setup below.',
|
||||
'REPORT_MAIL_description' => 'If enabled an email is sent out with a list of changes you\'ve subscribed to. Please also fill out all remaining settings related to the SMTP setup below. If facing issues, set <code>LOG_LEVEL</code> to <code>debug</code> and check the <a href=\"/maintenance.php#tab_Logging\">error log</a>.',
|
||||
'SMTP_SERVER_name' => 'SMTP server URL',
|
||||
'SMTP_SERVER_description' => 'The SMTP server host URL. For example <code>smtp-relay.sendinblue.com</code>. To use Gmail as an SMTP server <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SMTP_GMAIL.md">follow this guide</a>',
|
||||
'SMTP_PORT_name' => 'SMTP server PORT',
|
||||
@@ -562,7 +582,7 @@ The arp-scan time itself depends on the number of IP addresses to check so set t
|
||||
'REPORT_TO_name' => 'Send email to',
|
||||
'REPORT_TO_description' => 'Email address to which the notification will be send to.',
|
||||
'REPORT_FROM_name' => 'Email subject',
|
||||
'REPORT_FROM_description' => 'Notification email subject line.',
|
||||
'REPORT_FROM_description' => 'Notification email subject line. Some SMTP servers need this to be an email.',
|
||||
|
||||
//Webhooks
|
||||
'Webhooks_display_name' => 'Webhooks',
|
||||
@@ -572,9 +592,11 @@ The arp-scan time itself depends on the number of IP addresses to check so set t
|
||||
'WEBHOOK_URL_name' => 'Target URL',
|
||||
'WEBHOOK_URL_description' => 'Target URL starting with <code>http://</code> or <code>https://</code>.',
|
||||
'WEBHOOK_PAYLOAD_name' => 'Payload type',
|
||||
'WEBHOOK_PAYLOAD_description' => 'The Webhook payload data format for the <code>body</code> > <code>attachments</code> > <code>text</code> attribute in the payload json. See an example of the payload <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/back/webhook_json_sample.json">here</a>. (e.g.: for discord use <code>html</code>)',
|
||||
'WEBHOOK_PAYLOAD_description' => 'The Webhook payload data format for the <code>body</code> > <code>attachments</code> > <code>text</code> attribute in the payload json. See an example of the payload <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/back/webhook_json_sample.json">here</a>. (e.g.: for discord use <code>text</code>)',
|
||||
'WEBHOOK_REQUEST_METHOD_name' => 'Request method',
|
||||
'WEBHOOK_REQUEST_METHOD_description' => 'The HTTP request method to be used for the webhook call.',
|
||||
'WEBHOOK_SIZE_name' => 'Max payload size',
|
||||
'WEBHOOK_SIZE_description' => 'The maximum size of the webhook payload as number of characters in the passed string. If above limit, it will be truncated and a <code>(text was truncated)</code> message is appended.',
|
||||
|
||||
// Apprise
|
||||
'Apprise_display_name' => 'Apprise',
|
||||
@@ -670,6 +692,7 @@ The arp-scan time itself depends on the number of IP addresses to check so set t
|
||||
'PHOLUS_DAYS_DATA_name' => 'Data retention',
|
||||
'PHOLUS_DAYS_DATA_description' => 'How many days of Pholus scan entries should be kept (globally, not device specific!) Enter <code>0</code> to disable.',
|
||||
|
||||
|
||||
// Nmap
|
||||
'Nmap_display_name' => 'Nmap',
|
||||
'Nmap_icon' => '<i class="fa fa-ethernet"></i>',
|
||||
|
||||
@@ -5,6 +5,7 @@ $lang['es_es'] = array(
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// About - Update by @TeroRERO 07ago2022
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
'About_Title' => 'Guadián de Red <br>(Código Abierto)',
|
||||
'About_Design' => 'Diseñado para:',
|
||||
'About_Exit' => 'Salir',
|
||||
@@ -12,20 +13,31 @@ $lang['es_es'] = array(
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// General - Update by @TeroRERO 01ago2022
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
'Gen_Delete' => 'Eliminar',
|
||||
'Gen_DeleteAll' => 'Eliminar todo',
|
||||
'Gen_Cancel' => 'Cancelar',
|
||||
'Gen_Okay' => 'Ok',
|
||||
'Gen_Okay' => 'Aceptar',
|
||||
'Gen_Save' => 'Guardar',
|
||||
'Gen_Saved' => 'Guardado',
|
||||
'Gen_Run' => 'Ejecutar',
|
||||
'Gen_Action' => 'Acción',
|
||||
'Gen_Purge' => 'Purgar',
|
||||
'Gen_Backup' => 'Ejecutar copia de seguridad',
|
||||
'Gen_Restore' => 'Ejecutar restauración',
|
||||
'Gen_Switch' => 'Cambiar',
|
||||
'Gen_AreYouSure' => '¿Estás seguro de',
|
||||
'Gen_Upd' => 'Actualizado correctamente',
|
||||
'Gen_Upd_Fail' => 'Fallo al actualizar',
|
||||
'Gen_ReadDocs' => 'Ayuda',
|
||||
'Gen_DataUpdatedUITakesTime' => 'Correcto - La interfaz puede tardar en actualizarse si se está ejecutando un escaneo.',
|
||||
'Gen_LockedDB' => 'Fallo - La base de datos puede estar bloqueada - Pulsa F1 -> Ajustes de desarrolladores -> Consola o prueba más tarde.',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Login Page - Update by @TeroRERO 03ago2022
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// TeroRERO Off 'Login_Box' => 'Inicie su sesión',
|
||||
|
||||
'Login_Box' => 'Ingrese su contraseña',
|
||||
'Login_Remember' => 'Recordar',
|
||||
'Login_Remember_small' => '(válido por 7 días)',
|
||||
@@ -38,6 +50,7 @@ $lang['es_es'] = array(
|
||||
'Login_Toggle_Info' => 'Información sobre la contraseña',
|
||||
'Login_Toggle_Info_headline' => 'Información sobre la contraseña',
|
||||
'Login_Toggle_Alert_headline' => 'Alerta de Contraseña!',
|
||||
'Login_Default_PWD' => 'La contraseña por defecto "123456" sigue activa.',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Device Page - Update by @TeroRERO 03ago2022
|
||||
@@ -46,10 +59,11 @@ $lang['es_es'] = array(
|
||||
'Navigation_Devices' => 'Dispositivos',
|
||||
'Navigation_Presence' => 'Historial',
|
||||
'Navigation_Events' => 'Eventos',
|
||||
'Navigation_Network' => 'Red',
|
||||
'Navigation_Plugins' => 'Plugins',
|
||||
'Navigation_Maintenance' => 'Mantenimiento',
|
||||
'Navigation_Settings' => 'Configuración',
|
||||
'Navigation_Network' => 'Red',
|
||||
'Navigation_HelpFAQ' => 'Ayuda / FAQ',
|
||||
'Navigation_HelpFAQ' => 'Ayuda / Preguntas frecuentes',
|
||||
'Device_Title' => 'Dispositivos',
|
||||
'Device_Shortcut_AllDevices' => 'Todos',
|
||||
'Device_Shortcut_Connected' => 'Conectado(s)',
|
||||
@@ -62,14 +76,21 @@ $lang['es_es'] = array(
|
||||
'Device_TableHead_Name' => 'Nombre',
|
||||
'Device_TableHead_Owner' => 'Propietario',
|
||||
'Device_TableHead_Type' => 'Tipo',
|
||||
'Device_TableHead_Icon' => 'Icon',
|
||||
'Device_TableHead_RowID' => 'Row ID',
|
||||
'Device_TableHead_Rowid' => 'Row ID',
|
||||
'Device_TableHead_Parent_MAC' => 'Nodo principal de la MAC',
|
||||
'Device_TableHead_Connected_Devices' => 'Dispositivos conectados',
|
||||
'Device_TableHead_Location' => 'Ubicación',
|
||||
'Device_TableHead_Vendor' => 'Fabricante',
|
||||
'Device_TableHead_Favorite' => 'Favorito',
|
||||
'Device_TableHead_Group' => 'Grupo',
|
||||
'Device_TableHead_FirstSession' => '1ra. sesión',
|
||||
'Device_TableHead_LastSession' => 'Última sesión',
|
||||
'Device_TableHead_LastIP' => 'Última IP',
|
||||
'Device_TableHead_MAC' => 'MAC',
|
||||
'Device_TableHead_MAC_full' => 'MAC completa',
|
||||
'Device_TableHead_LastIPOrder' => 'Última orden de IP',
|
||||
'Device_TableHead_Rowid' => 'Rowid',
|
||||
'Device_TableHead_Status' => 'Estado',
|
||||
'Device_Searchbox' => 'Búsqueda',
|
||||
'Device_Tablelenght' => 'Mostrar _MENU_ entradas',
|
||||
@@ -153,17 +174,26 @@ $lang['es_es'] = array(
|
||||
'DevDetail_Tab_Sessions' => 'Sesiones',
|
||||
'DevDetail_Tab_Presence' => 'Historial',
|
||||
'DevDetail_Tab_Events' => 'Eventos',
|
||||
'DevDetail_Tab_Pholus' => '<i class="fa fa-search"></i> Pholus',
|
||||
'DevDetail_Tab_PholusEmpty' => 'No se ha encontrado nada para este dispositivo con Pholus.',
|
||||
'DevDetail_Tab_NmapTableHeader' => 'Resultados del escaneo programado',
|
||||
'DevDetail_Tab_NmapTableText' => 'Establece la programación en los <a href="/settings.php#NMAP_ACTIVE">Ajustes</a>',
|
||||
'DevDetail_Tab_NmapEmpty' => 'Ningún puerto detectado en este dispositivo con Nmap.',
|
||||
'DevDetail_MainInfo_Title' => 'Información principal',
|
||||
'DevDetail_MainInfo_mac' => 'MAC',
|
||||
'DevDetail_MainInfo_Name' => 'Nombre',
|
||||
'DevDetail_MainInfo_Owner' => 'Propietario',
|
||||
'DevDetail_MainInfo_Type' => 'Tipo',
|
||||
'DevDetail_Icon' => 'Icono',
|
||||
'DevDetail_Icon_Descr' => 'Enter a font awesome icon name without the fa- prefix or with complete class, e.g.: fa fa-brands fa-apple.',
|
||||
'DevDetail_MainInfo_Vendor' => 'Proveedor',
|
||||
'DevDetail_MainInfo_Favorite' => 'Favorito',
|
||||
'DevDetail_MainInfo_Group' => 'Grupo',
|
||||
'DevDetail_MainInfo_Location' => 'Ubicación',
|
||||
'DevDetail_MainInfo_Comments' => 'Comentario',
|
||||
'DevDetail_MainInfo_Network' => 'Hardware de Red (ID)',
|
||||
'DevDetail_MainInfo_Network' => '<i class="fa fa-server"></i> Nodo (MAC)',
|
||||
'DevDetail_GoToNetworkNode' => 'Navegar a la página de Internet del nodo seleccionado.',
|
||||
'DevDetail_MainInfo_Network_Port' => 'Puerto de Red HW',
|
||||
'DevDetail_SessionInfo_Title' => 'Información de sesión',
|
||||
'DevDetail_SessionInfo_Status' => 'Estado',
|
||||
@@ -183,7 +213,12 @@ $lang['es_es'] = array(
|
||||
'DevDetail_EveandAl_ScanCycle_z' => 'No Escanear Dispositivo',
|
||||
'DevDetail_button_Delete' => 'Eliminar dispositivo',
|
||||
'DevDetail_button_Reset' => 'Restablecer cambios',
|
||||
'DevDetail_button_DeleteEvents_Warning' => '¿Desea eliminar todos los eventos de este dispositivo?<br><br>(se eliminarán el <b>Historial de eventos</b> y las <b>Sesiones</b>, y puede ayudar en el caso de notificaciones constantes)',
|
||||
'DevDetail_button_Reset' => 'Restablecer cambios',
|
||||
'DevDetail_button_Save' => 'Guardar',
|
||||
'DevDetail_button_OverwriteIcons' => 'Sobreescribir iconos',
|
||||
'DevDetail_button_OverwriteIcons_Tooltip' => 'Sobreescribir los iconos de todos los dispositivos con el mismo tipo',
|
||||
'DevDetail_button_OverwriteIcons_Warning' => '¿Sobreescribir todos los iconos de todos los dispositivos con el mismo tipo que el dispositivo actual?',
|
||||
'DevDetail_SessionTable_Order' => 'Ordenar',
|
||||
'DevDetail_SessionTable_Connection' => 'Conexión',
|
||||
'DevDetail_SessionTable_Disconnection' => 'Desconexión',
|
||||
@@ -199,12 +234,27 @@ $lang['es_es'] = array(
|
||||
'DevDetail_Nmap_buttonDetail_text' => 'Escaneo detallado: escaneo predeterminado con detección de sistema operativo habilitado, detección de versiones, escaneo de script y traceroute (hasta 30 segundos o más)',
|
||||
'DevDetail_Nmap_buttonSkipDiscovery' => 'Omitir detección de host',
|
||||
'DevDetail_Nmap_buttonSkipDiscovery_text' => 'Omitir detección de host (-Pn opción): Escaneo predeterminado sin detección de host',
|
||||
'DevDetail_Nmap_resultsLink' => 'Puedes abandonar esta página después de empezar un escaneo. Los resultados también estarán disponibles en el archivo <code>pialert_front.log</code>.',
|
||||
'BackDevDetail_Actions_Title_Run' => 'Ejecutar acción',
|
||||
'BackDevDetail_Actions_Not_Registered' => 'Acción no registrada: ',
|
||||
'BackDevDetail_Actions_Ask_Run' => '¿Desea ejecutar la acción?',
|
||||
'BackDevDetail_Tools_WOL_okay' => 'El comando se ha ejecutado correctamente.',
|
||||
'BackDevDetail_Tools_WOL_error' => 'Ha ocurrido un error al ejectuar el comando.',
|
||||
'DevDetail_Tools_WOL_noti' => 'Wake-on-LAN',
|
||||
'DevDetail_Tools_WOL_noti_text' => 'El comando de Wake-on-LAN en enviado a la dirección de escucha. Si el dispositivo no está en la misma subred/vlan que Pi.Alert, el dispositivo no responderá.',
|
||||
'DevDetail_Tools_WOL' => 'Enviar comando WOL a ',
|
||||
'DevDetail_WOL_Title' => '<i class="fa fa-power-off"></i> Wake-on-LAN',
|
||||
'DevDetail_Run_Actions_Title' => '<i class="fa fa-play"></i> Ejecutar acción en el dispositivo',
|
||||
'DevDetail_Run_Actions_Tooltip' => 'Ejecutar la acción del desplegable sobre el dispositivo actual.',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Maintenance Page - Update by @TeroRERO 07ago2022
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
'Maintenance_Title' => 'Herramientas de mantenimiento',
|
||||
'Maintenance_version' => 'Actualizaciones de la aplicación',
|
||||
'Maintenance_new_version' => '🆕 Una nueva versión está disponible. Comprueba las <a href="https://github.com/jokob-sk/Pi.Alert/releases" target="_blank">notas de lanzamiento</a>.',
|
||||
'Maintenance_current_version' => 'No hay actualizaciones disponibles. Comprueba en que <a href="https://github.com/jokob-sk/Pi.Alert/issues/138" target="_blank">se está trabajando</a>.',
|
||||
'Maintenance_database_path' => 'Ruta de la base de datos:',
|
||||
'Maintenance_database_size' => 'Tamaño de base de datos:',
|
||||
'Maintenance_database_lastmod' => 'Última modificación:',
|
||||
@@ -214,10 +264,10 @@ $lang['es_es'] = array(
|
||||
'Maintenance_arp_status' => 'Estado de escaneo:',
|
||||
'Maintenance_arp_status_off' => 'está actualmente deshabilitado',
|
||||
'Maintenance_arp_status_on' => 'escaneo(s) actualmente en ejecución',
|
||||
'Maintenance_themeselector_lable' => 'Seleccionar Skin',
|
||||
'Maintenance_themeselector_empty' => 'Elija un Skin',
|
||||
'Maintenance_themeselector_text' => 'El cambio tiene lugar en el lado del servidor, por lo que afecta todos los dispositivos en uso.',
|
||||
'Maintenance_themeselector_lable' => 'Seleccionar tema',
|
||||
'Maintenance_themeselector_empty' => 'Elige un tema',
|
||||
'Maintenance_themeselector_apply' => 'Aplicar',
|
||||
'Maintenance_themeselector_text' => 'El cambio tiene lugar en el lado del servidor, por lo que afecta todos los dispositivos en uso.',
|
||||
'Maintenance_lang_selector_lable' => 'Seleccione su idioma',
|
||||
'Maintenance_lang_selector_empty' => 'Elija un idioma',
|
||||
'Maintenance_lang_en_us' => 'English (US)',
|
||||
@@ -226,10 +276,15 @@ $lang['es_es'] = array(
|
||||
'Maintenance_lang_selector_text' => 'El cambio tiene lugar en el lado del servidor, por lo que afecta todos los dispositivos en uso.',
|
||||
'Maintenance_lang_selector_apply' => 'Aplicar',
|
||||
'Maintenance_Tools_Tab_Settings' => 'Ajustes',
|
||||
'Maintenance_Tools_Tab_Tools' => 'Tools',
|
||||
'Maintenance_Tools_Tab_UISettings' => 'Ajustes de interfaz',
|
||||
'Maintenance_Tools_Tab_Tools' => 'Herramientas',
|
||||
'Maintenance_Tools_Tab_BackupRestore' => 'Respaldo / Restaurar',
|
||||
'Maintenance_Tools_Tab_Logging' => 'Logs',
|
||||
'Maintenance_Tools_Tab_Logging' => 'Registros',
|
||||
'Maintenance_Tool_displayed_columns_text' => 'Cambia la visibilidad y el orden de las columnas en la página <a href="devices.php"><b> <i class="fa fa-laptop"></i> Dispositivos</b></a> . (La función de coger y arrastrar funciona un poco mal, pero funciona. (Se intentó arreglar <a href="https://github.com/jokob-sk/Pi.Alert/commit/94b32f0f7332879f5a7d2af05dafa2e5d5cfa5da">como por 3 horas</a> - se agradecerían PRs para arreglarlo)).',
|
||||
'Maintenance_Tool_order_columns_text' => '',
|
||||
'Maintenance_Tool_darkmode' => 'Cambiar Modo (Dark/Light)',
|
||||
'Maintenance_Tool_drag_me' => 'Coger para rearrastrar columnas.',
|
||||
'Maintenance_Tool_check_visible' => 'Desactivar para ocultar columna.',
|
||||
'Maintenance_Tool_darkmode_text' => 'Alternar entre el modo oscuro y el modo de luz. Si el interruptor no funciona correctamente, intente borrar el caché del navegador. El cambio tiene lugar en el lado del servidor, por lo que afecta todos los dispositivos en uso.',
|
||||
'Maintenance_Tool_darkmode_noti' => 'Cambiar Modo',
|
||||
'Maintenance_Tool_darkmode_noti_text' => 'Después del cambio de tema, la página intenta volver a cargar para activar el cambio. Si es necesario, el caché debe ser eliminado.',
|
||||
@@ -284,8 +339,6 @@ $lang['es_es'] = array(
|
||||
'Maintenance_Tool_ImportCSV_text' => 'Antes de usar esta función, haga una copia de seguridad. Importe un archivo CSV (valor separado por comas) que contiene la lista de dispositivos, incluidas las relaciones de red entre nodos de red y dispositivos conectados. Para hacer eso, coloque el archivo CSV llamado <b> devices.csv </b> en su carpeta <b>/config </b>.',
|
||||
'Maintenance_Tool_ImportCSV_noti' => 'Importación CSV',
|
||||
'Maintenance_Tool_ImportCSV_noti_text' => '¿Está seguro de que quiere importar el archivo CSV? Esto sobrescribirá completamente los dispositivos de su base de datos.',
|
||||
'Maintenance_Github_package_a' => 'La última versión de Pi.Alert (Fork leiweibau) se publicó en ',
|
||||
'Maintenance_Github_package_b' => '',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Maintenance Page - Update by @TeroRERO 25jul2022
|
||||
@@ -312,6 +365,10 @@ $lang['es_es'] = array(
|
||||
'BackDevices_DBTools_Upgrade' => 'Base de datos actualizada correctamente',
|
||||
'BackDevices_DBTools_UpgradeError' => 'Falló la actualización de la base de datos',
|
||||
'BackDevices_DBTools_Purge' => 'Las copias de seguridad más antiguas fueron eliminadas',
|
||||
'BackDevices_DBTools_ImportCSV' => 'Los dispositivos del archivo CSV han sido importados correctamente.',
|
||||
'BackDevices_DBTools_ImportCSVError' => 'El archivo CSV no pudo ser importado. Asegúrate de que el formato es correcto.',
|
||||
'BackDevices_DBTools_ImportCSVMissing' => 'El archivo CSV no se pudo encontrar en <b>/config/devices.csv.</b>',
|
||||
'BackDevices_Device_UpdDevError' => 'Fallo al actualizar dispositivos, pruebe de nuevo más tarde. La base de datos probablemente esté bloqueada por una tarea en curso.',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Network Page - Update by @TeroRERO 01ago2022
|
||||
@@ -320,6 +377,8 @@ $lang['es_es'] = array(
|
||||
'Network_Title' => 'Descripción general de la red',
|
||||
'Network_ManageDevices' => 'Administrar dispositivos',
|
||||
'Network_ManageAdd' => 'Añadir dispositivo',
|
||||
'Network_ManageAssign' => 'Asignar',
|
||||
'Network_ManageUnassign' => 'Desasignar',
|
||||
'Network_ManageEdit' => 'Actualizar dispositivo',
|
||||
'Network_ManageDel' => 'Eliminar dispositivo',
|
||||
'Network_ManageAdd_Name' => 'Nombre del dispositivo',
|
||||
@@ -344,6 +403,14 @@ $lang['es_es'] = array(
|
||||
'Network_Table_State' => 'Estado',
|
||||
'Network_Table_Hostname' => 'Nombre de host',
|
||||
'Network_Table_IP' => 'Dirección IP',
|
||||
'Network_UnassignedDevices' => 'Dispositivos sin asignar',
|
||||
'Network_Assign' => 'Conectar al nodo de <i class="fa fa-server"></i> red',
|
||||
'Network_Connected' => 'Dispositivos conectados',
|
||||
'Network_ManageLeaf' => 'Gestionar asignación',
|
||||
'Network_Node' => 'Nodo de red',
|
||||
'Network_Node_Name' => 'Nombre de nodo',
|
||||
'Network_Parent' => 'Dispositivo primario de la red',
|
||||
'Network_NoAssignedDevices' => 'Este nodo de red no tiene asignado ningún dispositivo (nodo externo). Asigna uno de la lista o ve a la pestaña <b><i class="fa fa-info-circle"></i> Detalles</b> de cualquier dispositivo en la página<a href="devices.php"><b> <i class="fa fa-laptop"></i> Dispositivos</b></a>, y asígnalo a un <b><i class="fa fa-server"></i> Nodo (MAC)</b> <b><i class="fa fa-ethernet"></i> Puerto</b> de la red ahí.',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Help Page - Update by @TeroRERO 07ago2022
|
||||
@@ -369,13 +436,13 @@ $lang['es_es'] = array(
|
||||
chmod -R 770 ~/pialert/db
|
||||
</span><br>
|
||||
Si la base de datos sigue siendo de sólo lectura, intente reinstalar o restaurar una copia de seguridad de la base de datos desde la página de mantenimiento.',
|
||||
'HelpFAQ_Cat_General_102docker_head' => '(🐳 Docker only) Database issues (AJAX errors, read-only, not found)',
|
||||
'HelpFAQ_Cat_General_102docker_text' => 'Double-check you\'ve followed the <a href="https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles">dockerfile readme (most up-to-date info)</a>. <br/> <br/> <ul data-sourcepos="49:4-52:146" dir="auto">
|
||||
<li data-sourcepos="49:4-49:106">Download the <a href="https://github.com/jokob-sk/Pi.Alert/blob/main/db/pialert.db">original DB from GitHub</a>.</li>
|
||||
<li data-sourcepos="50:4-50:195">Map the <code>pialert.db</code> file (<g-emoji class="g-emoji" alias="warning" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/26a0.png">⚠</g-emoji> not folder) from above to <code>/home/pi/pialert/db/pialert.db</code> (see <a href="https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#-examples">Examples</a> for details).</li>
|
||||
<li data-sourcepos="51:4-51:161">If facing issues (AJAX errors, can\'t write to DB, etc,) make sure permissions are set correctly, alternatively check the logs under <code>/home/pi/pialert/front/log</code>.</li>
|
||||
<li data-sourcepos="52:4-52:146">To solve permission issues you can also try to create a DB backup and then run a DB Restore via the <strong>Maintenance > Backup/Restore</strong> section.</li>
|
||||
<li data-sourcepos="53:4-53:228">If the database is in read-only mode you can solve this by setting the owner and group by executing the following command on the host system: <code>docker exec pialert chown -R www-data:www-data /home/pi/pialert/db/pialert.db</code>.</li>
|
||||
'HelpFAQ_Cat_General_102docker_head' => '(🐳 Solo Docker) Problemas con la base de datos (errores de AJAX, solo lectura, no encontrado)',
|
||||
'HelpFAQ_Cat_General_102docker_text' => 'Comprueba que has seguido las instrucciones del <a href="https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles">dockerfile (la información más actualizada)</a>. <br/> <br/> <ul data-sourcepos="49:4-52:146" dir="auto">
|
||||
<li data-sourcepos="49:4-49:106">Descarga la <a href="https://github.com/jokob-sk/Pi.Alert/blob/main/db/pialert.db">base de datos original desde GitHub</a>.</li>
|
||||
<li data-sourcepos="50:4-50:195">Mapea el archivo <code>pialert.db</code> (<g-emoji class="g-emoji" alias="warning" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/26a0.png">⚠</g-emoji> no carpeta) de arriba a <code>/home/pi/pialert/db/pialert.db</code> (puedes comprobar los <a href="https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#-examples">ejemplos</a> para más detalles).</li>
|
||||
<li data-sourcepos="51:4-51:161">Si aparecen problemas (errores de AJAX, no se puede escribir a la base de datos, etc,) asegúrate que los permisos están establecidos correctamente. También puedes comprobar los registros en <code>/home/pi/pialert/front/log</code>.</li>
|
||||
<li data-sourcepos="52:4-52:146">Para arreglar los problemas de los permisos, puedes probar a crear una copia de seguridad de la base de datos y después restaurarla desde la sección <strong>Mantenimiento > Copia de seguridad/Restaurar</strong>.</li>
|
||||
<li data-sourcepos="53:4-53:228">Si la base de datos está en modo solo lectura, lo puedes arreglar ejecutando el siguiente comando para establecer el propietario y grupo en el sistema host: <code>docker exec pialert chown -R www-data:www-data /home/pi/pialert/db/pialert.db</code>.</li>
|
||||
</ul>',
|
||||
'HelpFAQ_Cat_General_103_head' => 'La página de inicio de sesión no aparece, incluso después de cambiar la contraseña.',
|
||||
'HelpFAQ_Cat_General_103_text' => 'Además de la contraseña, el archivo de configuración debe contener <span class="text-danger help_faq_code">~/pialert/config/pialert.conf</span>
|
||||
@@ -412,196 +479,215 @@ $lang['es_es'] = array(
|
||||
puertos (agrupación de puertos), así como múltiples dispositivos a un puerto (máquinas virtuales).',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Settings (based on work of https://github.com/mariorodriguezlopez/Pi.Alert/)
|
||||
// Front end events
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
'API_settings_group' => '<i class="fa fa-arrow-down-up-across-line"></i> API',
|
||||
'test_event_tooltip' => 'Guarda tus cambios antes de probar nuevos ajustes.',
|
||||
'test_event_icon' => 'fa-vial-circle-check',
|
||||
'run_event_tooltip' => 'Activa el ajuste y guarda tus cambios antes de ejecutarlo.',
|
||||
'run_event_icon' => 'fa-play',
|
||||
'general_event_title' => 'Ejecutar un evento ad-hoc',
|
||||
'general_event_description' => 'El evento que has ejecutado puede tardar un rato mientras finalizan procesos en segundo plano. La ejecución ha terminado cuando ves <code>finalizado</code> abajo. Comprueba el <a onclick=\'setCache(\"activeMaintenanceTab\", \"tab_Logging_id\")\' href=\"/maintenance.php#tab_Logging\">registro de error</a> si no has obtenido el resultado esperado. <br/> <br/> Estado: ',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Plugins
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
'Plugins_Unprocessed_Events' => 'Eventos sin procesar',
|
||||
'Plugins_Objects' => 'Objetos del Plugin',
|
||||
'Plugins_History' => 'Historial de eventos',
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Settings
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
'settings_missing' => 'Actualiza la página, no todos los ajustes se han cargado. Probablemente sea por una sobrecarga de la base de datos.',
|
||||
'settings_missing_block' => 'No puedes guardar los ajustes sin establecer todas las claves. Actualiza la página. Problabmente esté causado por una sobrecarga de la base de datos.',
|
||||
'settings_old' => 'Los ajustes mostrados en esta página están desactualizados. Probablemente sea por un escaneo en proceso. Los ajustes se guardan en el archivo <code>pialert.conf</code>, pero el proceso en segundo plano no las ha importado todavía a la base de datos. Puedes esperar a que los ajustes se actualicen para evitar sobreescribirlos con los ajustes antiguos. Si te da igual perder los ajustes desde la última vez que guardaste y ahora, siéntete libre de guardarlos de nuevo. También hay copias de seguridad creadas si necesitas comparar tus ajustes más tarde.',
|
||||
'settings_imported' => 'Última vez que los ajustes fueron importados desde el archivo pialert.conf:',
|
||||
'settings_expand_all' => 'Expandir todo',
|
||||
|
||||
// General
|
||||
|
||||
'DAYS_TO_KEEP_EVENTS_description' => 'Esta es una configuración de mantenimiento. Esto especifica el número de días de entradas de eventos que se guardarán. Todos los eventos anteriores se eliminarán periódicamente.',
|
||||
'DAYS_TO_KEEP_EVENTS_name' => 'Eliminar eventos anteriores a',
|
||||
'PIALERT_WEB_PASSWORD_description' => 'La contraseña predeterminada es <code>123456</code>. Para cambiar la contraseña, ejecute <code>/home/pi/pialert/back/pialert-cli</code> en el contenedor',
|
||||
'PIALERT_WEB_PASSWORD_name' => 'Contraseña de inicio de sesión',
|
||||
'PIALERT_WEB_PROTECTION_description' => 'Cuando está habilitado, se muestra un cuadro de diálogo de inicio de sesión. Lea detenidamente a continuación si se le bloquea el acceso a su instancia.',
|
||||
'PIALERT_WEB_PROTECTION_name' => 'Habilitar inicio de sesión',
|
||||
'REPORT_DASHBOARD_URL_description' => 'Esta URL se utiliza como base para generar enlaces en los correos electrónicos. Ingrese la URL completa que comienza con <code>http://</code>, incluido el número de puerto (sin barra inclinada al final <code>/</code>).',
|
||||
'REPORT_DASHBOARD_URL_name' => 'Pi.Alert URL',
|
||||
'REPORT_FROM_description' => 'Asunto del correo electrónico de notificación.',
|
||||
'REPORT_FROM_name' => 'Asunto del email',
|
||||
'REPORT_MAIL_description' => 'Si está habilitado, se envía un correo electrónico con una lista de cambios a los que se ha suscrito. Complete también todas las configuraciones restantes relacionadas con la configuración de SMTP a continuación',
|
||||
'REPORT_MAIL_name' => 'Habilitar email',
|
||||
'REPORT_TO_description' => 'Dirección de correo electrónico a la que se enviará la notificación.',
|
||||
'REPORT_TO_name' => 'Enviar el email a',
|
||||
'SCAN_CYCLE_MINUTES_description' => 'El retraso entre escaneos. Si usa arp-scan, el tiempo de escaneo en sí depende de la cantidad de direcciones IP para verificar. Esto está influenciado por la máscara de red configurada en la configuración <a href="#SCAN_SUBNETS"><code>SCAN_SUBNETS</code></a> en la parte superior. Cada IP toma un par de segundos para escanear.',
|
||||
'SCAN_CYCLE_MINUTES_name' => 'Retraso del ciclo de escaneo',
|
||||
'SCAN_SUBNETS_description' => 'El tiempo de escaneo arp en sí depende de la cantidad de direcciones IP para verificar.
|
||||
El número de direcciones IP para comprobar depende de la <a target="_blank" href="https://www.calculator.net/ip-subnet-calculator.html">máscara de red</a> que establezca aquí.
|
||||
Por ejemplo, una máscara <code>/24</code> da como resultado 256 IP para verificar, mientras que <code>/16</code>
|
||||
controles de máscara alrededor de 65,536. Cada IP toma un par de segundos. Esto significa que con una configuración incorrecta
|
||||
el arp-scan tardará horas en completarse en lugar de segundos.
|
||||
<ol>
|
||||
<li>Especifique la máscara de red. Por ejemplo, el filtro <code>192.168.1.0/24</code> cubre los rangos de IP 192.168.1.0 a 192.168.1.255.</li>
|
||||
<li>Ejecute <code>ifconfig</code> en su contenedor para encontrar los nombres de su interfaz (por ejemplo: <code>eth0</code>, <code>eth1</code>)</li>
|
||||
</ol>
|
||||
',
|
||||
'General_display_name' => 'General',
|
||||
'General_icon' => '<i class="fa fa-gears"></i>',
|
||||
'ENABLE_ARPSCAN_name' => 'Activar escaneo ARP',
|
||||
'ENABLE_ARPSCAN_description' => 'El escaneo Arp es una herramienta de la línea de comandos que usa el protocolo ARP para encontrar e identificar la ip de los dispositivos. Una alternativa a este escaneo sería activar los ajustes de la <a onclick="toggleAllSettings()" href="#PIHOLE_ACTIVE"><code>PIHOLE_ACTIVE</code>integración con PiHole</a>.',
|
||||
'SCAN_SUBNETS_name' => 'Subredes para escanear',
|
||||
'TIMEZONE_description' => 'Zona horaria para mostrar las estadísticas correctamente. Encuentra tu zona horaria<a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">aquí</a>.',
|
||||
'SCAN_SUBNETS_description' => 'El tiempo del escaneo ARP depende del número de ips a comprobar, así que es importante establecer correctamente la máscara y la interfaz de red. Comprueba la <a href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SUBNETS.md" target="_blank">documentación sobre sudredes</a> para obtener ayuda para establecer VLANs, cuáles son soportadas o como averiguar la máscara y la interfaz de red.',
|
||||
'LOG_LEVEL_name' => 'Imprimir registros adicionales',
|
||||
'LOG_LEVEL_description' => 'Esto hará que el registro tenga más información. Util para depurar que eventos se van guardando en la base de datos.',
|
||||
'TIMEZONE_name' => 'Zona horaria',
|
||||
'UI_LANG_description' => 'Seleccione el idioma de interfaz de usuario preferido.',
|
||||
'TIMEZONE_description' => 'La zona horaria para mostrar las estadísticas correctamente. Encuentra tu zona horaria <a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">aquí</a>.',
|
||||
'ENABLE_PLUGINS_name' => 'Habilitar complementos',
|
||||
'ENABLE_PLUGINS_description' => 'Habilita la funcionalidad de los <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins">complementos</a>. Cargar los complementos requiere más recursos de hardware, así que quizás quieras desactivarlo en hardware poco potente.',
|
||||
'PIALERT_WEB_PROTECTION_name' => 'Habilitar inicio de sesión',
|
||||
'PIALERT_WEB_PROTECTION_description' => 'Cuando está habilitado, se muestra un cuadro de diálogo de inicio de sesión. Lea detenidamente a continuación si se le bloquea el acceso a su instancia.',
|
||||
'PIALERT_WEB_PASSWORD_name' => 'Contraseña de inicio de sesión',
|
||||
'PIALERT_WEB_PASSWORD_description' => 'La contraseña predeterminada es <code>123456</code>. Para cambiar la contraseña, ejecute <code>/home/pi/pialert/back/pialert-cli</code> en el contenedor',
|
||||
'INCLUDED_SECTIONS_name' => 'Notificar en',
|
||||
'INCLUDED_SECTIONS_description' => 'Especifica que eventos envían notificaciones. Elimina los tipos de eventos de los que no quieras recibir notificaciones. Este ajuste sobreescribe los ajustes específicos de los dispositivos en la interfaz. (<code>CTRL + Clic</code> para seleccionar / deseleccionar).',
|
||||
'SCAN_CYCLE_MINUTES_name' => 'Retraso del ciclo de escaneo',
|
||||
'SCAN_CYCLE_MINUTES_description' => 'El retraso entre escaneos. Si usa arp-scan, el tiempo de escaneo en sí depende de la cantidad de direcciones IP para verificar. Esto está influenciado por la máscara de red configurada en la configuración <a href="#SCAN_SUBNETS"><code>SCAN_SUBNETS</code></a> en la parte superior. Cada IP toma un par de segundos para escanear.',
|
||||
'DAYS_TO_KEEP_EVENTS_name' => 'Eliminar eventos anteriores a',
|
||||
'DAYS_TO_KEEP_EVENTS_description' => 'Esta es una configuración de mantenimiento. Esto especifica el número de días de entradas de eventos que se guardarán. Todos los eventos anteriores se eliminarán periódicamente.',
|
||||
'REPORT_DASHBOARD_URL_name' => 'URL de Pi.Alert',
|
||||
'REPORT_DASHBOARD_URL_description' => 'Esta URL se utiliza como base para generar enlaces en los correos electrónicos. Ingrese la URL completa que comienza con <code>http://</code>, incluido el número de puerto (sin barra inclinada al final <code>/</code>).',
|
||||
'DIG_GET_IP_ARG_name' => 'Descubrir de IP de Internet',
|
||||
'DIG_GET_IP_ARG_description' => 'Cambie los argumentos de la <a href="https://linux.die.net/man/1/dig" target="_blank">utilidad de dig</a> si tiene problemas para resolver su IP de Internet. Los argumentos se agregan al final del siguiente comando: <code>dig +short </code>.',
|
||||
'UI_LANG_name' => 'Idioma de interfaz',
|
||||
'UI_LANG_description' => 'Seleccione el idioma de interfaz de usuario preferido.',
|
||||
'UI_PRESENCE_name' => 'Mostrar en el gráfico de presencia',
|
||||
'UI_PRESENCE_description' => 'Elige que estados del dispositivo deben mostrarse en la gráfica de <b>Presencia del dispositivo a lo largo del tiempo</b> de la página de <a href="/devices.php" target="_blank">Dispositivos</a>. (<code>CTRL + Clic</code> para seleccionar / deseleccionar)',
|
||||
|
||||
// Email
|
||||
|
||||
'SMTP_FORCE_SSL_description' => 'Forzar SSL al conectarse a su servidor SMTP',
|
||||
'SMTP_FORCE_SSL_name' => 'Forzar SSL',
|
||||
'SMTP_PASS_description' => 'La contraseña del servidor SMTP.',
|
||||
'SMTP_PASS_name' => 'SMTP password',
|
||||
'SMTP_PORT_description' => 'Número de puerto utilizado para la conexión SMTP. Establézcalo en <code>0</code> si no desea utilizar un puerto al conectarse al servidor SMTP.',
|
||||
'SMTP_PORT_name' => 'SMTP server PORT',
|
||||
'Email_display_name' => 'Email',
|
||||
'Email_icon' => '<i class="fa fa-at"></i>',
|
||||
'REPORT_MAIL_name' => 'Habilitar email',
|
||||
'REPORT_MAIL_description' => 'Si está habilitado, se envía un correo electrónico con una lista de cambios a los que se ha suscrito. Complete también todas las configuraciones restantes relacionadas con la configuración de SMTP a continuación',
|
||||
'SMTP_SERVER_name' => 'URL del servidor SMTP',
|
||||
'SMTP_SERVER_description' => 'La URL del host del servidor SMTP. Por ejemplo, <code>smtp-relay.sendinblue.com</code>. Para utilizar Gmail como servidor SMTP <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/SMTP_GMAIL.md">siga esta guía</a >',
|
||||
'SMTP_SERVER_name' => 'SMTP server URL',
|
||||
'SMTP_SKIP_LOGIN_description' => 'No utilice la autenticación cuando se conecte al servidor SMTP.',
|
||||
'SMTP_PORT_name' => 'Puerto del servidor SMTP',
|
||||
'SMTP_PORT_description' => 'Número de puerto utilizado para la conexión SMTP. Establézcalo en <code>0</code> si no desea utilizar un puerto al conectarse al servidor SMTP.',
|
||||
'SMTP_SKIP_LOGIN_name' => 'Omitir autenticación',
|
||||
'SMTP_SKIP_TLS_description' => 'Deshabilite TLS cuando se conecte a su servidor SMTP.',
|
||||
'SMTP_SKIP_TLS_name' => 'No usar TLS',
|
||||
'SMTP_SKIP_LOGIN_description' => 'No utilice la autenticación cuando se conecte al servidor SMTP.',
|
||||
'SMTP_USER_name' => 'Nombre de usuario SMTP',
|
||||
'SMTP_USER_description' => 'El nombre de usuario utilizado para iniciar sesión en el servidor SMTP (a veces, una dirección de correo electrónico completa).',
|
||||
'SMTP_USER_name' => 'SMTP user',
|
||||
|
||||
//API
|
||||
|
||||
'API_CUSTOM_SQL_description' => 'Puede especificar una consulta SQL personalizada que generará un archivo JSON y luego lo expondrá a través del <a href="/api/table_custom_endpoint.json" target="_blank">archivo <code>table_custom_endpoint.json</code ></a>.',
|
||||
'API_CUSTOM_SQL_name' => 'Endpoint personalizado',
|
||||
|
||||
|
||||
'SMTP_PASS_name' => 'Contraseña de SMTP',
|
||||
'SMTP_PASS_description' => 'La contraseña del servidor SMTP.',
|
||||
'SMTP_SKIP_TLS_name' => 'No usar TLS',
|
||||
'SMTP_SKIP_TLS_description' => 'Deshabilite TLS cuando se conecte a su servidor SMTP.',
|
||||
'SMTP_FORCE_SSL_name' => 'Forzar SSL',
|
||||
'SMTP_FORCE_SSL_description' => 'Forzar SSL al conectarse a su servidor SMTP',
|
||||
'REPORT_TO_name' => 'Enviar el email a',
|
||||
'REPORT_TO_description' => 'Dirección de correo electrónico a la que se enviará la notificación.',
|
||||
'REPORT_FROM_name' => 'Asunto del email',
|
||||
'REPORT_FROM_description' => 'Asunto del correo electrónico de notificación.',
|
||||
|
||||
// Webhooks
|
||||
'Webhooks_display_name' => 'Webhooks',
|
||||
'Webhooks_icon' => '<i class="fa fa-circle-nodes"></i>',
|
||||
'REPORT_WEBHOOK_name' => 'Habilitar webhooks',
|
||||
'REPORT_WEBHOOK_description' => 'Habilite webhooks para notificaciones. Los webhooks lo ayudan a conectarse a muchas herramientas de terceros, como IFTTT, Zapier o <a href="https://n8n.io/" target="_blank">n8n</a>, por nombrar algunas. Consulte esta sencilla <a href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/WEBHOOK_N8N.md" target="_blank">guía de n8n aquí</a> para obtener comenzó. Si está habilitado, configure los ajustes relacionados a continuación.',
|
||||
'WEBHOOK_URL_name' => 'URL de destino',
|
||||
'WEBHOOK_URL_description' => 'URL de destino comienza con <code>http://</code> o <code>https://</code>.',
|
||||
'WEBHOOK_PAYLOAD_name' => 'Tipo de carga',
|
||||
'WEBHOOK_PAYLOAD_description' => 'El formato de datos de carga de Webhook para el atributo <code>body</code> > <code>attachments</code> > <code>text</code> en el json de carga. Vea un ejemplo de la carga <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/back/webhook_json_sample.json">aquí</a>. (por ejemplo: para discord use <code>text</code>)',
|
||||
'WEBHOOK_REQUEST_METHOD_name' => 'Método de solicitud',
|
||||
'WEBHOOK_REQUEST_METHOD_description' => 'El método de solicitud HTTP que se utilizará para la llamada de webhook.',
|
||||
'Webhooks_settings_group' => '<i class="fa fa-circle-nodes"></i> Webhooks',
|
||||
|
||||
// Apprise
|
||||
|
||||
'Apprise_display_name' => 'Apprise',
|
||||
'Apprise_icon' => '<i class="fa fa-bullhorn"></i>',
|
||||
'REPORT_APPRISE_name' => 'Habilitar Apprise',
|
||||
'REPORT_APPRISE_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://hub.docker.com/r/caronc/apprise">Apprise</a>.',
|
||||
'APPRISE_HOST_description' => 'Apprise host URL que comienza con <code>http://</code> o <code>https://</code>. (no olvide incluir <code>/notify</code> al final)',
|
||||
'APPRISE_HOST_name' => 'Apprise host URL',
|
||||
'APPRISE_PAYLOAD_description' => 'Seleccione el tipo de carga útil enviada a Apprise. Por ejemplo, <code>html</code> funciona bien con correos electrónicos, <code>text</code> con aplicaciones de chat, como Telegram.',
|
||||
'APPRISE_PAYLOAD_name' => 'Tipo de carga',
|
||||
'APPRISE_URL_description' => 'Informar de la URL de destino de la notificación. Por ejemplo, para Telegram sería <code>tgram://{bot_token}/{chat_id}</code>.',
|
||||
'APPRISE_URL_name' => 'URL de notificación de Apprise',
|
||||
|
||||
// Pushsafer
|
||||
'REPORT_PUSHSAFER_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://www.pushsafer.com/">Pushsafer</a>.',
|
||||
'REPORT_PUSHSAFER_name' => 'Habilitar Pushsafer',
|
||||
|
||||
|
||||
//DYNDNS
|
||||
|
||||
|
||||
'DDNS_ACTIVE_name' => 'Habilitar DynDNS',
|
||||
'DDNS_DOMAIN_name' => 'URL del dominio DynDNS',
|
||||
'DDNS_PASSWORD_name' => 'DynDNS password',
|
||||
'DDNS_UPDATE_URL_description' => 'Actualice la URL que comienza con <code>http://</code> o <code>https://</code>.',
|
||||
'DDNS_UPDATE_URL_name' => 'DynDNS update URL',
|
||||
'DDNS_USER_name' => 'DynDNS user',
|
||||
'DHCP_ACTIVE_description' => 'Debe asignar <code>:/etc/pihole/dhcp.leases</code> en el archivo <code>docker-compose.yml</code> si habilita esta configuración.',
|
||||
'DHCP_ACTIVE_name' => 'Habilitar PiHole DHCP',
|
||||
'DIG_GET_IP_ARG_description' => 'Cambie los argumentos de la <a href="https://linux.die.net/man/1/dig" target="_blank">utilidad de dig</a> si tiene problemas para resolver su IP de Internet. Los argumentos se agregan al final del siguiente comando: <code>dig +short </code>.',
|
||||
'DIG_GET_IP_ARG_name' => 'Descubrir de IP de Internet',
|
||||
|
||||
// MQTT
|
||||
'REPORT_MQTT_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://www.home-assistant.io/integrations/mqtt/">MQTT</a> a su Home Assistance.',
|
||||
'REPORT_MQTT_name' => 'Habilitar MQTT',
|
||||
'MQTT_BROKER_description' => 'URL del host MQTT (no incluya <code>http://</code> o <code>https://</code>).',
|
||||
'MQTT_BROKER_name' => 'MQTT broker URL',
|
||||
'MQTT_DELAY_SEC_description' => 'Un pequeño truco: retrase la adición a la cola en caso de que el proceso se reinicie y los procesos de publicación anteriores se anulen (se necesitan ~<code>2</code>s para actualizar la configuración de un sensor en el intermediario). Probado con <code>2</code>-<code>3</code> segundos de retraso. Este retraso solo se aplica cuando se crean dispositivos (durante el primer bucle de notificación). No afecta los escaneos o notificaciones posteriores.',
|
||||
'MQTT_DELAY_SEC_name' => 'Retraso de MQTT por dispositivo',
|
||||
'MQTT_PASSWORD_description' => 'Contraseña utilizada para iniciar sesión en su instancia de agente de MQTT.',
|
||||
'MQTT_PASSWORD_name' => 'MQTT password',
|
||||
'MQTT_PORT_description' => 'Puerto donde escucha el broker MQTT. Normalmente <code>1883</code>.',
|
||||
'MQTT_PORT_name' => 'MQTT broker puerto',
|
||||
'MQTT_QOS_description' => 'Configuración de calidad de servicio para el envío de mensajes MQTT. <code>0</code>: baja calidad a <code>2</code>: alta calidad. Cuanto mayor sea la calidad, mayor será el retraso.',
|
||||
'MQTT_QOS_name' => 'Calidad de servicio MQTT',
|
||||
'MQTT_USER_description' => 'Nombre de usuario utilizado para iniciar sesión en su instancia de agente de MQTT.',
|
||||
'MQTT_USER_name' => 'MQTT user',
|
||||
'MQTT_settings_group' => '<i class="fa fa-square-rss"></i> MQTT',
|
||||
|
||||
// NMAP
|
||||
|
||||
'NMAP_ACTIVE_description' => 'Si está habilitado, ejecutará un escaneo en un dispositivo recién encontrado. Para un análisis programado o único, verifique la configuración de <a href="#NMAP_RUN"><code>NMAP_RUN</code></a>.',
|
||||
'NMAP_ACTIVE_name' => 'Ejecución del ciclo',
|
||||
'NMAP_ARGS_description' => 'Argumentos utilizados para ejecutar el análisis de Nmap. Tenga cuidado de especificar <a href="https://linux.die.net/man/1/nmap" target="_blank">los argumentos</a> correctamente. Por ejemplo, <code>-p -10000</code> escanea los puertos del 1 al 10000.',
|
||||
'NMAP_ARGS_name' => 'Argumentos',
|
||||
'NMAP_RUN_SCHD_description' => 'Solo está habilitado si selecciona <code>programar</code> en la configuración de <a href="#NMAP_RUN"><code>NMAP_RUN</code></a>. Asegúrese de ingresar el cronograma en el formato tipo cron correcto.',
|
||||
'NMAP_RUN_SCHD_name' => 'Programar',
|
||||
'NMAP_RUN_description' => 'Habilite un escaneo regular de Nmap en su red en todos los dispositivos. Los ajustes de programación se pueden encontrar a continuación. Si selecciona <code>una vez</code>, Nmap se ejecuta solo una vez al inicio durante el tiempo especificado en la configuración de <a href="#NMAP_TIMEOUT"><code>NMAP_TIMEOUT</code></a>.',
|
||||
'NMAP_RUN_name' => 'Ejecución programada',
|
||||
'NMAP_TIMEOUT_description' => 'Tiempo máximo en segundos para esperar a que finalice un escaneo de Nmap en cualquier dispositivo.',
|
||||
'APPRISE_URL_description' => 'Informar de la URL de destino de la notificación. Por ejemplo, para Telegram sería <code>tgram://{bot_token}/{chat_id}</code>.',
|
||||
|
||||
// NTFY
|
||||
'REPORT_NTFY_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://ntfy.sh/">NTFY</a>.',
|
||||
'NTFY_display_name' => 'NTFY',
|
||||
'NTFY_icon' => '<i class="fa fa-terminal"></i>',
|
||||
'REPORT_NTFY_name' => 'Habilitar NTFY',
|
||||
'NTFY_HOST_description' => 'URL de host NTFY que comienza con <code>http://</code> o <code>https://</code>. Puede usar la instancia alojada en <a target="_blank" href="https://ntfy.sh/">https://ntfy.sh</a> simplemente ingresando <code>https://ntfy. sh</código>.',
|
||||
'REPORT_NTFY_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://ntfy.sh/">NTFY</a>.',
|
||||
'NTFY_HOST_name' => 'NTFY host URL',
|
||||
'NTFY_PASSWORD_description' => 'Ingrese la contraseña si necesita (host) una instancia con autenticación habilitada.',
|
||||
'NTFY_PASSWORD_name' => 'NTFY password',
|
||||
'NTFY_TOPIC_name' => 'NTFY topic',
|
||||
'NTFY_HOST_description' => 'URL de host NTFY que comienza con <code>http://</code> o <code>https://</code>. Puede usar la instancia alojada en <a target="_blank" href="https://ntfy.sh/">https://ntfy.sh</a> simplemente ingresando <code>https://ntfy. sh</código>.',
|
||||
'NTFY_TOPIC_name' => 'Tema de NTFY',
|
||||
'NTFY_TOPIC_description' => 'Tu tema secreto.',
|
||||
'NTFY_USER_name' => 'Usuario de NTFY',
|
||||
'NTFY_USER_description' => 'Ingrese usuario si necesita (alojar) una instancia con autenticación habilitada.',
|
||||
'NTFY_USER_name' => 'NTFY user',
|
||||
'NTFY_settings_group' => '<i class="fa fa-terminal"></i> NTFY',
|
||||
'NTFY_PASSWORD_name' => 'Contraseña de NTFY',
|
||||
'NTFY_PASSWORD_description' => 'Ingrese la contraseña si necesita (host) una instancia con autenticación habilitada.',
|
||||
|
||||
// Pholus
|
||||
// Pushsafer
|
||||
'PUSHSAFER_display_name' => 'Pushsafer',
|
||||
'PUSHSAFER_icon' => '<i class="fa fa-bell"></i>',
|
||||
'REPORT_PUSHSAFER_name' => 'Habilitar Pushsafer',
|
||||
'REPORT_PUSHSAFER_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://www.pushsafer.com/">Pushsafer</a>.',
|
||||
'PUSHSAFER_TOKEN_name' => 'Token de Pushsafer',
|
||||
'PUSHSAFER_TOKEN_description' => 'Su clave secreta de la API de Pushsafer (token).',
|
||||
'APPRISE_PAYLOAD_name' => 'Tipo de carga',
|
||||
'APPRISE_PAYLOAD_description' => 'Seleccione el tipo de carga útil enviada a Apprise. Por ejemplo, <code>html</code> funciona bien con correos electrónicos, <code>text</code> con aplicaciones de chat, como Telegram.',
|
||||
|
||||
'Pholus_settings_group' => '<i class="fa fa-search"></i> Pholus',
|
||||
'PHOLUS_ACTIVE_description' => '<a href="https://github.com/jokob-sk/Pi.Alert/tree/main/pholus" target="_blank" >Pholus</a> es una herramienta de rastreo para descubrir información adicional sobre los dispositivos en la red, incluido el nombre del dispositivo. Si está habilitado, ejecutará el escaneo antes de cada ciclo de escaneo de red hasta que no haya dispositivos <code>(unknown)</code> o <code>(name not found)</code>. Tenga en cuenta que puede enviar spam a la red con tráfico innecesario. Depende de la configuración de <a onclick="toggleAllSettings()" href="#SCAN_SUBNETS"><code>SCAN_SUBNETS</code></a>. Para un análisis programado o único, verifique la configuración de <a href="#PHOLUS_RUN"><code>PHOLUS_RUN</code></a>.',
|
||||
'PHOLUS_ACTIVE_name' => 'Ejecución del ciclo',
|
||||
'PHOLUS_DAYS_DATA_description' => 'Cuántos días de entradas de escaneo de Pholus deben conservarse (globalmente, ¡no específico del dispositivo!). El archivo <a href="/maintenance.php#tab_Logging">pialert_pholus.log</a> no se modifica. Introduzca <code>0</code> para desactivar.',
|
||||
'PHOLUS_DAYS_DATA_name' => 'Retención de datos',
|
||||
'PHOLUS_FORCE_description' => 'Fuerce el escaneo de cada escaneo de red, incluso si no hay dispositivos <code>(unknown)</code> o <code>(name not found)</code>. Tenga cuidado al habilitar esto, ya que la detección puede inundar fácilmente su red.',
|
||||
'PHOLUS_FORCE_name' => 'Escaneo de fuerza de ciclo',
|
||||
'PHOLUS_RUN_SCHD_description' => 'Solo está habilitado si selecciona <code>programar</code> en la configuración de <a href="#PHOLUS_RUN"><code>PHOLUS_RUN</code></a>. Asegúrese de ingresar el horario en el formato similar a cron correcto
|
||||
(por ejemplo, validar en <a href="https://crontab.guru/" target="_blank">crontab.guru</a>). Por ejemplo, ingresar <code>0 4 * * *</code> ejecutará el escaneo después de las 4 am en el <a onclick="toggleAllSettings()" href="#TIMEZONE"><code>TIMEZONE</code> que configuró arriba</a>. Se ejecutará la PRÓXIMA vez que pase el tiempo.',
|
||||
'PHOLUS_RUN_SCHD_name' => 'Programar',
|
||||
'PHOLUS_RUN_TIMEOUT_description' => 'El tiempo de espera en segundos para el escaneo Pholus programado. Se aplican las mismas notas con respecto a la duración que en la configuración de <a href="#PHOLUS_TIMEOUT"><code>PHOLUS_TIMEOUT</code></a>. Un escaneo programado no verifica si hay dispositivos <code>(unknown)</code> o <code>(name not found)</code>, el escaneo se ejecuta de cualquier manera.',
|
||||
'PHOLUS_RUN_TIMEOUT_name' => 'Tiempo de espera de ejecución programado',
|
||||
'PHOLUS_RUN_description' => 'Habilite un escaneo regular de Pholus en su red. Los ajustes de programación se pueden encontrar a continuación. Si selecciona <code>una vez</code>, Pholus se ejecuta solo una vez al inicio durante el tiempo especificado en la configuración de <a href="#PHOLUS_RUN_TIMEOUT"><code>PHOLUS_RUN_TIMEOUT</code></a>.',
|
||||
'PHOLUS_RUN_name' => 'Ejecución programada',
|
||||
'PHOLUS_TIMEOUT_description' => '¿Cuánto tiempo en segundos debe rastrear Pholus en cada interfaz si se cumple la condición anterior? Cuanto más tiempo lo deje encendido, es más probable que los dispositivos transmitan más información. Este tiempo de espera se suma al tiempo que lleva realizar un escaneo arp en su red.',
|
||||
'PHOLUS_TIMEOUT_name' => 'Tiempo de espera de ciclo',
|
||||
// MQTT
|
||||
'MQTT_display_name' => 'MQTT',
|
||||
'MQTT_icon' => '<i class="fa fa-square-rss"></i>',
|
||||
'REPORT_MQTT_name' => 'Habilitar MQTT',
|
||||
'REPORT_MQTT_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://www.home-assistant.io/integrations/mqtt/">MQTT</a> a su Home Assistance.',
|
||||
'MQTT_BROKER_name' => 'URL del broker MQTT',
|
||||
'MQTT_BROKER_description' => 'URL del host MQTT (no incluya <code>http://</code> o <code>https://</code>).',
|
||||
'MQTT_PORT_name' => 'Puerto del broker MQTT',
|
||||
'MQTT_PORT_description' => 'Puerto donde escucha el broker MQTT. Normalmente <code>1883</code>.',
|
||||
'MQTT_USER_name' => 'Usuario de MQTT',
|
||||
'MQTT_USER_description' => 'Nombre de usuario utilizado para iniciar sesión en su instancia de agente de MQTT.',
|
||||
'MQTT_PASSWORD_name' => 'Contraseña de MQTT',
|
||||
'MQTT_PASSWORD_description' => 'Contraseña utilizada para iniciar sesión en su instancia de agente de MQTT.',
|
||||
'MQTT_QOS_name' => 'Calidad de servicio MQTT',
|
||||
'MQTT_QOS_description' => 'Configuración de calidad de servicio para el envío de mensajes MQTT. <code>0</code>: baja calidad a <code>2</code>: alta calidad. Cuanto mayor sea la calidad, mayor será el retraso.',
|
||||
'MQTT_DELAY_SEC_name' => 'Retraso de MQTT por dispositivo',
|
||||
'MQTT_DELAY_SEC_description' => 'Un pequeño truco: retrase la adición a la cola en caso de que el proceso se reinicie y los procesos de publicación anteriores se anulen (se necesitan ~<code>2</code>s para actualizar la configuración de un sensor en el intermediario). Probado con <code>2</code>-<code>3</code> segundos de retraso. Este retraso solo se aplica cuando se crean dispositivos (durante el primer bucle de notificación). No afecta los escaneos o notificaciones posteriores.',
|
||||
|
||||
//DYNDNS
|
||||
'DynDNS_display_name' => 'DynDNS',
|
||||
'DynDNS_icon' => '<i class="fa fa-globe"></i>',
|
||||
'DDNS_ACTIVE_name' => 'Habilitar DynDNS',
|
||||
'DDNS_ACTIVE_description' => '',
|
||||
'DDNS_DOMAIN_name' => 'URL del dominio DynDNS',
|
||||
'DDNS_DOMAIN_description' => '',
|
||||
'DDNS_USER_name' => 'Usuario de DynDNS',
|
||||
'DDNS_USER_description' => '',
|
||||
'DDNS_PASSWORD_name' => 'Contraseña de DynDNS',
|
||||
'DDNS_PASSWORD_description' => '',
|
||||
'DDNS_UPDATE_URL_name' => 'URL de actualización de DynDNS',
|
||||
'DDNS_UPDATE_URL_description' => 'Actualice la URL que comienza con <code>http://</code> o <code>https://</code>.',
|
||||
|
||||
// PiHole
|
||||
|
||||
'PiHole_settings_group' => '<i class="fa fa-seedling"></i> PiHole',
|
||||
'PIHOLE_ACTIVE_description' => 'Debe mapear <code>:/etc/pihole/pihole-FTL.db</code> en el archivo <code>docker-compose.yml</code> si habilita esta configuración.',
|
||||
'PiHole_display_name' => 'PiHole',
|
||||
'PiHole_icon' => '<i class="fa fa-seedling"></i>',
|
||||
'PIHOLE_ACTIVE_name' => 'Habilitar el mapeo de PiHole',
|
||||
'PRINT_LOG_description' => 'Esta configuración habilitará un registro más detallado. Útil para depurar eventos que se escriben en la base de datos.',
|
||||
'PRINT_LOG_name' => 'Imprimir registro adicional',
|
||||
'PUSHSAFER_TOKEN_description' => 'Su clave secreta de la API de Pushsafer (token).',
|
||||
'PUSHSAFER_TOKEN_name' => 'Pushsafer token',
|
||||
'PUSHSAFER_settings_group' => '<i class="fa fa-bell"></i> Pushsafer',
|
||||
'PIHOLE_ACTIVE_description' => 'Debe mapear <code>:/etc/pihole/pihole-FTL.db</code> en el archivo <code>docker-compose.yml</code> si habilita esta configuración.',
|
||||
'DHCP_ACTIVE_name' => 'Habilitar PiHole DHCP',
|
||||
'DHCP_ACTIVE_description' => 'Debe asignar <code>:/etc/pihole/dhcp.leases</code> en el archivo <code>docker-compose.yml</code> si habilita esta configuración.',
|
||||
|
||||
//Apprise
|
||||
// Pholus
|
||||
'Pholus_display_name' => 'Pholus',
|
||||
'Pholus_icon' => '<i class="fa fa-search"></i>',
|
||||
'PHOLUS_ACTIVE_name' => 'Ejecución del ciclo',
|
||||
'PHOLUS_ACTIVE_description' => '<a href="https://github.com/jokob-sk/Pi.Alert/tree/main/pholus" target="_blank" >Pholus</a> es una herramienta de rastreo para descubrir información adicional sobre los dispositivos en la red, incluido el nombre del dispositivo. Si está habilitado, ejecutará el escaneo antes de cada ciclo de escaneo de red hasta que no haya dispositivos <code>(unknown)</code> o <code>(name not found)</code>. Tenga en cuenta que puede enviar spam a la red con tráfico innecesario. Depende de la configuración de <a onclick="toggleAllSettings()" href="#SCAN_SUBNETS"><code>SCAN_SUBNETS</code></a>. Para un análisis programado o único, verifique la configuración de <a href="#PHOLUS_RUN"><code>PHOLUS_RUN</code></a>.',
|
||||
'PHOLUS_TIMEOUT_name' => 'Tiempo de espera de ciclo',
|
||||
'PHOLUS_TIMEOUT_description' => '¿Cuánto tiempo en segundos debe rastrear Pholus en cada interfaz si se cumple la condición anterior? Cuanto más tiempo lo deje encendido, es más probable que los dispositivos transmitan más información. Este tiempo de espera se suma al tiempo que lleva realizar un escaneo arp en su red.',
|
||||
'PHOLUS_FORCE_name' => 'Escaneo de fuerza de ciclo',
|
||||
'PHOLUS_FORCE_description' => 'Fuerce el escaneo de cada escaneo de red, incluso si no hay dispositivos <code>(unknown)</code> o <code>(name not found)</code>. Tenga cuidado al habilitar esto, ya que la detección puede inundar fácilmente su red.',
|
||||
'PHOLUS_RUN_name' => 'Ejecución programada',
|
||||
'PHOLUS_RUN_description' => 'Habilite un escaneo regular de Pholus en su red. Los ajustes de programación se pueden encontrar a continuación. Si selecciona <code>una vez</code>, Pholus se ejecuta solo una vez al inicio durante el tiempo especificado en la configuración de <a href="#PHOLUS_RUN_TIMEOUT"><code>PHOLUS_RUN_TIMEOUT</code></a>.',
|
||||
'PHOLUS_RUN_TIMEOUT_name' => 'Tiempo de espera de ejecución programado',
|
||||
'PHOLUS_RUN_TIMEOUT_description' => 'El tiempo de espera en segundos para el escaneo Pholus programado. Se aplican las mismas notas con respecto a la duración que en la configuración de <a href="#PHOLUS_TIMEOUT"><code>PHOLUS_TIMEOUT</code></a>. Un escaneo programado no verifica si hay dispositivos <code>(unknown)</code> o <code>(name not found)</code>, el escaneo se ejecuta de cualquier manera.',
|
||||
'PHOLUS_RUN_SCHD_name' => 'Programar',
|
||||
'PHOLUS_RUN_SCHD_description' => 'Solo está habilitado si selecciona <code>programar</code> en la configuración de <a href="#PHOLUS_RUN"><code>PHOLUS_RUN</code></a>. Asegúrese de ingresar el horario en el formato similar a cron correcto
|
||||
(por ejemplo, validar en <a href="https://crontab.guru/" target="_blank">crontab.guru</a>). Por ejemplo, ingresar <code>0 4 * * *</code> ejecutará el escaneo después de las 4 am en el <a onclick="toggleAllSettings()" href="#TIMEZONE"><code>TIMEZONE</code> que configuró arriba</a>. Se ejecutará la PRÓXIMA vez que pase el tiempo.',
|
||||
'PHOLUS_DAYS_DATA_name' => 'Retención de datos',
|
||||
'PHOLUS_DAYS_DATA_description' => 'Cuántos días de entradas de escaneo de Pholus deben conservarse (globalmente, ¡no específico del dispositivo!). El archivo <a href="/maintenance.php#tab_Logging">pialert_pholus.log</a> no se modifica. Introduzca <code>0</code> para desactivar.',
|
||||
|
||||
'REPORT_APPRISE_description' => 'Habilitar el envío de notificaciones a través de <a target="_blank" href="https://hub.docker.com/r/caronc/apprise">Apprise</a>.',
|
||||
'REPORT_APPRISE_name' => 'Habilitar Apprise',
|
||||
// NMAP
|
||||
'Nmap_display_name' => 'Nmap',
|
||||
'Nmap_icon' => '<i class="fa fa-ethernet"></i>',
|
||||
'NMAP_ACTIVE_name' => 'Ejecución del ciclo',
|
||||
'NMAP_ACTIVE_description' => 'Si está habilitado, ejecutará un escaneo en un dispositivo recién encontrado. Para un análisis programado o único, verifique la configuración de <a href="#NMAP_RUN"><code>NMAP_RUN</code></a>.',
|
||||
'PHOLUS_TIMEOUT_name' => 'Tiempo de espera de ciclo',
|
||||
'NMAP_TIMEOUT_description' => 'Tiempo máximo en segundos para esperar a que finalice un escaneo de Nmap en cualquier dispositivo.',
|
||||
'NMAP_RUN_name' => 'Ejecución programada',
|
||||
'NMAP_RUN_description' => 'Habilite un escaneo regular de Nmap en su red en todos los dispositivos. Los ajustes de programación se pueden encontrar a continuación. Si selecciona <code>una vez</code>, Nmap se ejecuta solo una vez al inicio durante el tiempo especificado en la configuración de <a href="#NMAP_TIMEOUT"><code>NMAP_TIMEOUT</code></a>.',
|
||||
'NMAP_RUN_SCHD_name' => 'Programar',
|
||||
'NMAP_RUN_SCHD_description' => 'Solo está habilitado si selecciona <code>programar</code> en la configuración de <a href="#NMAP_RUN"><code>NMAP_RUN</code></a>. Asegúrese de ingresar el cronograma en el formato tipo cron correcto.',
|
||||
'NMAP_ARGS_name' => 'Argumentos',
|
||||
'NMAP_ARGS_description' => 'Argumentos utilizados para ejecutar el análisis de Nmap. Tenga cuidado de especificar <a href="https://linux.die.net/man/1/nmap" target="_blank">los argumentos</a> correctamente. Por ejemplo, <code>-p -10000</code> escanea los puertos del 1 al 10000.',
|
||||
|
||||
// Webhooks
|
||||
'REPORT_WEBHOOK_description' => 'Habilite webhooks para notificaciones. Los webhooks lo ayudan a conectarse a muchas herramientas de terceros, como IFTTT, Zapier o <a href="https://n8n.io/" target="_blank">n8n</a>, por nombrar algunas. Consulte esta sencilla <a href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/WEBHOOK_N8N.md" target="_blank">guía de n8n aquí</a> para obtener comenzó. Si está habilitado, configure los ajustes relacionados a continuación.',
|
||||
'REPORT_WEBHOOK_name' => 'Habilitar webhooks',
|
||||
'WEBHOOK_PAYLOAD_description' => 'El formato de datos de carga de Webhook para el atributo <code>body</code> > <code>attachments</code> > <code>text</code> en el json de carga. Vea un ejemplo de la carga <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/back/webhook_json_sample.json">aquí</a>. (por ejemplo: para discord use <code>html</code>)',
|
||||
'WEBHOOK_PAYLOAD_name' => 'Tipo de carga',
|
||||
'WEBHOOK_REQUEST_METHOD_description' => 'El método de solicitud HTTP que se utilizará para la llamada de webhook.',
|
||||
'WEBHOOK_REQUEST_METHOD_name' => 'Método de solicitud',
|
||||
'WEBHOOK_URL_description' => 'URL de destino comienza con <code>http://</code> o <code>https://</code>.',
|
||||
'WEBHOOK_URL_name' => 'URL de destino',
|
||||
'Webhooks_settings_group' => '<i class="fa fa-circle-nodes"></i> Webhooks',
|
||||
//API
|
||||
'API_display_name' => 'API',
|
||||
'API_icon' => '<i class="fa fa-arrow-down-up-across-line"></i>',
|
||||
'API_CUSTOM_SQL_name' => 'Endpoint personalizado',
|
||||
'API_CUSTOM_SQL_description' => 'Puede especificar una consulta SQL personalizada que generará un archivo JSON y luego lo expondrá a través del <a href="/api/table_custom_endpoint.json" target="_blank">archivo <code>table_custom_endpoint.json</code ></a>.',
|
||||
|
||||
// Other
|
||||
|
||||
'general_event_description' => 'El evento que ha activado puede tardar un tiempo hasta que finalicen los procesos en segundo plano. La ejecución terminó una vez que vea <code>finished</code> a continuación. Consulte el <a onclick=\'setCache("activeMaintenanceTab", "tab_Logging_id")\' href="/maintenance.php#tab_Logging">registro de errores</a> si no obtuvo el resultado esperado. <br/> <br/> Estado:',
|
||||
'general_event_title' => 'Ejecución de un evento ad-hoc',
|
||||
'run_event_icon' => 'fa-play',
|
||||
'run_event_tooltip' => 'Habilite la configuración y guarde sus cambios al principio antes de ejecutarlo.',
|
||||
'settings_expand_all' => 'Expandir todo',
|
||||
'settings_imported' => 'La última vez que se importó la configuración desde el archivo pialert.conf:',
|
||||
'settings_missing' => 'No se han cargado todos los ajustes, actualice la página. Esto probablemente se deba a una gran carga en la base de datos.',
|
||||
'settings_missing_block' => 'No puede guardar su configuración sin especificar todas las claves de configuración. Recarga la página. Esto probablemente se deba a una gran carga en la base de datos.',
|
||||
'settings_old' => 'La configuración en la base de datos (que se muestra en esta página) está desactualizada. Esto probablemente se deba a un análisis en ejecución. La configuración se guardó en el archivo <code>pialert.conf</code>, pero el proceso en segundo plano aún no tuvo tiempo de importarlo a la base de datos. Puede esperar hasta que la configuración se actualice para no sobrescribir sus valores anteriores. Siéntase libre de guardar su configuración de cualquier manera si no le importa perder la configuración entre la última vez que guardó y ahora. También se crean archivos de respaldo si necesita comparar su configuración más adelante.',
|
||||
'test_event_icon' => 'fa-vial-circle-check',
|
||||
'test_event_tooltip' => 'Guarde sus cambios antes de probar su configuración.',
|
||||
|
||||
);
|
||||
?>
|
||||
?>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require 'php/templates/header.php';
|
||||
require 'php/templates/notification.php';
|
||||
?>
|
||||
|
||||
<script src="js/pialert_common.js"></script>
|
||||
@@ -8,460 +9,23 @@
|
||||
<!-- Page ------------------------------------------------------------------ -->
|
||||
<div class="content-wrapper">
|
||||
|
||||
<!-- Content header--------------------------------------------------------- -->
|
||||
<section class="content-header">
|
||||
<?php require 'php/templates/notification.php'; ?>
|
||||
<!-- Content header--------------------------------------------------------- -->
|
||||
<section class="content-header">
|
||||
|
||||
<h1 id="pageTitle">
|
||||
<i class="fa fa-fw fa-plug"></i> <?= lang('Navigation_Plugins');?>
|
||||
<span class="pageHelp"> <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins"><i class="fa fa-circle-question"></i></a><span>
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
<!-- Main content ---------------------------------------------------------- -->
|
||||
<section class="content">
|
||||
<div class="nav-tabs-custom plugin-content" style="margin-bottom: 0px;">
|
||||
<ul id="tabs-location" class="nav nav-tabs">
|
||||
<!-- PLACEHOLDER -->
|
||||
</ul>
|
||||
<div id="tabs-content-location" class="tab-content">
|
||||
<!-- PLACEHOLDER -->
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require 'pluginsCore.php';
|
||||
?>
|
||||
|
||||
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script defer>
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Get form control according to the column definition from config.json > database_column_definitions
|
||||
function getFormControl(dbColumnDef, value, index) {
|
||||
|
||||
result = ''
|
||||
|
||||
switch(dbColumnDef.type)
|
||||
{
|
||||
case 'label':
|
||||
result = `<span>${value}<span>`;
|
||||
break;
|
||||
case 'textboxsave':
|
||||
|
||||
value = value == 'null' ? '' : value; // hide 'null' values
|
||||
|
||||
id = `${dbColumnDef.column}_${index}`
|
||||
|
||||
result = `<span class="form-group">
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" value="${value}" id="${id}" data-my-column="${dbColumnDef.column}" data-my-index="${index}" name="${dbColumnDef.column}">
|
||||
<span class="input-group-addon"><i class="fa fa-save pointer" onclick="saveData('${id}');"></i></span>
|
||||
</div>
|
||||
<span>`;
|
||||
break;
|
||||
case 'url':
|
||||
result = `<span><a href="${value}" target="_blank">${value}</a><span>`;
|
||||
break;
|
||||
case 'devicemac':
|
||||
result = `<span class="anonymizeMac"><a href="/deviceDetails.php?mac=${value}" target="_blank">${value}</a><span>`;
|
||||
break;
|
||||
case 'deviceip':
|
||||
result = `<span class="anonymizeIp"><a href="#" onclick="navigateToDeviceWithIp('${value}')" >${value}</a><span>`;
|
||||
break;
|
||||
case 'threshold':
|
||||
$.each(dbColumnDef.options, function(index, obj) {
|
||||
if(Number(value) < obj.maximum && result == '')
|
||||
{
|
||||
result = `<div style="background-color:${obj.hexColor}">${value}</div>`
|
||||
// return;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'replace':
|
||||
$.each(dbColumnDef.options, function(index, obj) {
|
||||
if(value == obj.equals)
|
||||
{
|
||||
result = `<span title="${value}">${obj.replacement}</span>`
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
result = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Update the coresponding DB column and entry
|
||||
function saveData (id) {
|
||||
columnName = $(`#${id}`).attr('data-my-column')
|
||||
index = $(`#${id}`).attr('data-my-index')
|
||||
columnValue = $(`#${id}`).val()
|
||||
|
||||
$.get(`php/server/dbHelper.php?action=update&dbtable=Plugins_Objects&columnName=Index&id=${index}&columns=UserData&values=${columnValue}`, function(data) {
|
||||
|
||||
// var result = JSON.parse(data);
|
||||
console.log(data)
|
||||
|
||||
if(sanitize(data) == 'OK')
|
||||
{
|
||||
showMessage('<?= lang('Gen_DataUpdatedUITakesTime');?>')
|
||||
// Remove navigation prompt "Are you sure you want to leave..."
|
||||
window.onbeforeunload = null;
|
||||
} else
|
||||
{
|
||||
showMessage('<?= lang('Gen_LockedDB');?>')
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Get translated string
|
||||
function localize (obj, key) {
|
||||
|
||||
currLangCode = getCookie("language")
|
||||
|
||||
result = ""
|
||||
en_us = ""
|
||||
|
||||
if(obj.localized && obj.localized.includes(key))
|
||||
{
|
||||
for(i=0;i<obj[key].length;i++)
|
||||
{
|
||||
code = obj[key][i]["language_code"]
|
||||
|
||||
// console.log(code)
|
||||
|
||||
if( code == 'en_us')
|
||||
{
|
||||
en_us = obj[key][i]["string"]
|
||||
}
|
||||
|
||||
if(code == currLangCode)
|
||||
{
|
||||
result = obj[key][i]["string"]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result == "" ? en_us : result ;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
pluginDefinitions = []
|
||||
pluginUnprocessedEvents = []
|
||||
pluginObjects = []
|
||||
pluginHistory = []
|
||||
|
||||
function getData(){
|
||||
|
||||
$.get('api/plugins.json', function(res) {
|
||||
|
||||
pluginDefinitions = res["data"];
|
||||
|
||||
$.get('api/table_plugins_events.json', function(res) {
|
||||
|
||||
pluginUnprocessedEvents = res["data"];
|
||||
|
||||
$.get('api/table_plugins_objects.json', function(res) {
|
||||
|
||||
pluginObjects = res["data"];
|
||||
|
||||
$.get('api/table_plugins_history.json', function(res) {
|
||||
|
||||
pluginHistory = res["data"];
|
||||
|
||||
generateTabs()
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function generateTabs()
|
||||
{
|
||||
activetab = 'active'
|
||||
|
||||
$.each(pluginDefinitions, function(index, obj) {
|
||||
$('#tabs-location').append(
|
||||
`<li class=" ${activetab}">
|
||||
<a href="#${obj.unique_prefix}" data-plugin-prefix="${obj.unique_prefix}" id="${obj.unique_prefix}_id" data-toggle="tab" >
|
||||
${localize(obj, 'icon')} ${localize(obj, 'display_name')}
|
||||
</a>
|
||||
</li>`
|
||||
);
|
||||
activetab = '' // only first tab is active
|
||||
});
|
||||
|
||||
activetab = 'active'
|
||||
|
||||
$.each(pluginDefinitions, function(index, obj) {
|
||||
|
||||
headersHtml = ""
|
||||
colDefinitions = []
|
||||
evRows = ""
|
||||
obRows = ""
|
||||
hiRows = ""
|
||||
|
||||
// Generate the header
|
||||
$.each(obj["database_column_definitions"], function(index, colDef){
|
||||
if(colDef.show == true) // select only the ones to show
|
||||
{
|
||||
colDefinitions.push(colDef)
|
||||
headersHtml += `<th class="${colDef.css_classes}" >${localize(colDef, "name" )}</th>`
|
||||
}
|
||||
});
|
||||
|
||||
// Generate the event rows
|
||||
var eveCount = 0;
|
||||
for(i=0;i<pluginUnprocessedEvents.length;i++)
|
||||
{
|
||||
if(pluginUnprocessedEvents[i].Plugin == obj.unique_prefix)
|
||||
{
|
||||
clm = ""
|
||||
|
||||
for(j=0;j<colDefinitions.length;j++)
|
||||
{
|
||||
clm += '<td>'+ pluginUnprocessedEvents[i][colDefinitions[j].column] +'</td>'
|
||||
}
|
||||
evRows += `<tr data-my-index="${pluginUnprocessedEvents[i]["Index"]}" >${clm}</tr>`
|
||||
eveCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the history rows
|
||||
var histCount = 0
|
||||
var histCountDisplayed = 0
|
||||
|
||||
for(i=pluginHistory.length-1;i >= 0;i--) // from latest to the oldest
|
||||
{
|
||||
if(pluginHistory[i].Plugin == obj.unique_prefix)
|
||||
{
|
||||
if(histCount < 50) // only display 50 entries to optimize performance
|
||||
{
|
||||
clm = ""
|
||||
|
||||
for(j=0;j<colDefinitions.length;j++)
|
||||
{
|
||||
clm += '<td>'+ pluginHistory[i][colDefinitions[j].column] +'</td>'
|
||||
}
|
||||
hiRows += `<tr data-my-index="${pluginHistory[i]["Index"]}" >${clm}</tr>`
|
||||
|
||||
histCountDisplayed++;
|
||||
}
|
||||
histCount++; // count and display the total
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the object rows
|
||||
var obCount = 0;
|
||||
for(var i=0;i<pluginObjects.length;i++)
|
||||
{
|
||||
if(pluginObjects[i].Plugin == obj.unique_prefix)
|
||||
{
|
||||
clm = ""
|
||||
|
||||
for(var j=0;j<colDefinitions.length;j++)
|
||||
{
|
||||
clm += '<td>'+ getFormControl(colDefinitions[j], pluginObjects[i][colDefinitions[j].column], pluginObjects[i]["Index"]) +'</td>'
|
||||
}
|
||||
obRows += `<tr data-my-index="${pluginObjects[i]["Index"]}" >${clm}</tr>`
|
||||
obCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#tabs-content-location').append(
|
||||
`
|
||||
<div id="${obj.unique_prefix}" class="tab-pane ${activetab}">
|
||||
<div class="nav-tabs-custom" style="margin-bottom: 0px">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active" >
|
||||
<a href="#objectsTarget_${obj.unique_prefix}" data-toggle="tab" >
|
||||
|
||||
<i class="fa fa-cube"></i> <?= lang('Plugins_Objects');?> (${obCount})
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="#eventsTarget_${obj.unique_prefix}" data-toggle="tab" >
|
||||
|
||||
<i class="fa fa-bolt"></i> <?= lang('Plugins_Unprocessed_Events');?> (${eveCount})
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="#historyTarget_${obj.unique_prefix}" data-toggle="tab" >
|
||||
|
||||
<i class="fa fa-clock"></i> <?= lang('Plugins_History');?> (${histCountDisplayed} out of ${histCount} )
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div id="objectsTarget_${obj.unique_prefix}" class="tab-pane ${activetab}">
|
||||
<table class="table table-striped" data-my-dbtable="Plugins_Objects">
|
||||
<tbody>
|
||||
<tr>
|
||||
${headersHtml}
|
||||
</tr>
|
||||
${obRows}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="plugin-obj-purge">
|
||||
<button class="btn btn-primary" onclick="purgeAll('${obj.unique_prefix}', 'Plugins_Objects' )"><?= lang('Gen_DeleteAll');?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="eventsTarget_${obj.unique_prefix}" class="tab-pane">
|
||||
<table class="table table-striped" data-my-dbtable="Plugins_Events">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
${headersHtml}
|
||||
</tr>
|
||||
${evRows}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="plugin-obj-purge">
|
||||
<button class="btn btn-primary" onclick="purgeAll('${obj.unique_prefix}', 'Plugins_Events' )"><?= lang('Gen_DeleteAll');?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="historyTarget_${obj.unique_prefix}" class="tab-pane">
|
||||
<table class="table table-striped" data-my-dbtable="Plugins_History">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
${headersHtml}
|
||||
</tr>
|
||||
${hiRows}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="plugin-obj-purge">
|
||||
<button class="btn btn-primary" onclick="purgeAll('${obj.unique_prefix}', 'Plugins_History' )"><?= lang('Gen_DeleteAll');?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class='plugins-description'>
|
||||
|
||||
${localize(obj, 'description')}
|
||||
|
||||
<span>
|
||||
<a href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/${obj.code_name}" target="_blank"><?= lang('Gen_Help');?></a>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
activetab = '' // only first tab is active
|
||||
});
|
||||
|
||||
initTabs()
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// handle first tab (objectsTarget_) display
|
||||
function initTabs()
|
||||
{
|
||||
// events on tab change
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var target = $(e.target).attr("href") // activated tab
|
||||
|
||||
// save the last prefix
|
||||
if(target.includes('_') == false )
|
||||
{
|
||||
pref = target.split('#')[1]
|
||||
} else
|
||||
{
|
||||
pref = target.split('_')[1]
|
||||
}
|
||||
|
||||
everythingHidden = false;
|
||||
|
||||
if($('#objectsTarget_'+ pref) != undefined && $('#historyTarget_'+ pref) != undefined && $('#eventsTarget_'+ pref) != undefined)
|
||||
{
|
||||
everythingHidden = $('#objectsTarget_'+ pref).attr('class').includes('active') == false && $('#historyTarget_'+ pref).attr('class').includes('active') == false && $('#eventsTarget_'+ pref).attr('class').includes('active') == false;
|
||||
}
|
||||
|
||||
// show the objectsTarget if no specific pane selected or if selected is hidden
|
||||
if((target == '#'+pref ) && everythingHidden)
|
||||
{
|
||||
var classTmp = $('#objectsTarget_'+ pref).attr('class');
|
||||
|
||||
if($('#objectsTarget_'+ pref).attr('class').includes('active') == false)
|
||||
{
|
||||
classTmp += ' active';
|
||||
$('#objectsTarget_'+ pref).attr('class', classTmp)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
plugPrefix = ''
|
||||
dbTable = ''
|
||||
|
||||
function purgeAll(callback) {
|
||||
plugPrefix = arguments[0]; // plugin prefix
|
||||
dbTable = arguments[1]; // DB table
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Gen_Purge');?>' + ' ' + plugPrefix + ' ' + dbTable , '<?= lang('Gen_AreYouSure');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', "purgeAllExecute");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
function purgeAllExecute() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "php/server/dbHelper.php",
|
||||
data: { action: "delete", dbtable: dbTable, columnName: 'Plugin', id:plugPrefix },
|
||||
success: function(data, textStatus) {
|
||||
showModalOk ('Result', data );
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
function purgeVisible() {
|
||||
|
||||
idArr = $(`#${plugPrefix} table[data-my-dbtable="${dbTable}"] tr[data-my-index]`).map(function(){return $(this).attr("data-my-index");}).get();
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "php/server/dbHelper.php",
|
||||
data: { action: "delete", dbtable: dbTable, columnName: 'Index', id:idArr.toString() },
|
||||
success: function(data, textStatus) {
|
||||
showModalOk ('Result', data );
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
getData()
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require 'php/templates/footer.php';
|
||||
?>
|
||||
|
||||
@@ -1,18 +1,35 @@
|
||||
# ⚠ Disclaimer
|
||||
## 📚 Docs for individual plugins
|
||||
|
||||
Highly experimental feature. Follow the below very carefully and check example plugin(s). Plugin UI is not my priority right now, happy to approve PRs if you are interested in extending/improvintg the UI experience (e.g. making the tables sortable/filterable).
|
||||
### Script based plugins
|
||||
|
||||
## ❗ Known issues:
|
||||
- [website_monitor (WEBMON)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/website_monitor/)
|
||||
- [dhcp_servers (DHCPSRVS)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/dhcp_servers/)
|
||||
- [dhcp_leases (DHCPLSS)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/dhcp_leases/)
|
||||
- [unifi_import (UNFIMP)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/unifi_import/)
|
||||
- [snmp_discovery (SNMPDSC)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/snmp_discovery/)
|
||||
- [undiscoverables (UNDIS)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/undiscoverables/)
|
||||
|
||||
These issues will be hopefully fixed with time, so please don't report them. Instead, if you know how, feel free to investigate and submit a PR to fix the below. Keep the PRs small as it's easier to approve them:
|
||||
### SQL query based plugins
|
||||
- [nmap_services (NMAPSERV)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/nmap_services/)
|
||||
|
||||
* Existing plugin objects sometimes not interpreted correctly and a new object is created instead, resulting in duplicate entries.
|
||||
* Occasional (experienced twice) hanging of processing plugin script file.
|
||||
* UI displaying outdated values until the API endpoints get refreshed.
|
||||
### template based plugins
|
||||
- [newdev_template (NEWDEV)](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/newdev_template/)
|
||||
|
||||
## Overview
|
||||
## 🌟 Create a custom plugin: Overview
|
||||
|
||||
PiAlert comes with a plugin system to feed events from third-party scripts into the UI and then send notifications, if desired. The highlighted functionality this plugin system supports, is dynamic creation of a simple UI to interact with the discovered objects, a mechanism to surface settings of plugins in the UI, or to import objects into existing PiAlert database tables. (Currently update/overwriting of existing objects is not supported.)
|
||||
| ![Screen 1][screen1] | ![Screen 2][screen2] | ![Screen 3][screen3] |
|
||||
|----------------------|----------------------| ----------------------|
|
||||
| ![Screen 4][screen4] | ![Screen 5][screen5] |
|
||||
|
||||
PiAlert comes with a plugin system to feed events from third-party scripts into the UI and then send notifications, if desired. The highlighted core functionality this plugin system supports, is:
|
||||
|
||||
* dynamic creation of a simple UI to interact with the discovered objects,
|
||||
* filtering of displayed values in the Devices UI
|
||||
* surface settings of plugins in the UI,
|
||||
* different column types for reported values to e.g. link back to a device
|
||||
* import objects into existing PiAlert database tables
|
||||
|
||||
> (Currently, update/overwriting of existing objects is not supported.)
|
||||
|
||||
Example use cases for plugins could be:
|
||||
|
||||
@@ -21,18 +38,35 @@ Example use cases for plugins could be:
|
||||
* Creating ad-hoc UI tables from existing data in the PiAlert database, e.g. to show all open ports on devices, to list devices that disconnected in the last hour, etc.
|
||||
* Using other device discovery methods on the network and importing the data as new devices
|
||||
* Creating a script to create FAKE devices based on user input via custom settings
|
||||
* ...at this point the limitation is mostly the creativity than the capability (there might be edge cases and need to support more form controls for user input off custom settings, but you probably get the idea)
|
||||
* ...at this point the limitation is mostly the creativity than the capability (there might be edge cases and a need to support more form controls for user input off custom settings, but you probably get the idea)
|
||||
|
||||
If you wish to develop a plugin, please check the existing plugin structure. Once the settings are saved by the user they need to be removed from the `pialert.conf` file manually if you want to re-initialize them from the `config.json` of the plugin.
|
||||
|
||||
Again, please read the below carefully if you'd like to contribute with a plugin yourself. This documentation file might be outdated, so double check the sample plugins as well.
|
||||
Again, please read the below carefully if you'd like to contribute with a plugin yourself. This documentation file might be outdated, so double-check the sample plugins as well.
|
||||
|
||||
## ⚠ Disclaimer
|
||||
|
||||
Follow the below very carefully and check example plugin(s) if you'd like to write one yourself. Plugin UI is not my priority right now, happy to approve PRs if you are interested in extending/improving the UI experience. Example improvements for the taking:
|
||||
|
||||
* Making the tables sortable/filterable
|
||||
* Using the same approach to display table data as in the Devices section (solves above)
|
||||
* Adding form controls supported to display the data (Currently supported ones are listed in the section "UI settings in database_column_definitions" below)
|
||||
* ...
|
||||
|
||||
## ❗ Known issues:
|
||||
|
||||
These issues will be hopefully fixed with time, so please don't report them. Instead, if you know how, feel free to investigate and submit a PR to fix the below. Keep the PRs small as it's easier to approve them:
|
||||
|
||||
* Existing plugin objects sometimes not interpreted correctly and a new object is created instead, resulting in duplicate entries.
|
||||
* Occasional (experienced twice) hanging of processing plugin script file.
|
||||
UI displays outdated values until the API endpoints get refreshed.
|
||||
|
||||
## Plugin file structure overview
|
||||
|
||||
> Folder name must be the same as the code name value in: `"code_name": "<value>"`
|
||||
> Unique prefix needs to be unique compared to the other settings prefixes, e.g.: the prefix `APPRISE` is already in use.
|
||||
|
||||
| File | Required | Description |
|
||||
| File | Required (plugin type) | Description |
|
||||
|----------------------|----------------------|----------------------|
|
||||
| `config.json` | yes | Contains the plugin configuration (manifest) including the settings available to the user. |
|
||||
| `script.py` | yes (script) | The Python script itself |
|
||||
@@ -61,21 +95,21 @@ More on specifics below.
|
||||
|
||||
## Supported data sources
|
||||
|
||||
Currently only two data sources are supported:
|
||||
Currently, only 3 data sources are supported (valid `data_source` value).
|
||||
|
||||
- Script
|
||||
- SQL query on the PiAlert database
|
||||
- Script (`python-script`)
|
||||
- SQL query on the PiAlert database (`pialert-db-query`)
|
||||
- Template (`template`)
|
||||
|
||||
You need to set the `data_source` to either `pialert-db-query` or `python-script`:
|
||||
|
||||
```json
|
||||
"data_source": "pialert-db-query"
|
||||
```
|
||||
Any of the above datasources have to return a "table" of the exact structure as outlined above.
|
||||
> 🔎Example
|
||||
>```json
|
||||
>"data_source": "pialert-db-query"
|
||||
>```
|
||||
Any of the above data sources have to return a "table" of the exact structure as outlined above.
|
||||
|
||||
### "data_source": "python-script"
|
||||
|
||||
If the datasource is set to `python-script` the `CMD` setting (that you specify in the `settings` array section in the `config.json`) needs to contain a executable linux command, that generates a `last_result.log` file. This file needs to be stored in the same folder as the plugin.
|
||||
If the `data_source` is set to `python-script` the `CMD` setting (that you specify in the `settings` array section in the `config.json`) needs to contain an executable Linux command, that generates a `last_result.log` file. This file needs to be stored in the same folder as the plugin.
|
||||
|
||||
The content of the `last_result.log` file needs to contain the columns as defined in the "Column order and values" section above. The order of columns can't be changed. After every scan it should contain only the results from the latest scan/execution.
|
||||
|
||||
@@ -86,7 +120,11 @@ Any of the above datasources have to return a "table" of the exact structure as
|
||||
- You can find which "columns" need to be present, and if the value is required or optional, in the "Column order and values" section.
|
||||
- The order of these "columns" can't be changed.
|
||||
|
||||
#### Examples
|
||||
### 👍 Python script.py tips
|
||||
|
||||
The [Undicoverables plugins `script.py` file](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/undiscoverables/script.py) is a good and simple example to start with if you are considering creating a custom plugin. It uses the [`plugin_helper.py` library](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/plugin_helper.py) that significantly simplifies the creation of your custom script.
|
||||
|
||||
#### 🔎 last_result.log examples
|
||||
|
||||
Valid CSV:
|
||||
|
||||
@@ -113,50 +151,107 @@ https://www.google.com|null|2023-01-02 15:56:30|200|0.7898|
|
||||
|
||||
### "data_source": "pialert-db-query"
|
||||
|
||||
If the datasource is set to `pialert-db-query` the `CMD` setting needs to contain a SQL query rendering the columns as defined in the "Column order and values" section above. The order of columns is important.
|
||||
If the `data_source` is set to `pialert-db-query` the `CMD` setting needs to contain a SQL query rendering the columns as defined in the "Column order and values" section above. The order of columns is important.
|
||||
|
||||
#### Examples
|
||||
This SQL query is executed on the `pialert.db` SQLite database file.
|
||||
|
||||
SQL query example:
|
||||
> 🔎Example
|
||||
>
|
||||
> SQL query example:
|
||||
>
|
||||
> ```SQL
|
||||
> SELECT dv.dev_Name as Object_PrimaryID,
|
||||
> cast(dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID,
|
||||
> datetime() as DateTime,
|
||||
> ns.Service as Watched_Value1,
|
||||
> ns.State as Watched_Value2,
|
||||
> 'null' as Watched_Value3,
|
||||
> 'null' as Watched_Value4,
|
||||
> ns.Extra as Extra,
|
||||
> dv.dev_MAC as ForeignKey
|
||||
> FROM
|
||||
> (SELECT * FROM Nmap_Scan) ns
|
||||
> LEFT JOIN
|
||||
> (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv
|
||||
> ON ns.MAC = dv.dev_MAC
|
||||
> ```
|
||||
>
|
||||
> Required `CMD` setting example with above query (you can set `"type": "label"` if you want it to make uneditable in the UI):
|
||||
>
|
||||
> ```json
|
||||
> {
|
||||
> "function": "CMD",
|
||||
> "type": "text",
|
||||
> "default_value":"SELECT dv.dev_Name as Object_PrimaryID, cast(dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, 'null' as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
|
||||
> "options": [],
|
||||
> "localized": ["name", "description"],
|
||||
> "name" : [{
|
||||
> "language_code":"en_us",
|
||||
> "string" : "SQL to run"
|
||||
> }],
|
||||
> "description": [{
|
||||
> "language_code":"en_us",
|
||||
> "string" : "This SQL query is used to populate the coresponding UI tables under the Plugins section."
|
||||
> }]
|
||||
> }
|
||||
> ```
|
||||
|
||||
```SQL
|
||||
SELECT dv.dev_Name as Object_PrimaryID,
|
||||
cast(dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID,
|
||||
datetime() as DateTime,
|
||||
ns.Service as Watched_Value1,
|
||||
ns.State as Watched_Value2,
|
||||
'null' as Watched_Value3,
|
||||
'null' as Watched_Value4,
|
||||
ns.Extra as Extra,
|
||||
dv.dev_MAC as ForeignKey
|
||||
FROM
|
||||
(SELECT * FROM Nmap_Scan) ns
|
||||
LEFT JOIN
|
||||
(SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv
|
||||
ON ns.MAC = dv.dev_MAC
|
||||
### "data_source": "template"
|
||||
|
||||
Used to initialize internal settings. Check the `newdev_template` plugin for details.
|
||||
|
||||
## 🕳 Filters
|
||||
|
||||
Plugin entries can be filtered based on values entered into filter fields. The `txtMacFilter` textbox/field contains the Mac address of the currently viewed device or simply a Mac address that's available in the `mac` query string.
|
||||
|
||||
| Property | Required | Description |
|
||||
|----------------------|----------------------|----------------------|
|
||||
| `compare_column` | yes | Plugin column name that's value is used for comparison (**Left** side of the equation) |
|
||||
| `compare_operator` | yes | JavaScript comparison operator |
|
||||
| `compare_field_id` | yes | The `id` of a input text field containing a value is used for comparison (**Right** side of the equation)|
|
||||
| `compare_js_template` | yes | JavaScript code used to convert left and right side of the equation. `{value}` is replaced with input values. |
|
||||
| `compare_use_quotes` | yes | If `true` then the end result of the `compare_js_template` i swrapped in `"` quotes. Use to compare strings. |
|
||||
|
||||
|
||||
> 🔎Example:
|
||||
>
|
||||
> ```json
|
||||
> "data_filters": [
|
||||
> {
|
||||
> "compare_column" : "Object_PrimaryID",
|
||||
> "compare_operator" : "==",
|
||||
> "compare_field_id": "txtMacFilter",
|
||||
> "compare_js_template": "'{value}'.toString()",
|
||||
> "compare_use_quotes": true
|
||||
> }
|
||||
> ],
|
||||
> ```
|
||||
|
||||
1. On the `pluginsCore.php` page is an input field with the `txtMacFilter` id:
|
||||
|
||||
```html
|
||||
<input class="form-control" id="txtMacFilter" type="text" value="--">
|
||||
```
|
||||
|
||||
Required `CMD` setting example with above query (you can set `"type": "label"` if you want it to make uneditable in the UI):
|
||||
2. This input field is initialized via the `&mac=` query string.
|
||||
|
||||
```json
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value":"SELECT dv.dev_Name as Object_PrimaryID, cast(dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, 'null' as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "SQL to run"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "This SQL query is used to populate the coresponding UI tables under the Plugins section."
|
||||
}]
|
||||
}
|
||||
3. The app then proceeds to use this Mac value from this field and compares it to the value of the `Object_PrimaryID` database field. The `compare_operator` is `==`.
|
||||
|
||||
4. Both values, from the database field `Object_PrimaryID` and from the `txtMacFilter` are wrapped and evaluated with the `compare_js_template`, that is `'{value}.toString()'`.
|
||||
|
||||
5. `compare_use_quotes` is set to `true` so `'{value}'.toString()` is wrappe dinto `"` quotes.
|
||||
|
||||
6. This results in for example this code:
|
||||
|
||||
```javascript
|
||||
// left part of teh expression coming from compare_column and right from the input field
|
||||
// notice the added quotes ()") around the left and right part of teh expression
|
||||
"eval('ac:82:ac:82:ac:82".toString()')" == "eval('ac:82:ac:82:ac:82".toString()')"
|
||||
```
|
||||
|
||||
### Mapping the plugin results into a database table
|
||||
7. Filters are only applied if a filter is specified and the `txtMacFilter` is not `undefined` or empty (`--`).
|
||||
|
||||
### 🗺 Mapping the plugin results into a database table
|
||||
|
||||
PiAlert will take the results of the plugin execution and insert these results into a database table, if a plugin contains the property `"mapped_to_table"` in the `config.json` root. The mapping of the columns is defined in the `database_column_definitions` array.
|
||||
|
||||
@@ -200,13 +295,12 @@ This approach is used to implement the `DHCPLSS` plugin. The script parses all s
|
||||
|
||||
The `params` array in the `config.json` is used to enable the user to change the parameters of the executed script. For example, the user wants to monitor a specific URL.
|
||||
|
||||
##### Example:
|
||||
|
||||
Passing user defined settings to a command. Let's say, you want to have a script, that is called with a user-defined parameter called `urls`:
|
||||
|
||||
```bash
|
||||
root@server# python3 /home/pi/pialert/front/plugins/website_monitor/script.py urls=https://google.com,https://duck.com
|
||||
```
|
||||
> 🔎 Example:
|
||||
> Passing user-defined settings to a command. Let's say, you want to have a script, that is called with a user-defined parameter called `urls`:
|
||||
>
|
||||
> ```bash
|
||||
> root@server# python3 /home/pi/pialert/front/plugins/website_monitor/script.py urls=https://google.com,https://duck.com
|
||||
> ```
|
||||
|
||||
* You can allow the user to add URLs to a setting with the `function` property set to a custom name, such as `urls_to_check` (this is not a reserved name from the section "Supported settings `function` values" below).
|
||||
* You specify the parameter `urls` in the `params` section of the `config.json` the following way (`WEBMON_` is the plugin prefix automatically added to all the settings):
|
||||
@@ -256,42 +350,42 @@ During script execution, the app will take the command `"python3 /home/pi/pialer
|
||||
- to
|
||||
- `python3 /home/pi/pialert/front/plugins/website_monitor/script.py urls=https://google.com,https://duck.com`
|
||||
|
||||
Below are some general additional notes, when definig `params`:
|
||||
Below are some general additional notes, when defining `params`:
|
||||
|
||||
- `"name":"name_value"` - is used as a wildcard replacement in the `CMD` setting value by using curly brackets `{name_value}`. The wildcard is replaced by the result of the `"value" : "param_value"` and `"type":"type_value"` combo configuration below.
|
||||
- `"type":"<sql|setting>"` - is used to specify the type of the params, currently only 2 supported (`sql`,`setting`).
|
||||
- `"type":"sql"` - will execute the SQL query specified in the `value` property. The sql query needs to return only one column. The column is flattened and separated by commas (`,`), e.g: `SELECT dev_MAC from DEVICES` -> `Internet,74:ac:74:ac:74:ac,44:44:74:ac:74:ac`. This is then used to replace the wildcards in the `CMD` setting.
|
||||
- `"type":"setting"` - The setting code name. A combination of the value from `unique_prefix` + `_` + `function` value, or otherwise the code name you can find in the Settings page under the Setting dispaly name, e.g. `SCAN_CYCLE_MINUTES`.
|
||||
- `"value" : "param_value"` - Needs to contain a setting code name or sql query without wildcards.
|
||||
- `"type":"setting"` - The setting code name. A combination of the value from `unique_prefix` + `_` + `function` value, or otherwise the code name you can find in the Settings page under the Setting display name, e.g. `SCAN_CYCLE_MINUTES`.
|
||||
- `"value" : "param_value"` - Needs to contain a setting code name or SQL query without wildcards.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"params" : [{
|
||||
"name" : "macs",
|
||||
"type" : "sql",
|
||||
"value" : "SELECT dev_MAC from DEVICES"
|
||||
},
|
||||
{
|
||||
"name" : "urls",
|
||||
"type" : "setting",
|
||||
"value" : "WEBMON_urls_to_check"
|
||||
},
|
||||
{
|
||||
"name" : "internet_ip",
|
||||
"type" : "setting",
|
||||
"value" : "WEBMON_SQL_internet_ip"
|
||||
}]
|
||||
}
|
||||
```
|
||||
> 🔎Example:
|
||||
>
|
||||
> ```json
|
||||
> {
|
||||
> "params" : [{
|
||||
> "name" : "macs",
|
||||
> "type" : "sql",
|
||||
> "value" : "SELECT dev_MAC from DEVICES"
|
||||
> },
|
||||
> {
|
||||
> "name" : "urls",
|
||||
> "type" : "setting",
|
||||
> "value" : "WEBMON_urls_to_check"
|
||||
> },
|
||||
> {
|
||||
> "name" : "internet_ip",
|
||||
> "type" : "setting",
|
||||
> "value" : "WEBMON_SQL_internet_ip"
|
||||
> }]
|
||||
> }
|
||||
> ```
|
||||
|
||||
|
||||
#### Setting object struncture
|
||||
#### Setting object structure
|
||||
|
||||
- `"function": "<see Supported settings function values>"` - What function the setting drives or a simple unique code name
|
||||
- `"type": "<text|integer|boolean|password|readonly|selectinteger|selecttext|multiselect|list>"` - The form control used for the setting displayed in the Settings page and what values are accepted.
|
||||
- `"type": "<text|integer|boolean|password|readonly|integer.select|text.select|text.multiselect|list|integer.checkbox>"` - The form control used for the setting displayed in the Settings page and what values are accepted.
|
||||
- `"localized"` - a list of properties on the current JSON level which need to be localized
|
||||
- `"name"` and `"description"` - Displayed in the Settings page. An array of localized strings. (see Localized strings below).
|
||||
|
||||
@@ -312,54 +406,57 @@ You can have any `"function": "my_custom_name"` custom name, however, the ones l
|
||||
- `watched-not-changed` - reports even on events where selected `Watched_ValueN` did not change
|
||||
|
||||
|
||||
Example:
|
||||
> 🔎 Example:
|
||||
>
|
||||
> ```json
|
||||
> {
|
||||
> "function": "RUN",
|
||||
> "type": "text.select",
|
||||
> "default_value":"disabled",
|
||||
> "options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
> "localized": ["name", "description"],
|
||||
> "name" :[{
|
||||
> "language_code":"en_us",
|
||||
> "string" : "When to run"
|
||||
> }],
|
||||
> "description": [{
|
||||
> "language_code":"en_us",
|
||||
> "string" : "Enable a regular scan of your services. If you select <code>schedule</code> the scheduling settings from below are applied. If you select <code>once</code> the scan is run only once on start of the application (container) for the time specified in <a href=\"#WEBMON_RUN_TIMEOUT\"><code>WEBMON_RUN_TIMEOUT</code> setting</a>."
|
||||
> }]
|
||||
> }
|
||||
> ```
|
||||
|
||||
```json
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "selecttext",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
"localized": ["name", "description"],
|
||||
"name" :[{
|
||||
"language_code":"en_us",
|
||||
"string" : "When to run"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Enable a regular scan of your services. If you select <code>schedule</code> the scheduling settings from below are applied. If you select <code>once</code> the scan is run only once on start of the application (container) for the time specified in <a href=\"#WEBMON_RUN_TIMEOUT\"><code>WEBMON_RUN_TIMEOUT</code> setting</a>."
|
||||
}]
|
||||
}
|
||||
```
|
||||
##### Localized strings
|
||||
##### 🌍Localized strings
|
||||
|
||||
- `"language_code":"<en_us|es_es|de_de>"` - code name of the language string. Only these three currently supported. At least the `"language_code":"en_us"` variant has to be defined.
|
||||
- `"language_code":"<en_us|es_es|de_de>"` - code name of the language string. Only these three are currently supported. At least the `"language_code":"en_us"` variant has to be defined.
|
||||
- `"string"` - The string to be displayed in the given language.
|
||||
|
||||
Example:
|
||||
> 🔎 Example:
|
||||
>
|
||||
> ```json
|
||||
>
|
||||
> {
|
||||
> "language_code":"en_us",
|
||||
> "string" : "When to run"
|
||||
> }
|
||||
>
|
||||
> ```
|
||||
|
||||
```json
|
||||
|
||||
{
|
||||
"language_code":"en_us",
|
||||
"string" : "When to run"
|
||||
}
|
||||
|
||||
```
|
||||
##### UI settings in database_column_definitions
|
||||
|
||||
The UI will adjust how columns are displayed in the UI based on the definition of the `database_column_definitions` object. Thease are the supported form controls and related functionality:
|
||||
The UI will adjust how columns are displayed in the UI based on the definition of the `database_column_definitions` object. These are the supported form controls and related functionality:
|
||||
|
||||
- Only columns with `"show": true` and also with at least an English translation will be shown in the UI.
|
||||
- Supported types: `label`, `text`, `threshold`, `replace`
|
||||
- Supported types: `label`, `text`, `threshold`, `replace`, `deviceip`, `devicemac`, `url`. Check for details below, how columns behave based on the type.
|
||||
- `label` makes a column display only
|
||||
- `text` makes a column editable
|
||||
- `text` makes a column editable and a save icon is displayed next to it.
|
||||
- See below for information on `threshold`, `replace`
|
||||
- The `options` property is used in conjunction with these types:
|
||||
- `threshold` - The `options` array contains objects from lowest `maximum` to highest with corresponding `hexColor` used for the value background color if it's less than the specified `maximum`, but more than the previous one in the `options` array
|
||||
- `replace` - The `options` array contains objects with an `equals` property, that is compared to the "value" and if the values are the same, the string in `replacement` is displayed in the UI instead of the actual "value"
|
||||
- `devicemac` - The value is considered to be a mac adress and a link pointing to the device with the given mac address is generated.
|
||||
- `url` - The value is considered to be a url so a link is generated.
|
||||
- `devicemac` - The value is considered to be a Mac address and a link pointing to the device with the given Mac address is generated.
|
||||
- `deviceip` - The value is considered to be an IP address and a link pointing to the device with the given IP is generated. The IP is checked against the last detected IP addresses and translated into a Mac address that is then used for the link itself.
|
||||
- `url` - The value is considered to be a URL so a link is generated.
|
||||
|
||||
|
||||
```json
|
||||
@@ -424,23 +521,7 @@ The UI will adjust how columns are displayed in the UI based on the definition o
|
||||
}
|
||||
```
|
||||
|
||||
## Full Examples
|
||||
|
||||
### Script based plugins
|
||||
|
||||
- [website_monitor (WEBMON) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/website_monitor/config.json)
|
||||
- [dhcp_servers (DHCPSRVS) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/dhcp_servers/config.json)
|
||||
- [dhcp_leases (DHCPLSS) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/dhcp_leases/config.json)
|
||||
- [unifi_import (UNFIMP) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/unifi_import/config.json)
|
||||
|
||||
### SQL query based plugins
|
||||
- [nmap_services (NMAPSERV) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/nmap_services/config.json)
|
||||
|
||||
### Screenshots
|
||||
|
||||
| ![Screen 1][screen1] | ![Screen 2][screen2] |
|
||||
|----------------------|----------------------|
|
||||
| ![Screen 3][screen3] | ![Screen 4][screen4] |
|
||||
|
||||
[screen1]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins.png "Screen 1"
|
||||
[screen2]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins_settings.png "Screen 2"
|
||||
|
||||
@@ -29,4 +29,25 @@ DHCPLSS_paths_to_check = ['/mnt/dhcp1.leases','/mnt/dhcp2.leases']
|
||||
|
||||
### Notes
|
||||
|
||||
- No specific configuration needed.
|
||||
- No specific configuration needed.
|
||||
|
||||
- This plugin expects the dhcp.leases file(s) to be in the format of **dhcpd.leases** that is different to the format that PiHole uses.
|
||||
[dhcpd.leases(5) - Linux man page]( https://linux.die.net/man/5/dhcpd.leases#:~:text=This%20database%20is%20a%20free,file%20is%20the%20current%20one.)
|
||||
|
||||
Example File Format: _(not all lines are required)_
|
||||
|
||||
```
|
||||
lease 192.168.79.15 {
|
||||
starts 0 2016/08/21 13:25:45;
|
||||
ends 0 2016/08/21 19:25:45;
|
||||
cltt 0 2016/08/21 13:25:45;
|
||||
binding state active;
|
||||
next binding state free;
|
||||
rewind binding state free;
|
||||
hardware ethernet 8c:1a:bf:11:00:ea;
|
||||
uid "\001\214\032\277\021\000\352";
|
||||
option agent.circuit-id 0:17;
|
||||
option agent.remote-id c0:a8:9:5;
|
||||
client-hostname "android-8182e21c852776e7";
|
||||
}
|
||||
```
|
||||
|
||||
@@ -3,6 +3,15 @@
|
||||
"unique_prefix": "DHCPLSS",
|
||||
"enabled": true,
|
||||
"data_source": "python-script",
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "Object_PrimaryID",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_template": "'{value}'.toString()",
|
||||
"compare_use_quotes": true
|
||||
}
|
||||
],
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"mapped_to_table": "DHCP_Leases",
|
||||
"display_name" : [{
|
||||
@@ -215,7 +224,7 @@
|
||||
"settings":[
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "selecttext",
|
||||
"type": "text.select",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -294,7 +303,7 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["Watched_Value1", "Watched_Value4"],
|
||||
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -309,7 +318,7 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["new","watched-changed"],
|
||||
"options": ["new","watched-changed","watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
"settings":[
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "selecttext",
|
||||
"type": "text.select",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -269,7 +269,7 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["Watched_Value1"],
|
||||
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -284,7 +284,7 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["new","watched-changed"],
|
||||
"options": ["new","watched-changed","watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
11
front/plugins/newdev_template/README.md
Executable file
@@ -0,0 +1,11 @@
|
||||
## Overview
|
||||
|
||||
A simple template-based plugin for new devices. You can change the default values for newly detected devices.
|
||||
|
||||
### Usage
|
||||
|
||||
- Head to **Settings** > **New Devices** to adjust the default values.
|
||||
|
||||
### Notes
|
||||
|
||||
- This plugin generates editable settings that are then used in the `device.py` script to initialize new values.
|
||||
535
front/plugins/newdev_template/config.json
Executable file
@@ -0,0 +1,535 @@
|
||||
{
|
||||
"code_name": "Devices.new",
|
||||
"template_type": "database-entry",
|
||||
"unique_prefix": "NEWDEV",
|
||||
"enabled": true,
|
||||
"data_source": "template",
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"display_name": [{
|
||||
"language_code": "en_us",
|
||||
"string": "New Devices"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code": "en_us",
|
||||
"string": "The template used for new devices."
|
||||
}],
|
||||
"icon": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "<i class=\"fa fa-plus\"></i>"
|
||||
}
|
||||
],
|
||||
"settings":[
|
||||
{
|
||||
"function": "dev_MAC",
|
||||
"type": "readonly",
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device MAC"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The MAC address of the device. Uneditable - Autodetected."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Name",
|
||||
"type": "readonly",
|
||||
"maxLength": 50,
|
||||
"default_value": "(unknown)",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Name"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The name of the device. Uneditable as internal functionality is dependent on specific new device names."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Owner",
|
||||
"type": "string",
|
||||
"maxLength": 30,
|
||||
"default_value": "House",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Owner"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The owner of the device."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_DeviceType",
|
||||
"type": "string",
|
||||
"maxLength": 30,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Type"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The type of the device."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Vendor",
|
||||
"type": "readonly",
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Vendor"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The vendor of the device. Uneditable - Autodetected."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Favorite",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Favorite Device"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether the device is marked as a favorite."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Group",
|
||||
"type": "string",
|
||||
"maxLength": 10,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Group"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The group to which the device belongs."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Comments",
|
||||
"type": "string",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Comments"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Additional comments or notes about the device."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_FirstConnection",
|
||||
"type": "readonly",
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "First Connection"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The date and time of the first connection with the device. Uneditable - Autodetected."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_LastConnection",
|
||||
"type": "readonly",
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Last Connection"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The date and time of the last connection with the device. Uneditable - Autodetected."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_LastIP",
|
||||
"type": "readonly",
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Last IP"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The last known IP address of the device. Uneditable - Autodetected."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_StaticIP",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Static IP"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether the device has a static IP address."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_ScanCycle",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Scan Cycle"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The default value of the <code>Scan device</code> dropdown. Enable if newly discovered devices should be scanned."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_LogEvents",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Log Events"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether events related to the device shouldbe logged."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertEvents",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Alert Events"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether events related to the device should trigger alerts. The default value of the <code>Alert All Events</code> checkbox."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertDeviceDown",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Alert Device Down"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether an alert should be triggered when the device goes down. The default value of the <code>Alert Down</code> checkbox."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_SkipRepeated",
|
||||
"type": "integer",
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Skip Repeated"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The default value of the <code>Skip repeated notifications for</code> dropdown. Enter number of <b>hours</b> for which repeated notifications should be ignored for. If you enter <code>0</code> then you get notified on all events."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_LastNotification",
|
||||
"type": "readonly",
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Last Notification"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The date and time of the last notification sent for the device. Uneditable - Autodetected."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_PresentLastScan",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Present Last Scan"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether the device should be marked as present after detected in a scan."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_NewDevice",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": true,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "New Device"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether the device is considered a new device. The default value of the <code>New Device</code> checkbox."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Location",
|
||||
"type": "string",
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Location"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The location of the device."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Archived",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Archived"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Indicates whether the device is archived. The default value of the <code>Archived</code> checkbox."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_MAC_ADDR",
|
||||
"type": "string",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Network Node MAC Address"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The MAC address of the network node."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_port",
|
||||
"type": "readonly",
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Network Node Port"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The port number of the network node. Uneditable."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_Icon",
|
||||
"type": "string",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Device Icon"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The icon associated with the device. Check the <a href=\"https://github.com/jokob-sk/Pi.Alert/blob/main/docs/ICONS.md\" target=\"_blank\">documentation on icons</a> for more details."
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"required": [
|
||||
"dev_MAC",
|
||||
"dev_Name",
|
||||
"dev_Owner",
|
||||
"dev_FirstConnection",
|
||||
"dev_LastConnection",
|
||||
"dev_LastIP",
|
||||
"dev_StaticIP",
|
||||
"dev_ScanCycle",
|
||||
"dev_LogEvents",
|
||||
"dev_AlertEvents",
|
||||
"dev_AlertDeviceDown",
|
||||
"dev_SkipRepeated",
|
||||
"dev_LastNotification",
|
||||
"dev_PresentLastScan",
|
||||
"dev_NewDevice",
|
||||
"dev_Location",
|
||||
"dev_Archived",
|
||||
"dev_Network_Node_MAC_ADDR",
|
||||
"dev_Network_Node_port",
|
||||
"dev_Icon"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,15 @@
|
||||
"unique_prefix": "NMAPSRV",
|
||||
"enabled": true,
|
||||
"data_source": "pialert-db-query",
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "ForeignKey",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_template": "'{value}.toString()'",
|
||||
"compare_use_quotes": true
|
||||
}
|
||||
],
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"display_name" : [{
|
||||
"language_code":"en_us",
|
||||
@@ -204,7 +213,7 @@
|
||||
"settings":[
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "selecttext",
|
||||
"type": "text.select",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -220,7 +229,7 @@
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value":"SELECT dv.dev_Name as Object_PrimaryID, cast('http://' || dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, 'null' as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra, dv.dev_MAC as ForeignKey FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
|
||||
"default_value":"SELECT ns.MAC as Object_PrimaryID, cast('http://' || dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, dv.dev_Name as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra, ns.MAC as ForeignKey FROM (SELECT * FROM Nmap_Scan) ns left JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
@@ -249,7 +258,7 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["Watched_Value1"],
|
||||
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -264,7 +273,7 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["new","watched-changed"],
|
||||
"options": ["new","watched-changed","watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
96
front/plugins/plugin_helper.py
Executable file
@@ -0,0 +1,96 @@
|
||||
from time import strftime
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
class Plugin_Object:
|
||||
"""
|
||||
Plugin_Object class to manage one object introduced by the plugin
|
||||
An object typically is a device but could also be a website or something
|
||||
else that is monitored by the plugin.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
primaryId="",
|
||||
secondaryId="",
|
||||
watched1="",
|
||||
watched2="",
|
||||
watched3="",
|
||||
watched4="",
|
||||
extra="",
|
||||
foreignKey="",
|
||||
):
|
||||
self.pluginPref = ""
|
||||
self.primaryId = primaryId
|
||||
self.secondaryId = secondaryId
|
||||
self.created = strftime("%Y-%m-%d %H:%M:%S")
|
||||
self.changed = ""
|
||||
self.watched1 = watched1
|
||||
self.watched2 = watched2
|
||||
self.watched3 = watched3
|
||||
self.watched4 = watched4
|
||||
self.status = ""
|
||||
self.extra = extra
|
||||
self.userData = ""
|
||||
self.foreignKey = foreignKey
|
||||
|
||||
def write(self):
|
||||
"""
|
||||
write the object details as a string in the
|
||||
format required to write the result file
|
||||
"""
|
||||
line = "{}|{}|{}|{}|{}|{}|{}|{}|{}\n".format(
|
||||
self.primaryId,
|
||||
self.secondaryId,
|
||||
self.created,
|
||||
self.watched1,
|
||||
self.watched2,
|
||||
self.watched3,
|
||||
self.watched4,
|
||||
self.extra,
|
||||
self.foreignKey,
|
||||
)
|
||||
return line
|
||||
|
||||
|
||||
class Plugin_Objects:
|
||||
"""
|
||||
Plugin_Objects is the class that manages and holds all the objects created by the plugin.
|
||||
It contains a list of Plugin_Object instances.
|
||||
And can write the required result file.
|
||||
"""
|
||||
|
||||
def __init__(self, result_file):
|
||||
self.result_file = result_file
|
||||
self.objects = []
|
||||
|
||||
def add_object(
|
||||
self,
|
||||
primaryId="",
|
||||
secondaryId="",
|
||||
watched1="",
|
||||
watched2="",
|
||||
watched3="",
|
||||
watched4="",
|
||||
extra="",
|
||||
foreignKey="",
|
||||
):
|
||||
self.objects.append(
|
||||
Plugin_Object(
|
||||
primaryId,
|
||||
secondaryId,
|
||||
watched1,
|
||||
watched2,
|
||||
watched3,
|
||||
watched4,
|
||||
extra,
|
||||
foreignKey,
|
||||
)
|
||||
)
|
||||
|
||||
def write_result_file(self):
|
||||
# print ("writing file: "+self.result_file)
|
||||
with open(self.result_file, mode="w") as fp:
|
||||
for obj in self.objects:
|
||||
fp.write(obj.write())
|
||||
fp.close()
|
||||
39
front/plugins/snmp_discovery/README.md
Executable file
@@ -0,0 +1,39 @@
|
||||
## Overview
|
||||
|
||||
A plugin for importing devices from an SNMP enabled router or switch. Using SNMP offers an efficient way to discover IPv4 devices across one or more networks/subnets/vlans.
|
||||
|
||||
### Usage
|
||||
|
||||
Specify the following settings in the Settings section of PiAlert:
|
||||
|
||||
- `SNMPDSC_routers` - A list of `snmpwalk` commands to execute against IP addresses of roputers/switches with SNMP turned on. For example:
|
||||
|
||||
- `snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2`
|
||||
- `snmpwalk -v 2c -c public -Oxsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2` (note: lower case `x`)
|
||||
|
||||
|
||||
### Setup Cisco IOS
|
||||
|
||||
Enable IOS SNMP service and restrict to selected (internal) IP/Subnet.
|
||||
|
||||
````
|
||||
! Add standard ip access-list 10
|
||||
ip access-list standard 10
|
||||
permit 192.168.1.0 0.0.0.255
|
||||
permit host 192.168.2.10
|
||||
!
|
||||
! Enable IOS snmp server with Read Only community 'mysnmpcommunitysecret' name.
|
||||
! Restrict connections to access-list 10
|
||||
snmp-server community mysnmpcommunitysecret RO 10
|
||||
````
|
||||
|
||||
Confirm SNMP enabled
|
||||
````
|
||||
show snmp
|
||||
````
|
||||
|
||||
### Notes
|
||||
|
||||
- Only IPv4 supported.
|
||||
- The SNMP OID `.1.1.1.3.6.1.2.1.3.1.1.2` is specifically for devices IPv4 ARP table. This OID has been tested on Cisco ISRs and other L3 devices. Support may vary between other vendors / devices.
|
||||
- Expected output (ingestion) in format `iso.3.6.1.2.1.3.1.1.2.3.1.192.168.1.2 "6C 6C 6C 6C 6C 6C "`.
|
||||
337
front/plugins/snmp_discovery/config.json
Executable file
@@ -0,0 +1,337 @@
|
||||
{
|
||||
"code_name": "snmp_discovery",
|
||||
"unique_prefix": "SNMPDSC",
|
||||
"enabled": true,
|
||||
"data_source": "pyton-script",
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "Object_PrimaryID",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_template": "'{value}'.toString()",
|
||||
"compare_use_quotes": true
|
||||
}
|
||||
],
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"mapped_to_table": "DHCP_Leases",
|
||||
"display_name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "SNMP discovery"
|
||||
}],
|
||||
"icon":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "<i class=\"fa-solid fa-s\"></i>"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "This plugin is used to discover devices via the arp table(s) of a RFC1213 compliant router or switch."
|
||||
}],
|
||||
"params" : [
|
||||
{
|
||||
"name" : "routers",
|
||||
"type" : "setting",
|
||||
"value" : "SNMPDSC_routers"
|
||||
}
|
||||
],
|
||||
"database_column_definitions":
|
||||
[
|
||||
{
|
||||
"column": "Index",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "N/A"
|
||||
}]
|
||||
} ,
|
||||
{
|
||||
"column": "Plugin",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "N/A"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Object_PrimaryID",
|
||||
"mapped_to_column": "DHCP_MAC",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "devicemac",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "MAC address"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Object_SecondaryID",
|
||||
"mapped_to_column": "DHCP_IP",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "deviceip",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "IP"
|
||||
}]
|
||||
} ,
|
||||
{
|
||||
"column": "DateTimeCreated",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Created"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "DateTimeChanged",
|
||||
"mapped_to_column": "DHCP_DateTime",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Changed"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value1",
|
||||
"mapped_to_column": "DHCP_Name",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"(unknown)",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Hostname"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value2",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Router IP"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value3",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Type"
|
||||
}]
|
||||
} ,
|
||||
{
|
||||
"column": "Watched_Value4",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Network"
|
||||
}]
|
||||
} ,
|
||||
{
|
||||
"column": "UserData",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "textboxsave",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Comments"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Extra",
|
||||
"css_classes": "col-sm-3",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "RAW output"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Status",
|
||||
"css_classes": "col-sm-1",
|
||||
"show": true,
|
||||
"type": "replace",
|
||||
"default_value":"",
|
||||
"options": [
|
||||
{
|
||||
"equals": "watched-not-changed",
|
||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-square-check'></i><div></div>"
|
||||
},
|
||||
{
|
||||
"equals": "watched-changed",
|
||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-triangle-exclamation'></i></div>"
|
||||
},
|
||||
{
|
||||
"equals": "new",
|
||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-circle-plus'></i></div>"
|
||||
}
|
||||
],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Status"
|
||||
}]
|
||||
}
|
||||
],
|
||||
"settings":[
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "text.select",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
"localized": ["name", "description"],
|
||||
"name" :[{
|
||||
"language_code":"en_us",
|
||||
"string" : "When to run"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Enable import of devices from a SNMP enabled device. If you select <code>schedule</code> the scheduling settings from below are applied. If you select <code>once</code> the scan is run only once on start of the application (container) or after you update your settings."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value":"python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers={s-quote}{routers}{s-quote}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Command"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Command to run. Not recommended to change."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "routers",
|
||||
"type": "list",
|
||||
"default_value":["snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2"],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Routers"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "A list of <code>snmpwalk</code> commands to execute against IP addresses of roputers/switches with SNMP turned on. <br/> <br/> Example with the router on the IP <code>192.168.1.1</code>: <br/> <code>snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2</code> <br/><br/> Only IPv4 supported. Authentication is not supported. More info on the plugin <a href='https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/snmp_discovery' target='_blank'>here</a>."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"default_value":"0 2 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Schedule"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Only enabled if you select <code>schedule</code> in the <a href=\"#SNMPDSC_RUN\"><code>SNMPDSC_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"default_value":5,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Run timeout"
|
||||
},
|
||||
{
|
||||
"language_code":"de_de",
|
||||
"string" : "Wartezeit"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["Watched_Value1"],
|
||||
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
||||
"localized": ["name", "description"],
|
||||
"name" :[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Watched"
|
||||
}] ,
|
||||
"description":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Hostname (not discoverable) </li><li><code>Watched_Value2</code> is Router IP </li><li><code>Watched_Value3</code> is not used </li><li><code>Watched_Value4</code> is not used </li></ul>"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["new","watched-changed"],
|
||||
"options": ["new","watched-changed","watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
"name" :[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Report on"
|
||||
}] ,
|
||||
"description":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed."
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
172
front/plugins/snmp_discovery/script.py
Executable file
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Example call
|
||||
# python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers='snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2'
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from time import sleep, time, strftime
|
||||
import requests
|
||||
from requests import Request, Session, packages
|
||||
import pathlib
|
||||
import threading
|
||||
import subprocess
|
||||
import socket
|
||||
import json
|
||||
import argparse
|
||||
import io
|
||||
import sys
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
import pwd
|
||||
import os
|
||||
|
||||
|
||||
curPath = str(pathlib.Path(__file__).parent.resolve())
|
||||
log_file = curPath + '/script.log'
|
||||
last_run = curPath + '/last_result.log'
|
||||
|
||||
# Workflow
|
||||
|
||||
def main():
|
||||
|
||||
# init global variables
|
||||
global ROUTERS
|
||||
|
||||
# empty file
|
||||
open(last_run , 'w').close()
|
||||
|
||||
last_run_logfile = open(last_run, 'a')
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='This plugin is used to discover devices via the arp table(s) of a RFC1213 compliant router or switch.')
|
||||
|
||||
parser.add_argument('routers', action="store", help="IP(s) of routers, separated by comma (,) if passing multiple")
|
||||
|
||||
values = parser.parse_args()
|
||||
|
||||
# parse output
|
||||
newEntries = []
|
||||
|
||||
if values.routers:
|
||||
|
||||
ROUTERS = values.routers.split('=')[1].replace('\'','')
|
||||
|
||||
newEntries = get_entries(newEntries)
|
||||
|
||||
for e in newEntries:
|
||||
# Insert list into the log
|
||||
service_monitoring_log(e.primaryId, e.secondaryId, e.created, e.watched1, e.watched2, e.watched3, e.watched4, e.extra, e.foreignKey )
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def get_entries(newEntries):
|
||||
|
||||
routers = []
|
||||
|
||||
if ',' in ROUTERS:
|
||||
# multiple
|
||||
routers = ROUTERS.split(',')
|
||||
|
||||
else:
|
||||
# only one
|
||||
routers.append(ROUTERS)
|
||||
|
||||
for router in routers:
|
||||
# snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2
|
||||
|
||||
print(router)
|
||||
|
||||
timeoutSec = 10
|
||||
|
||||
snmpwalkArgs = router.split(' ')
|
||||
|
||||
# Execute N probes and insert in list
|
||||
probes = 1 # N probes
|
||||
newLines = []
|
||||
for _ in range(probes):
|
||||
output = subprocess.check_output (snmpwalkArgs, universal_newlines=True, stderr=subprocess.STDOUT, timeout=(timeoutSec ))
|
||||
newLines = newLines + output.split("\n")
|
||||
|
||||
# Process outputs
|
||||
# Sample: iso.3.6.1.2.1.3.1.1.2.3.1.192.168.1.2 "6C 6C 6C 6C 6C 6C "
|
||||
|
||||
with open(log_file, 'a') as run_logfile:
|
||||
for line in newLines:
|
||||
|
||||
# debug
|
||||
run_logfile.write(line)
|
||||
|
||||
tmpSplt = line.split('"')
|
||||
|
||||
if len(tmpSplt) == 3:
|
||||
ipStr = tmpSplt[0].split('.')[-4:] # Get the last 4 elements to extract the IP
|
||||
macStr = tmpSplt[1].strip().split(' ') # Remove leading/trailing spaces from MAC
|
||||
|
||||
if 'iso.' in line and len(ipStr) == 4:
|
||||
macAddress = ':'.join(macStr)
|
||||
ipAddress = '.'.join(ipStr)
|
||||
|
||||
tmpEntry = plugin_object_class(
|
||||
macAddress,
|
||||
ipAddress,
|
||||
watched1='(unknown)',
|
||||
watched2=snmpwalkArgs[6], # router IP
|
||||
extra=line
|
||||
)
|
||||
newEntries.append(tmpEntry)
|
||||
|
||||
return newEntries
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
class plugin_object_class:
|
||||
def __init__(self, primaryId = '',secondaryId = '', watched1 = '',watched2 = '',watched3 = '',watched4 = '',extra = '',foreignKey = ''):
|
||||
self.pluginPref = ''
|
||||
self.primaryId = primaryId
|
||||
self.secondaryId = secondaryId
|
||||
self.created = strftime("%Y-%m-%d %H:%M:%S")
|
||||
self.changed = ''
|
||||
self.watched1 = watched1
|
||||
self.watched2 = watched2
|
||||
self.watched3 = watched3
|
||||
self.watched4 = watched4
|
||||
self.status = ''
|
||||
self.extra = extra
|
||||
self.userData = ''
|
||||
self.foreignKey = foreignKey
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def service_monitoring_log(primaryId, secondaryId, created, watched1, watched2 = 'null', watched3 = 'null', watched4 = 'null', extra ='null', foreignKey ='null' ):
|
||||
|
||||
if watched1 == '':
|
||||
watched1 = 'null'
|
||||
if watched2 == '':
|
||||
watched2 = 'null'
|
||||
if watched3 == '':
|
||||
watched3 = 'null'
|
||||
if watched4 == '':
|
||||
watched4 = 'null'
|
||||
if extra == '':
|
||||
extra = 'null'
|
||||
if foreignKey == '':
|
||||
foreignKey = 'null'
|
||||
|
||||
with open(last_run, 'a') as last_run_logfile:
|
||||
last_run_logfile.write("{}|{}|{}|{}|{}|{}|{}|{}|{}\n".format(
|
||||
primaryId,
|
||||
secondaryId,
|
||||
created,
|
||||
watched1,
|
||||
watched2,
|
||||
watched3,
|
||||
watched4,
|
||||
extra,
|
||||
foreignKey
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# BEGIN
|
||||
#===============================================================================
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
27
front/plugins/undiscoverables/README.md
Executable file
@@ -0,0 +1,27 @@
|
||||
## Overview
|
||||
|
||||
A plugin allowing for importing Un-Discoverable devices from the settings page.
|
||||
The main usecase is to add dumb network gear like unmanaged hubs and switches to the network view.
|
||||
There might be other usecases, please let me know.
|
||||
|
||||
### Usage
|
||||
|
||||
- Go to settings and find Un-Discoverabe Devices in the list of plugins.
|
||||
- Enable the plugin by changing the RUN parameter from disabled to `once` or `always_after_scan`.
|
||||
- Add the name of your device to the list. (remove the sample entry first)
|
||||
- SAVE
|
||||
- wait for the next scan to finish
|
||||
|
||||
#### Examples:
|
||||
Settings:
|
||||

|
||||
|
||||
resulting in these devices:
|
||||

|
||||
|
||||
Allowing Un-Discoverable devices like hubs, switches or APs to be added to the network view.
|
||||

|
||||
|
||||
### Known Limitations
|
||||
- Un-Discoverable Devices always show as offline. That is expected as they can not be discovered by Pi.Alert.
|
||||
- All IPs are set to 0.0.0.0 therefore the "Random MAC" icon might show up.
|
||||
217
front/plugins/undiscoverables/config.json
Executable file
@@ -0,0 +1,217 @@
|
||||
{
|
||||
"code_name": "undiscoverables",
|
||||
"unique_prefix": "UNDIS",
|
||||
"enabled": true,
|
||||
"data_source": "python-script",
|
||||
"mapped_to_table": "DHCP_Leases",
|
||||
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
|
||||
"display_name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Un-Discoverable Devices"
|
||||
}
|
||||
],
|
||||
"icon": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "<i class=\"fa-solid fa-binoculars\"></i>"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "This plugin is to import undiscoverable devices from a file."
|
||||
}
|
||||
],
|
||||
"params" : [
|
||||
{
|
||||
"name" : "devices",
|
||||
"type" : "setting",
|
||||
"value" : "UNDIS_devices_to_import"
|
||||
}],
|
||||
|
||||
"settings": [
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "text.select",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
"name" :[{
|
||||
"language_code":"en_us",
|
||||
"string" : "When to run"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "When enabled, ONCE is the preferred option. It runs at startup and after every save of the config here.<br> Changes will only show in the devices <b> after the next scan!</b>"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value": "python3 /home/pi/pialert/front/plugins/undiscoverables/script.py devices={devices}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Command"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Command to run. This can not be changed"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Run timeout"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "lable",
|
||||
"default_value": [],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Watched"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Undiscoverable Devices can not change their status, no watch is enabled."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "lable",
|
||||
"default_value": [],
|
||||
"options": ["new", "watched-changed", "watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Report on"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "No notifications will be sent."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "devices_to_import",
|
||||
"type": "list",
|
||||
"default_value":["dummy_router"],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "UnDiscoverable Devices"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Devices to be added to the devices list."
|
||||
}]
|
||||
}
|
||||
],
|
||||
|
||||
"database_column_definitions":
|
||||
[
|
||||
{
|
||||
"column": "Watched_Value1",
|
||||
"mapped_to_column": "DHCP_Name",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Device Name"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Object_PrimaryID",
|
||||
"mapped_to_column": "DHCP_MAC",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "devicemac",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "MAC address"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Object_SecondaryID",
|
||||
"mapped_to_column": "DHCP_IP",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "deviceip",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "IP"
|
||||
}]
|
||||
} ,
|
||||
{
|
||||
"column": "DateTimeCreated",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Created"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "DateTimeChanged",
|
||||
"mapped_to_column": "DHCP_DateTime",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Changed"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
48
front/plugins/undiscoverables/script.py
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python
|
||||
# test script by running python script.py devices=test,dummy
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
sys.path.append("/home/pi/pialert/front/plugins")
|
||||
|
||||
from plugin_helper import Plugin_Objects
|
||||
|
||||
CUR_PATH = str(pathlib.Path(__file__).parent.resolve())
|
||||
LOG_FILE = os.path.join(CUR_PATH , 'script.log')
|
||||
RESULT_FILE = os.path.join(CUR_PATH , 'last_result.log')
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
# the script expects a parameter in the format of devices=device1,device2,...
|
||||
parser = argparse.ArgumentParser(description='Import devices from settings')
|
||||
parser.add_argument('devices', action="store", help="list of device names separated by ','")
|
||||
values = parser.parse_args()
|
||||
|
||||
UNDIS_devices = Plugin_Objects( RESULT_FILE )
|
||||
|
||||
if values.devices:
|
||||
for fake_dev in values.devices.split('=')[1].split(','):
|
||||
UNDIS_devices.add_object(
|
||||
primaryId=fake_dev, # MAC (Device Name)
|
||||
secondaryId="0.0.0.0", # IP Address (always 0.0.0.0)
|
||||
watched1=fake_dev, # Device Name
|
||||
watched2="",
|
||||
watched3="",
|
||||
watched4="",
|
||||
extra="",
|
||||
foreignKey="")
|
||||
|
||||
UNDIS_devices.write_result_file()
|
||||
|
||||
return 0
|
||||
|
||||
#===============================================================================
|
||||
# BEGIN
|
||||
#===============================================================================
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -4,7 +4,7 @@ A plugin allowing for importing devices from a UniFi controller.
|
||||
|
||||
### Usage
|
||||
|
||||
Spedify the following settings in the Settings section of PiAlert:
|
||||
Specify the following settings in the Settings section of PiAlert:
|
||||
|
||||
- `UNFIMP_username` - Username used to login into the UNIFI controller.
|
||||
- `UNFIMP_password` - Password used to login into the UNIFI controller.
|
||||
@@ -15,4 +15,5 @@ Spedify the following settings in the Settings section of PiAlert:
|
||||
|
||||
### Notes
|
||||
|
||||
- Currently only used to import devices, not their status, type or network map.
|
||||
- Currently only used to import devices, not their status, type or network map.
|
||||
- It is recommend to create a read-only user in your UniFi controller
|
||||
@@ -3,6 +3,15 @@
|
||||
"unique_prefix": "UNFIMP",
|
||||
"enabled": true,
|
||||
"data_source": "python-script",
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "Object_PrimaryID",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_template": "'{value}'.toString()",
|
||||
"compare_use_quotes": true
|
||||
}
|
||||
],
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"mapped_to_table": "DHCP_Leases",
|
||||
"display_name" : [{
|
||||
@@ -47,6 +56,11 @@
|
||||
"name" : "port",
|
||||
"type" : "setting",
|
||||
"value" : "UNFIMP_port"
|
||||
},
|
||||
{
|
||||
"name" : "version",
|
||||
"type" : "setting",
|
||||
"value" : "UNFIMP_version"
|
||||
}
|
||||
],
|
||||
"database_column_definitions":
|
||||
@@ -182,7 +196,7 @@
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Network"
|
||||
"string" : "Online?"
|
||||
}]
|
||||
} ,
|
||||
{
|
||||
@@ -208,7 +222,7 @@
|
||||
"localized": ["name"],
|
||||
"name":[{
|
||||
"language_code":"en_us",
|
||||
"string" : "Hostname"
|
||||
"string" : "Network"
|
||||
}]
|
||||
},
|
||||
{
|
||||
@@ -241,7 +255,7 @@
|
||||
"settings":[
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "selecttext",
|
||||
"type": "text.select",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -257,7 +271,7 @@
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value":"python3 /home/pi/pialert/front/plugins/unifi_import/script.py username={username} password={password} host={host} sites={sites} protocol={protocol} port={port}",
|
||||
"default_value":"python3 /home/pi/pialert/front/plugins/unifi_import/script.py username={username} password={password} host={host} sites={sites} protocol={protocol} port={port} version={version}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
@@ -301,7 +315,7 @@
|
||||
},
|
||||
{
|
||||
"function": "protocol",
|
||||
"type": "selecttext",
|
||||
"type": "text.select",
|
||||
"default_value":"https://",
|
||||
"options": ["https://", "http://"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -344,6 +358,21 @@
|
||||
"string" : "The port number where the UNIFI controller is runnig. Usually it is <code>8443</code>."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "version",
|
||||
"type": "text",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "API version"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "The base version of the Unify controller API. Supported values as of time of writing are <code>v4|v5|unifiOS|UDMP-unifiOS</code>."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "sites",
|
||||
"type": "list",
|
||||
@@ -371,7 +400,7 @@
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "Only enabled if you select <code>schedule</code> in the <a href=\"#DHCPLSS_RUN\"><code>DHCPLSS_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
|
||||
"string" : "Only enabled if you select <code>schedule</code> in the <a href=\"#UNFIMP_RUN\"><code>UNFIMP_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
|
||||
}]
|
||||
},
|
||||
{
|
||||
@@ -395,7 +424,7 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["Watched_Value1", "Watched_Value4"],
|
||||
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -410,7 +439,7 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["new","watched-changed"],
|
||||
"options": ["new","watched-changed","watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -32,7 +32,7 @@ def main():
|
||||
|
||||
# init global variables
|
||||
global UNIFI_USERNAME, UNIFI_PASSWORD, UNIFI_HOST
|
||||
global UNIFI_SITES, PORT, PROTOCOL
|
||||
global UNIFI_SITES, PORT, PROTOCOL, VERSION
|
||||
|
||||
last_run_logfile = open(last_run, 'a')
|
||||
|
||||
@@ -47,6 +47,7 @@ def main():
|
||||
parser.add_argument('sites', action="store", help="Name of the sites (usually 'default', check the URL in your UniFi controller UI). Separated by comma (,) if passing multiple sites")
|
||||
parser.add_argument('protocol', action="store", help="https:// or http://")
|
||||
parser.add_argument('port', action="store", help="Usually 8443")
|
||||
parser.add_argument('version', action="store", help="The base version of the controller API [v4|v5|unifiOS|UDMP-unifiOS]")
|
||||
|
||||
values = parser.parse_args()
|
||||
|
||||
@@ -61,6 +62,7 @@ def main():
|
||||
UNIFI_SITES = values.sites.split('=')[1]
|
||||
PROTOCOL = values.protocol.split('=')[1]
|
||||
PORT = values.port.split('=')[1]
|
||||
VERSION = values.version.split('=')[1]
|
||||
|
||||
newEntries = get_entries(newEntries)
|
||||
|
||||
@@ -85,7 +87,7 @@ def get_entries(newEntries):
|
||||
|
||||
for site in sites:
|
||||
|
||||
c = Controller(UNIFI_HOST, UNIFI_USERNAME, UNIFI_PASSWORD, ssl_verify=False, site_id=site )
|
||||
c = Controller(UNIFI_HOST, UNIFI_USERNAME, UNIFI_PASSWORD, version=VERSION, ssl_verify=False, site_id=site )
|
||||
|
||||
for ap in c.get_aps():
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
"settings":[
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "selecttext",
|
||||
"type": "text.select",
|
||||
"default_value":"disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -319,7 +319,7 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["Watched_Value1"],
|
||||
"options": ["Watched_Value1","Watched_Value2","Watched_Value3","Watched_Value4"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -334,7 +334,7 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "multiselect",
|
||||
"type": "text.multiselect",
|
||||
"default_value":["new","watched-changed"],
|
||||
"options": ["new","watched-changed","watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# Based on the work of https://github.com/leiweibau/Pi.Alert
|
||||
|
||||
# /home/pi/pialert/front/plugins/website_monitor/script.py urls=http://google.com,http://bing.com
|
||||
# python3 /home/pi/pialert/front/plugins/website_monitor/script.py urls=http://google.com,http://bing.com
|
||||
from __future__ import unicode_literals
|
||||
from time import sleep, time, strftime
|
||||
import requests
|
||||
|
||||
541
front/pluginsCore.php
Executable file
@@ -0,0 +1,541 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Main content ---------------------------------------------------------- -->
|
||||
<section class="content">
|
||||
<div class="plugin-filters">
|
||||
<div class="input-group col-sm-4">
|
||||
<label class="control-label col-sm-3"><?= lang('Plugins_Filters_Mac');?></label>
|
||||
<input class="form-control col-sm-3" id="txtMacFilter" type="text" value="--" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-tabs-custom plugin-content" style="margin-bottom: 0px;">
|
||||
|
||||
<ul id="tabs-location" class="nav nav-tabs col-sm-2 ">
|
||||
<!-- PLACEHOLDER -->
|
||||
</ul>
|
||||
<div id="tabs-content-location" class="tab-content col-sm-10">
|
||||
<!-- PLACEHOLDER -->
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<script defer>
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Initializes fields based on current MAC
|
||||
function initFields() {
|
||||
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
mac = urlParams.get ('mac');
|
||||
|
||||
// if the current mac has changed, reinitialize the data
|
||||
if(mac != undefined && $("#txtMacFilter").val() != mac)
|
||||
{
|
||||
$("#txtMacFilter").val(mac);
|
||||
console.log("UPDATE");
|
||||
|
||||
getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Checking if current MAC has changed and triggering an updated if needed
|
||||
function updater() {
|
||||
|
||||
initFields()
|
||||
|
||||
// loop
|
||||
setTimeout(function() {
|
||||
updater();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Get form control according to the column definition from config.json > database_column_definitions
|
||||
function getFormControl(dbColumnDef, value, index) {
|
||||
|
||||
result = ''
|
||||
|
||||
switch(dbColumnDef.type)
|
||||
{
|
||||
case 'label':
|
||||
result = `<span>${value}<span>`;
|
||||
break;
|
||||
case 'textboxsave':
|
||||
|
||||
value = value == 'null' ? '' : value; // hide 'null' values
|
||||
|
||||
id = `${dbColumnDef.column}_${index}`
|
||||
|
||||
result = `<span class="form-group">
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" value="${value}" id="${id}" data-my-column="${dbColumnDef.column}" data-my-index="${index}" name="${dbColumnDef.column}">
|
||||
<span class="input-group-addon"><i class="fa fa-save pointer" onclick="saveData('${id}');"></i></span>
|
||||
</div>
|
||||
<span>`;
|
||||
break;
|
||||
case 'url':
|
||||
result = `<span><a href="${value}" target="_blank">${value}</a><span>`;
|
||||
break;
|
||||
case 'devicemac':
|
||||
result = `<span class="anonymizeMac"><a href="/deviceDetails.php?mac=${value}" target="_blank">${value}</a><span>`;
|
||||
break;
|
||||
case 'deviceip':
|
||||
result = `<span class="anonymizeIp"><a href="#" onclick="navigateToDeviceWithIp('${value}')" >${value}</a><span>`;
|
||||
break;
|
||||
case 'threshold':
|
||||
$.each(dbColumnDef.options, function(index, obj) {
|
||||
if(Number(value) < obj.maximum && result == '')
|
||||
{
|
||||
result = `<div style="background-color:${obj.hexColor}">${value}</div>`
|
||||
// return;
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'replace':
|
||||
$.each(dbColumnDef.options, function(index, obj) {
|
||||
if(value == obj.equals)
|
||||
{
|
||||
result = `<span title="${value}">${obj.replacement}</span>`
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
result = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Update the corresponding DB column and entry
|
||||
function saveData (id) {
|
||||
columnName = $(`#${id}`).attr('data-my-column')
|
||||
index = $(`#${id}`).attr('data-my-index')
|
||||
columnValue = $(`#${id}`).val()
|
||||
|
||||
$.get(`php/server/dbHelper.php?action=update&dbtable=Plugins_Objects&columnName=Index&id=${index}&columns=UserData&values=${columnValue}`, function(data) {
|
||||
|
||||
// var result = JSON.parse(data);
|
||||
console.log(data)
|
||||
|
||||
if(sanitize(data) == 'OK')
|
||||
{
|
||||
showMessage('<?= lang('Gen_DataUpdatedUITakesTime');?>')
|
||||
// Remove navigation prompt "Are you sure you want to leave..."
|
||||
window.onbeforeunload = null;
|
||||
} else
|
||||
{
|
||||
showMessage('<?= lang('Gen_LockedDB');?>')
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Get translated string
|
||||
function localize (obj, key) {
|
||||
|
||||
currLangCode = getCookie("language")
|
||||
|
||||
result = ""
|
||||
en_us = ""
|
||||
|
||||
if(obj.localized && obj.localized.includes(key))
|
||||
{
|
||||
for(i=0;i<obj[key].length;i++)
|
||||
{
|
||||
code = obj[key][i]["language_code"]
|
||||
|
||||
if( code == 'en_us')
|
||||
{
|
||||
en_us = obj[key][i]["string"]
|
||||
}
|
||||
|
||||
if(code == currLangCode)
|
||||
{
|
||||
result = obj[key][i]["string"]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result == "" ? result = en_us : result ;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
pluginDefinitions = []
|
||||
pluginUnprocessedEvents = []
|
||||
pluginObjects = []
|
||||
pluginHistory = []
|
||||
|
||||
function getData(){
|
||||
|
||||
$.get('api/plugins.json', function(res) {
|
||||
|
||||
pluginDefinitions = res["data"];
|
||||
|
||||
$.get('api/table_plugins_events.json', function(res) {
|
||||
|
||||
pluginUnprocessedEvents = res["data"];
|
||||
|
||||
$.get('api/table_plugins_objects.json', function(res) {
|
||||
|
||||
pluginObjects = res["data"];
|
||||
|
||||
$.get('api/table_plugins_history.json', function(res) {
|
||||
|
||||
pluginHistory = res["data"];
|
||||
|
||||
generateTabs()
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function generateTabs()
|
||||
{
|
||||
activetab = 'active'
|
||||
|
||||
// clear previous headers data
|
||||
$('#tabs-location').html("");
|
||||
// clear previous content data
|
||||
$('#tabs-content-location').html("");
|
||||
|
||||
$.each(pluginDefinitions, function(index, pluginObj) {
|
||||
|
||||
// console.log(pluginObj)
|
||||
|
||||
if(pluginObj.data_source != "template") // hiding template-based plugins as they don't produce any output
|
||||
{
|
||||
$('#tabs-location').append(
|
||||
`<li class=" left-nav ${activetab}">
|
||||
<a class=" col-sm-12 " href="#${pluginObj.unique_prefix}" data-plugin-prefix="${pluginObj.unique_prefix}" id="${pluginObj.unique_prefix}_id" data-toggle="tab" >
|
||||
${localize(pluginObj, 'icon')} ${localize(pluginObj, 'display_name')}
|
||||
</a>
|
||||
</li>`
|
||||
);
|
||||
activetab = '' // only first tab is active
|
||||
}
|
||||
});
|
||||
|
||||
activetab = 'active'
|
||||
|
||||
$.each(pluginDefinitions, function(index, pluginObj) {
|
||||
|
||||
headersHtml = ""
|
||||
colDefinitions = []
|
||||
evRows = ""
|
||||
obRows = ""
|
||||
hiRows = ""
|
||||
|
||||
// Generate the header
|
||||
$.each(pluginObj["database_column_definitions"], function(index, colDef){
|
||||
if(colDef.show == true) // select only the ones to show
|
||||
{
|
||||
colDefinitions.push(colDef)
|
||||
headersHtml += `<th class="${colDef.css_classes}" >${localize(colDef, "name" )}</th>`
|
||||
}
|
||||
});
|
||||
|
||||
// Generate the event rows
|
||||
var eveCount = 0;
|
||||
for(i=0;i<pluginUnprocessedEvents.length;i++)
|
||||
{
|
||||
if(pluginUnprocessedEvents[i].Plugin == pluginObj.unique_prefix)
|
||||
{
|
||||
clm = ""
|
||||
|
||||
for(j=0;j<colDefinitions.length;j++)
|
||||
{
|
||||
clm += '<td>'+ pluginUnprocessedEvents[i][colDefinitions[j].column] +'</td>'
|
||||
}
|
||||
evRows += `<tr data-my-index="${pluginUnprocessedEvents[i]["Index"]}" >${clm}</tr>`
|
||||
eveCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the history rows
|
||||
var histCount = 0
|
||||
var histCountDisplayed = 0
|
||||
|
||||
for(i=pluginHistory.length-1;i >= 0;i--) // from latest to the oldest
|
||||
{
|
||||
if(pluginHistory[i].Plugin == pluginObj.unique_prefix)
|
||||
{
|
||||
if(histCount < 50) // only display 50 entries to optimize performance
|
||||
{
|
||||
clm = ""
|
||||
|
||||
for(j=0;j<colDefinitions.length;j++)
|
||||
{
|
||||
clm += '<td>'+ pluginHistory[i][colDefinitions[j].column] +'</td>'
|
||||
}
|
||||
hiRows += `<tr data-my-index="${pluginHistory[i]["Index"]}" >${clm}</tr>`
|
||||
|
||||
histCountDisplayed++;
|
||||
}
|
||||
histCount++; // count and display the total
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the object rows
|
||||
var obCount = 0;
|
||||
for(var i=0;i<pluginObjects.length;i++)
|
||||
{
|
||||
if(pluginObjects[i].Plugin == pluginObj.unique_prefix)
|
||||
{
|
||||
if(shouldBeShown(pluginObjects[i], pluginObj)) // filter TODO
|
||||
{
|
||||
clm = ""
|
||||
|
||||
for(var j=0;j<colDefinitions.length;j++)
|
||||
{
|
||||
clm += '<td>'+ getFormControl(colDefinitions[j], pluginObjects[i][colDefinitions[j].column], pluginObjects[i]["Index"]) +'</td>'
|
||||
}
|
||||
obRows += `<tr data-my-index="${pluginObjects[i]["Index"]}" >${clm}</tr>`
|
||||
obCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the HTML
|
||||
|
||||
$('#tabs-content-location').append(
|
||||
`
|
||||
<div id="${pluginObj.unique_prefix}" class="tab-pane ${activetab}">
|
||||
<div class="nav-tabs-custom" style="margin-bottom: 0px">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active" >
|
||||
<a href="#objectsTarget_${pluginObj.unique_prefix}" data-toggle="tab" >
|
||||
|
||||
<i class="fa fa-cube"></i> <?= lang('Plugins_Objects');?> (${obCount})
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="#eventsTarget_${pluginObj.unique_prefix}" data-toggle="tab" >
|
||||
|
||||
<i class="fa fa-bolt"></i> <?= lang('Plugins_Unprocessed_Events');?> (${eveCount})
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<a href="#historyTarget_${pluginObj.unique_prefix}" data-toggle="tab" >
|
||||
|
||||
<i class="fa fa-clock"></i> <?= lang('Plugins_History');?> (${histCountDisplayed} out of ${histCount} )
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div id="objectsTarget_${pluginObj.unique_prefix}" class="tab-pane ${activetab}">
|
||||
<table class="table table-striped" data-my-dbtable="Plugins_Objects">
|
||||
<tbody>
|
||||
<tr>
|
||||
${headersHtml}
|
||||
</tr>
|
||||
${obRows}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="plugin-obj-purge">
|
||||
<button class="btn btn-primary" onclick="purgeAll('${pluginObj.unique_prefix}', 'Plugins_Objects' )"><?= lang('Plugins_DeleteAll');?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="eventsTarget_${pluginObj.unique_prefix}" class="tab-pane">
|
||||
<table class="table table-striped" data-my-dbtable="Plugins_Events">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
${headersHtml}
|
||||
</tr>
|
||||
${evRows}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="plugin-obj-purge">
|
||||
<button class="btn btn-primary" onclick="purgeAll('${pluginObj.unique_prefix}', 'Plugins_Events' )"><?= lang('Plugins_DeleteAll');?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="historyTarget_${pluginObj.unique_prefix}" class="tab-pane">
|
||||
<table class="table table-striped" data-my-dbtable="Plugins_History">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
${headersHtml}
|
||||
</tr>
|
||||
${hiRows}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="plugin-obj-purge">
|
||||
<button class="btn btn-primary" onclick="purgeAll('${pluginObj.unique_prefix}', 'Plugins_History' )"><?= lang('Plugins_DeleteAll');?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class='plugins-description'>
|
||||
|
||||
${localize(pluginObj, 'description')}
|
||||
|
||||
<span>
|
||||
<a href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/${pluginObj.code_name}" target="_blank"><?= lang('Gen_ReadDocs');?></a>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
activetab = '' // only first tab is active
|
||||
});
|
||||
|
||||
initTabs()
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Handle active / selected tabs
|
||||
// handle first tab (objectsTarget_) display
|
||||
function initTabs()
|
||||
{
|
||||
// events on tab change
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var target = $(e.target).attr("href") // activated tab
|
||||
|
||||
// save the last prefix
|
||||
if(target.includes('_') == false )
|
||||
{
|
||||
pref = target.split('#')[1]
|
||||
} else
|
||||
{
|
||||
pref = target.split('_')[1]
|
||||
}
|
||||
|
||||
everythingHidden = false;
|
||||
|
||||
if($('#objectsTarget_'+ pref) != undefined && $('#historyTarget_'+ pref) != undefined && $('#eventsTarget_'+ pref) != undefined)
|
||||
{
|
||||
everythingHidden = $('#objectsTarget_'+ pref).attr('class').includes('active') == false && $('#historyTarget_'+ pref).attr('class').includes('active') == false && $('#eventsTarget_'+ pref).attr('class').includes('active') == false;
|
||||
}
|
||||
|
||||
// show the objectsTarget if no specific pane selected or if selected is hidden
|
||||
if((target == '#'+pref ) && everythingHidden)
|
||||
{
|
||||
var classTmp = $('#objectsTarget_'+ pref).attr('class');
|
||||
|
||||
if($('#objectsTarget_'+ pref).attr('class').includes('active') == false)
|
||||
{
|
||||
classTmp += ' active';
|
||||
$('#objectsTarget_'+ pref).attr('class', classTmp)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Filter method that determines if an entry should be shown
|
||||
function shouldBeShown(entry, pluginObj)
|
||||
{
|
||||
if (pluginObj.hasOwnProperty('data_filters')) {
|
||||
|
||||
let dataFilters = pluginObj.data_filters;
|
||||
|
||||
// Loop through 'data_filters' array and appply filters on individual plugin entries
|
||||
for (let i = 0; i < dataFilters.length; i++) {
|
||||
|
||||
compare_field_id = dataFilters[i].compare_field_id;
|
||||
compare_column = dataFilters[i].compare_column;
|
||||
compare_operator = dataFilters[i].compare_operator;
|
||||
compare_js_template = dataFilters[i].compare_js_template;
|
||||
compare_use_quotes = dataFilters[i].compare_use_quotes;
|
||||
compare_field_id_value = $(`#${compare_field_id}`).val();
|
||||
|
||||
if(compare_field_id_value != undefined && compare_field_id_value != '--')
|
||||
{
|
||||
// valid value
|
||||
// resolve the left and right part of the comparison
|
||||
let left = compare_js_template.replace('{value}', `${compare_field_id_value}`)
|
||||
let right = compare_js_template.replace('{value}', `${entry[compare_column]}`)
|
||||
|
||||
// include wrapper quotes if specified
|
||||
compare_use_quotes ? quotes = '"' : quotes = ''
|
||||
|
||||
result = eval(
|
||||
quotes + `${eval(left)}` + quotes +
|
||||
` ${compare_operator} ` +
|
||||
quotes + `${eval(right)}` + quotes
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Data cleanup/purge functionality
|
||||
plugPrefix = ''
|
||||
dbTable = ''
|
||||
|
||||
function purgeAll(callback) {
|
||||
plugPrefix = arguments[0]; // plugin prefix
|
||||
dbTable = arguments[1]; // DB table
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Gen_Purge');?>' + ' ' + plugPrefix + ' ' + dbTable , '<?= lang('Gen_AreYouSure');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', "purgeAllExecute");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
function purgeAllExecute() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "php/server/dbHelper.php",
|
||||
data: { action: "delete", dbtable: dbTable, columnName: 'Plugin', id:plugPrefix },
|
||||
success: function(data, textStatus) {
|
||||
showModalOk ('Result', data );
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
function purgeVisible() {
|
||||
|
||||
idArr = $(`#${plugPrefix} table[data-my-dbtable="${dbTable}"] tr[data-my-index]`).map(function(){return $(this).attr("data-my-index");}).get();
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "php/server/dbHelper.php",
|
||||
data: { action: "delete", dbtable: dbTable, columnName: 'Index', id:idArr.toString() },
|
||||
success: function(data, textStatus) {
|
||||
showModalOk ('Result', data );
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Main sequence
|
||||
|
||||
getData()
|
||||
updater()
|
||||
|
||||
</script>
|
||||
@@ -234,7 +234,7 @@ function initializeCalendar () {
|
||||
header: {
|
||||
left : 'prev,next today',
|
||||
center : 'title',
|
||||
right : 'timelineYear,timelineMonth,timelineWeek'
|
||||
right : 'timelineYear,timelineMonth,timelineWeek,timelineDay'
|
||||
},
|
||||
defaultView : 'timelineMonth',
|
||||
height : 'auto',
|
||||
@@ -286,6 +286,13 @@ function initializeCalendar () {
|
||||
buttonText : '<?= lang('Presence_CalHead_week');?>',
|
||||
slotLabelFormat : 'D',
|
||||
slotDuration : '24:00:01'
|
||||
},
|
||||
timelineDay: {
|
||||
type : 'timeline',
|
||||
duration : { day: 1 },
|
||||
buttonText : '<?= lang('Presence_CalHead_day');?>',
|
||||
slotLabelFormat : 'H',
|
||||
slotDuration : '00:30:00'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -305,6 +312,15 @@ function initializeCalendar () {
|
||||
|
||||
if (date.format('YYYY-MM-DD') == moment().format('YYYY-MM-DD')) {
|
||||
cell.addClass ('fc-today'); };
|
||||
|
||||
if ($('#calendar').fullCalendar('getView').name == 'timelineDay') {
|
||||
cell.removeClass('fc-sat');
|
||||
cell.removeClass('fc-sun');
|
||||
cell.removeClass('fc-today');
|
||||
if (date.format('YYYY-MM-DD HH') == moment().format('YYYY-MM-DD HH')) {
|
||||
cell.addClass('fc-today');
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
resourceRender: function (resourceObj, labelTds, bodyTds) {
|
||||
|
||||
@@ -32,7 +32,7 @@ $result = $db->query("SELECT * FROM Settings");
|
||||
|
||||
// array
|
||||
$settingKeyOfLists = array();
|
||||
$settingCoreGroups = array('General', 'Email', 'Webhooks', 'Apprise', 'NTFY', 'PUSHSAFER', 'MQTT', 'DynDNS', 'PiHole', 'Pholus', 'Nmap', 'API');
|
||||
$settingCoreGroups = array('General', 'NewDeviceDefaults', 'Email', 'Webhooks', 'Apprise', 'NTFY', 'PUSHSAFER', 'MQTT', 'DynDNS', 'PiHole', 'Pholus', 'Nmap', 'API');
|
||||
$settings = array();
|
||||
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
// Push row data
|
||||
@@ -82,13 +82,16 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
// create settings groups
|
||||
$isIn = ' in ';
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
{
|
||||
$isPlugin = FALSE;
|
||||
|
||||
if (in_array($group, $settingCoreGroups))
|
||||
{
|
||||
$settingGroupTypeHtml = "";
|
||||
} else
|
||||
{
|
||||
$settingGroupTypeHtml = ' (<i class="fa-regular fa-plug fa-sm"></i>) ';
|
||||
$isPlugin = TRUE;
|
||||
}
|
||||
|
||||
$html = $html.'<div class=" box panel panel-default">
|
||||
@@ -101,6 +104,15 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
<div class="panel-body">';
|
||||
$isIn = ' '; // open the first panel only by default on page load
|
||||
|
||||
if($isPlugin)
|
||||
{
|
||||
$html = $html.
|
||||
'<div class=" row table_row" >
|
||||
<div class="table_cell bold">
|
||||
<i class="fa-regular fa-book fa-sm"></i> <a href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins" target="_blank">' . lang('Gen_ReadDocs').'</a></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// populate settings for each group
|
||||
foreach ($settings as $set)
|
||||
{
|
||||
@@ -128,37 +140,37 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
$input = "";
|
||||
|
||||
// text - textbox
|
||||
if($set['Type'] == 'text' )
|
||||
if($set['Type'] == 'text' || $set['Type'] == 'string' || $set['Type'] == 'date-time' )
|
||||
{
|
||||
$input = '<input class="form-control" onChange="settingsChanged()" id="'.$set['Code_Name'].'" value="'.$set['Value'].'"/>';
|
||||
$input = '<input class="form-control" onChange="settingsChanged()" my-data-type="'.$set['Type'].'" id="'.$set['Code_Name'].'" value="'.$set['Value'].'"/>';
|
||||
}
|
||||
// password - hidden text
|
||||
elseif ($set['Type'] == 'password')
|
||||
{
|
||||
$input = '<input onChange="settingsChanged()" class="form-control input" id="'.$set['Code_Name'].'" type="password" value="'.$set['Value'].'"/>';
|
||||
$input = '<input onChange="settingsChanged()" my-data-type="'.$set['Type'].'" class="form-control input" id="'.$set['Code_Name'].'" type="password" value="'.$set['Value'].'"/>';
|
||||
}
|
||||
// readonly
|
||||
elseif ($set['Type'] == 'readonly')
|
||||
{
|
||||
$input = '<input class="form-control input" id="'.$set['Code_Name'].'" value="'.$set['Value'].'" readonly/>';
|
||||
$input = '<input class="form-control input" my-data-type="'.$set['Type'].'" id="'.$set['Code_Name'].'" value="'.$set['Value'].'" readonly/>';
|
||||
}
|
||||
// boolean - checkbox
|
||||
elseif ($set['Type'] == 'boolean')
|
||||
elseif ($set['Type'] == 'boolean' || $set['Type'] == 'integer.checkbox')
|
||||
{
|
||||
$checked = "";
|
||||
if ($set['Value'] == "True") { $checked = "checked";};
|
||||
$input = '<input onChange="settingsChanged()" class="checkbox" id="'.$set['Code_Name'].'" type="checkbox" value="'.$set['Value'].'" '.$checked.' />';
|
||||
if ($set['Value'] == "True" || $set['Value'] == "1") { $checked = "checked";};
|
||||
$input = '<input onChange="settingsChanged()" my-data-type="'.$set['Type'].'" class="checkbox" id="'.$set['Code_Name'].'" type="checkbox" value="'.$set['Value'].'" '.$checked.' />';
|
||||
|
||||
}
|
||||
// integer - number input
|
||||
elseif ($set['Type'] == 'integer')
|
||||
{
|
||||
$input = '<input onChange="settingsChanged()" class="form-control" id="'.$set['Code_Name'].'" type="number" value="'.$set['Value'].'"/>';
|
||||
$input = '<input onChange="settingsChanged()" my-data-type="'.$set['Type'].'" class="form-control" id="'.$set['Code_Name'].'" type="number" value="'.$set['Value'].'"/>';
|
||||
}
|
||||
// selecttext - dropdown
|
||||
elseif ($set['Type'] == 'selecttext')
|
||||
// text.select - dropdown
|
||||
elseif ($set['Type'] == 'text.select')
|
||||
{
|
||||
$input = '<select onChange="settingsChanged()" class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'">';
|
||||
$input = '<select onChange="settingsChanged()" my-data-type="'.$set['Type'].'" class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'">';
|
||||
|
||||
$values = createArray($set['Value']);
|
||||
$options = createArray($set['Options']);
|
||||
@@ -174,10 +186,10 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
}
|
||||
$input = $input.'</select>';
|
||||
}
|
||||
// selectinteger - dropdown
|
||||
elseif ($set['Type'] == 'selectinteger')
|
||||
// integer.select - dropdown
|
||||
elseif ($set['Type'] == 'integer.select')
|
||||
{
|
||||
$input = '<select onChange="settingsChanged()" class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'">';
|
||||
$input = '<select onChange="settingsChanged()" my-data-type="'.$set['Type'].'" class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'">';
|
||||
|
||||
$values = createArray($set['Value']);
|
||||
$options = createArray($set['Options']);
|
||||
@@ -194,10 +206,10 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
}
|
||||
$input = $input.'</select>';
|
||||
}
|
||||
// multiselect
|
||||
elseif ($set['Type'] == 'multiselect')
|
||||
// text.multiselect
|
||||
elseif ($set['Type'] == 'text.multiselect')
|
||||
{
|
||||
$input = '<select onChange="settingsChanged()" class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'" multiple>';
|
||||
$input = '<select onChange="settingsChanged()" my-data-type="'.$set['Type'].'" class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'" multiple>';
|
||||
|
||||
$values = createArray($set['Value']);
|
||||
$options = createArray($set['Options']);
|
||||
@@ -219,7 +231,7 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
$input = $input.
|
||||
'<div class="row form-group">
|
||||
<div class="col-xs-5">
|
||||
<input class="form-control" id="ipMask" type="text" placeholder="192.168.1.0/24"/>
|
||||
<input class="form-control" id="ipMask" type="text" placeholder="192.168.1.0/24"/>
|
||||
</div>';
|
||||
// Add interface button
|
||||
$input = $input.
|
||||
@@ -231,7 +243,7 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
|
||||
// list all interfaces as options
|
||||
$input = $input.'<div class="form-group">
|
||||
<select class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'" multiple readonly>';
|
||||
<select class="form-control" my-data-type="'.$set['Type'].'" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'" multiple readonly>';
|
||||
|
||||
$options = createArray($set['Value']);
|
||||
|
||||
@@ -262,7 +274,7 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
|
||||
// list all interfaces as options
|
||||
$input = $input.'<div class="form-group">
|
||||
<select class="form-control" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'" multiple readonly>';
|
||||
<select class="form-control" my-data-type="'.$set['Type'].'" name="'.$set['Code_Name'].'" id="'.$set['Code_Name'].'" multiple readonly>';
|
||||
|
||||
$options = createArray($set['Value']);
|
||||
|
||||
@@ -411,7 +423,7 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
// generate javascript to collect values
|
||||
<?php
|
||||
|
||||
$noConversion = array('text', 'integer', 'password', 'readonly', 'selecttext', 'selectinteger', 'multiselect');
|
||||
$noConversion = array('text', 'integer', 'password', 'readonly', 'text.select', 'integer.select', 'text.multiselect');
|
||||
|
||||
foreach ($settings as $set) {
|
||||
if(in_array($set['Type'] , $noConversion))
|
||||
@@ -424,6 +436,12 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
echo 'temp = $("#'.$set["Code_Name"].'").is(":checked") ;';
|
||||
echo 'settingsArray.push(["'.$set["Group"].'", "'.$set["Code_Name"].'", "'.$set["Type"].'", temp ]);';
|
||||
}
|
||||
elseif ($set['Type'] == "integer.checkbox")
|
||||
{
|
||||
echo 'temp = $("#'.$set["Code_Name"].'").is(":checked") ;';
|
||||
echo 'temp ? temp = 1 : temp = 0;';
|
||||
echo 'settingsArray.push(["'.$set["Group"].'", "'.$set["Code_Name"].'", "'.$set["Type"].'", temp ]);';
|
||||
}
|
||||
elseif ($set["Code_Name"] == "SCAN_SUBNETS")
|
||||
{
|
||||
echo "var temps = [];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# index.html - Redirect default page to pialert web admin portal
|
||||
#-------------------------------------------------------------------------------
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||
# Puche 2021 GNU GPLv3
|
||||
#--------------------------------------------------------------------------- -->
|
||||
|
||||
<meta http-equiv="refresh" content="0; url=pialert"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# pialert_front.conf - lighttpd domain redirection
|
||||
# ------------------------------------------------------------------------------
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||
# Puche 2021 GNU GPLv3
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
$HTTP["host"] == "pi.alert" {
|
||||
|
||||
50
pialert/README.md
Executable file
@@ -0,0 +1,50 @@
|
||||
# Pi.Alert modules
|
||||
|
||||
The original pilaert.py code is now moved to this new folder and split into different modules.
|
||||
|
||||
| Module | Description |
|
||||
|--------|-----------|
|
||||
|```__main__.py```| The MAIN program of Pi.Alert|
|
||||
|```__init__.py```| an empty init file|
|
||||
|```README.md```| this readme file|
|
||||
|**publishers**| a folder containing all modules used to publish the results|
|
||||
|**scanners**| a folder containing all modules used to scan for devices |
|
||||
|```api.py```| updating the API endpoints with the relevant data. (Should move to publishers)|
|
||||
|```const.py```| A place to define the constants for Pi.Alert like log path or config path.|
|
||||
|```conf.py```| conf.py holds the configuration variables and makes them available for all modules. It is also the <b>workaround</b> for global variables that need to be resolved at some point|
|
||||
|```database.py```| This module connects to the DB, makes sure the DB is up to date and defines some standard queries and interfaces. |
|
||||
|```device.py```| The device module looks after the devices and saves the scan results into the devices |
|
||||
|```helper.py```| Helper as the name suggest contains multiple little functions and methods used in many of the other modules and helps keep things clean |
|
||||
|```initialise.py```| Initiatlise sets up the environment and makes everything ready to go |
|
||||
|```logger.py```| Logger is there the keep all the logs organised and looking identical. |
|
||||
|```mac_vendor.py```| This module runs and manages the ``` update_vendors.sh ``` script from within Pi.Alert |
|
||||
|```networscan.py```| Networkscan orchestrates the actual scanning of the network, calling the individual scanners and managing the results |
|
||||
|```plugin.py```| This is where the plugins get integrated into the backend of Pi.Alert |
|
||||
|```reporting.py```| Reporting generates the email, html and json reports to be sent by the publishers |
|
||||
|```scheduler.py```| All things scheduling |
|
||||
|
||||
## publishers
|
||||
publishers generally have a check_config method as well as a send method.
|
||||
|
||||
| Module | Description |
|
||||
|--------|-----------|
|
||||
|```__init__.py```| an empty init file|
|
||||
|```apprise.py```| use apprise to integrate to "everywhere" https://github.com/caronc/apprise |
|
||||
|```email.py```| Configure and send the reports and notifications via email |
|
||||
|```mqtt.py```| integrate with a MQTT broker and even make the devices automatically discoverable in Home-Assistant |
|
||||
|```ntfy.py```| integrate with ntfy |
|
||||
|```pushsafer.py```| integrate with pushsafer |
|
||||
|```webhook.py```| integrate via webhook |
|
||||
|
||||
## scanners
|
||||
different methods to scan the network for devices or to find more details about the discovered devices
|
||||
|
||||
| Module | Description |
|
||||
|--------|-----------|
|
||||
|```__init__.py```| an empty init file (oops missing in the repo)|
|
||||
|```arpscan.py```| run an arp-scan to discover devices |
|
||||
|```internet.py```| discover the internet interface and check the external IP also manage Dynamic DNS |
|
||||
|```nmapscan.py```| use Nmap to discover more about devices |
|
||||
|```pholusscan.py```| use a 3rd party script Pholus to detect more details about the devices on the network |
|
||||
|```pihole.py```| Use the PiHole network table in its db and also read the DHCP leases file to discover new devices |
|
||||
|
||||
1
pialert/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
""" __init__ for Pi.Alert """
|
||||
311
pialert/__main__.py
Executable file
@@ -0,0 +1,311 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
# Pi.Alert v2.70 / 2021-02-01
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector
|
||||
#
|
||||
# pialert.py - Back module. Network scanner
|
||||
#-------------------------------------------------------------------------------
|
||||
# Puche 2021 / 2022+ jokob jokob@duck.com GNU GPLv3
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# IMPORTS
|
||||
#===============================================================================
|
||||
#from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import time
|
||||
import datetime
|
||||
import multiprocessing
|
||||
|
||||
# pialert modules
|
||||
import conf
|
||||
from const import *
|
||||
from logger import mylog
|
||||
from helper import filePermissions, isNewVersion, timeNow, updateState
|
||||
from api import update_api
|
||||
from networkscan import process_scan, scan_network
|
||||
from initialise import importConfigs
|
||||
from mac_vendor import update_devices_MAC_vendors
|
||||
from database import DB, get_all_devices
|
||||
from reporting import check_and_run_event, send_notifications
|
||||
from plugin import run_plugin_scripts
|
||||
|
||||
# different scanners
|
||||
from scanners.pholusscan import performPholusScan
|
||||
from scanners.nmapscan import performNmapScan
|
||||
from scanners.internet import check_internet_IP
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#===============================================================================
|
||||
# MAIN
|
||||
#===============================================================================
|
||||
#===============================================================================
|
||||
"""
|
||||
main structure of Pi Alert
|
||||
|
||||
Initialise All
|
||||
start Loop forever
|
||||
initialise loop
|
||||
(re)import config
|
||||
(re)import plugin config
|
||||
run plugins (once)
|
||||
run frontend events
|
||||
update API
|
||||
run scans
|
||||
run plugins (scheduled)
|
||||
check internet IP
|
||||
check vendor
|
||||
run PHOLUS
|
||||
run NMAP
|
||||
run "scan_network()"
|
||||
ARP Scan
|
||||
PiHole copy db
|
||||
PiHole DHCP leases
|
||||
processing scan results
|
||||
run plugins (after Scan)
|
||||
reporting
|
||||
cleanup
|
||||
end loop
|
||||
"""
|
||||
|
||||
def main ():
|
||||
mylog('debug', ['[MAIN] Setting up ...'])
|
||||
|
||||
conf.time_started = datetime.datetime.now()
|
||||
conf.cycle = ""
|
||||
conf.check_report = [1, "internet_IP", "update_vendors_silent"]
|
||||
conf.plugins_once_run = False
|
||||
|
||||
# to be deleted if not used
|
||||
conf.log_timestamp = conf.time_started
|
||||
#cron_instance = Cron()
|
||||
|
||||
# timestamps of last execution times
|
||||
startTime = conf.time_started
|
||||
now_minus_24h = conf.time_started - datetime.timedelta(hours = 24)
|
||||
|
||||
# set these times to the past to force the first run
|
||||
last_network_scan = now_minus_24h
|
||||
last_internet_IP_scan = now_minus_24h
|
||||
last_scan_run = now_minus_24h
|
||||
last_cleanup = now_minus_24h
|
||||
last_update_vendors = conf.time_started - datetime.timedelta(days = 6) # update vendors 24h after first run and then once a week
|
||||
last_version_check = now_minus_24h
|
||||
|
||||
# indicates, if a new version is available
|
||||
conf.newVersionAvailable = False
|
||||
|
||||
# check file permissions and fix if required
|
||||
filePermissions()
|
||||
|
||||
# Open DB once and keep open
|
||||
# Opening / closing DB frequently actually casues more issues
|
||||
db = DB() # instance of class DB
|
||||
db.open()
|
||||
sql = db.sql # To-Do replace with the db class
|
||||
|
||||
# Upgrade DB if needed
|
||||
db.upgradeDB()
|
||||
|
||||
#===============================================================================
|
||||
# This is the main loop of Pi.Alert
|
||||
#===============================================================================
|
||||
while True:
|
||||
|
||||
# update time started
|
||||
loop_start_time = timeNow()
|
||||
mylog('debug', '[MAIN] Starting loop')
|
||||
|
||||
# re-load user configuration and plugins
|
||||
importConfigs(db)
|
||||
|
||||
# check if new version is available / only check once an hour
|
||||
# if newVersionAvailable is already true the function does nothing and returns true again
|
||||
mylog('debug', [f"[Version check] Last version check timestamp: {last_version_check}"])
|
||||
if last_version_check + datetime.timedelta(hours=1) < loop_start_time :
|
||||
last_version_check = loop_start_time
|
||||
conf.newVersionAvailable = isNewVersion(conf.newVersionAvailable)
|
||||
|
||||
# Handle plugins executed ONCE
|
||||
if conf.ENABLE_PLUGINS and conf.plugins_once_run == False:
|
||||
run_plugin_scripts(db, 'once')
|
||||
conf.plugins_once_run = True
|
||||
|
||||
# check if there is a front end initiated event which needs to be executed
|
||||
check_and_run_event(db)
|
||||
|
||||
# Update API endpoints
|
||||
update_api(db)
|
||||
|
||||
# proceed if 1 minute passed
|
||||
if last_scan_run + datetime.timedelta(minutes=1) < loop_start_time :
|
||||
|
||||
# last time any scan or maintenance/upkeep was run
|
||||
last_scan_run = loop_start_time
|
||||
|
||||
# Header
|
||||
updateState(db,"Process: Start")
|
||||
|
||||
# Timestamp
|
||||
startTime = loop_start_time
|
||||
startTime = startTime.replace (microsecond=0)
|
||||
|
||||
# Check if any plugins need to run on schedule
|
||||
if conf.ENABLE_PLUGINS:
|
||||
run_plugin_scripts(db,'schedule')
|
||||
|
||||
# determine run/scan type based on passed time
|
||||
# --------------------------------------------
|
||||
|
||||
# check for changes in Internet IP
|
||||
if last_internet_IP_scan + datetime.timedelta(minutes=3) < loop_start_time:
|
||||
conf.cycle = 'internet_IP'
|
||||
last_internet_IP_scan = loop_start_time
|
||||
check_internet_IP(db)
|
||||
|
||||
# Update vendors once a week
|
||||
if last_update_vendors + datetime.timedelta(days = 7) < loop_start_time:
|
||||
last_update_vendors = loop_start_time
|
||||
conf.cycle = 'update_vendors'
|
||||
mylog('verbose', ['[MAIN] cycle:',conf.cycle])
|
||||
update_devices_MAC_vendors(db)
|
||||
|
||||
# Execute scheduled or one-off Pholus scan if enabled and run conditions fulfilled
|
||||
if conf.PHOLUS_RUN == "schedule" or conf.PHOLUS_RUN == "once":
|
||||
|
||||
pholusSchedule = [sch for sch in conf.mySchedules if sch.service == "pholus"][0]
|
||||
run = False
|
||||
|
||||
# run once after application starts
|
||||
|
||||
|
||||
if conf.PHOLUS_RUN == "once" and pholusSchedule.last_run == 0:
|
||||
run = True
|
||||
|
||||
# run if overdue scheduled time
|
||||
if conf.PHOLUS_RUN == "schedule":
|
||||
run = pholusSchedule.runScheduleCheck()
|
||||
|
||||
if run:
|
||||
pholusSchedule.last_run = datetime.datetime.now(conf.tz).replace(microsecond=0)
|
||||
performPholusScan(db, conf.PHOLUS_RUN_TIMEOUT, conf.userSubnets)
|
||||
|
||||
# Execute scheduled or one-off Nmap scan if enabled and run conditions fulfilled
|
||||
if conf.NMAP_RUN == "schedule" or conf.NMAP_RUN == "once":
|
||||
|
||||
nmapSchedule = [sch for sch in conf.mySchedules if sch.service == "nmap"][0]
|
||||
run = False
|
||||
|
||||
# run once after application starts
|
||||
if conf.NMAP_RUN == "once" and nmapSchedule.last_run == 0:
|
||||
run = True
|
||||
|
||||
# run if overdue scheduled time
|
||||
if conf.NMAP_RUN == "schedule":
|
||||
run = nmapSchedule.runScheduleCheck()
|
||||
|
||||
if run:
|
||||
nmapSchedule.last_run = timeNow()
|
||||
performNmapScan(db, get_all_devices(db))
|
||||
|
||||
# Perform a network scan via arp-scan or pihole
|
||||
if last_network_scan + datetime.timedelta(minutes=conf.SCAN_CYCLE_MINUTES) < loop_start_time:
|
||||
last_network_scan = loop_start_time
|
||||
conf.cycle = 1 # network scan
|
||||
mylog('verbose', ['[MAIN] cycle:',conf.cycle])
|
||||
updateState(db,"Scan: Network")
|
||||
|
||||
# scan_network()
|
||||
|
||||
# DEBUG start ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# Start scan_network as a process
|
||||
|
||||
p = multiprocessing.Process(target=scan_network(db))
|
||||
p.start()
|
||||
|
||||
# Wait for 3600 seconds (max 1h) or until process finishes
|
||||
p.join(3600)
|
||||
|
||||
# If thread is still active
|
||||
if p.is_alive():
|
||||
mylog('none', "[MAIN] scan_network running too long - let\'s kill it")
|
||||
|
||||
# Terminate - may not work if process is stuck for good
|
||||
p.terminate()
|
||||
# OR Kill - will work for sure, no chance for process to finish nicely however
|
||||
# p.kill()
|
||||
|
||||
p.join()
|
||||
|
||||
# DEBUG end ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# Run splugin scripts which are set to run every timne after a scan finished
|
||||
if conf.ENABLE_PLUGINS:
|
||||
run_plugin_scripts(db,'always_after_scan')
|
||||
|
||||
# --------------------------------------------------
|
||||
# process all the scanned data into new devices
|
||||
mylog('debug', "[MAIN] start processig scan results")
|
||||
process_scan (db, conf.arpscan_devices )
|
||||
|
||||
# Reporting
|
||||
if conf.cycle in conf.check_report:
|
||||
# Check if new devices found
|
||||
sql.execute (sql_new_devices)
|
||||
newDevices = sql.fetchall()
|
||||
db.commitDB()
|
||||
|
||||
# new devices were found
|
||||
if len(newDevices) > 0:
|
||||
# run all plugins registered to be run when new devices are found
|
||||
if conf.ENABLE_PLUGINS:
|
||||
run_plugin_scripts(db, 'on_new_device')
|
||||
|
||||
# Scan newly found devices with Nmap if enabled
|
||||
if conf.NMAP_ACTIVE and len(newDevices) > 0:
|
||||
performNmapScan( db, newDevices)
|
||||
|
||||
# send all configured notifications
|
||||
send_notifications(db)
|
||||
|
||||
# clean up the DB once an hour
|
||||
if last_cleanup + datetime.timedelta(hours = 1) < loop_start_time:
|
||||
last_cleanup = loop_start_time
|
||||
conf.cycle = 'cleanup'
|
||||
mylog('verbose', ['[MAIN] cycle:',conf.cycle])
|
||||
db.cleanup_database(startTime, conf.DAYS_TO_KEEP_EVENTS, conf.PHOLUS_DAYS_DATA, conf.HRS_TO_KEEP_NEWDEV, conf.PLUGINS_KEEP_HIST)
|
||||
|
||||
# Commit SQL
|
||||
db.commitDB()
|
||||
|
||||
# Final message
|
||||
if conf.cycle != "":
|
||||
action = str(conf.cycle)
|
||||
if action == "1":
|
||||
action = "network_scan"
|
||||
mylog('verbose', ['[MAIN] Last action: ', action])
|
||||
conf.cycle = ""
|
||||
mylog('verbose', ['[MAIN] cycle:',conf.cycle])
|
||||
|
||||
# Footer
|
||||
updateState(db,"Process: Wait")
|
||||
mylog('verbose', ['[MAIN] Process: Wait'])
|
||||
else:
|
||||
# do something
|
||||
conf.cycle = ""
|
||||
mylog('verbose', ['[MAIN] waiting to start next loop'])
|
||||
|
||||
#loop
|
||||
time.sleep(5) # wait for N seconds
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# BEGIN
|
||||
#===============================================================================
|
||||
if __name__ == '__main__':
|
||||
mylog('debug', ['[__main__] Welcome to Pi.Alert'])
|
||||
sys.exit(main())
|
||||
96
pialert/api.py
Executable file
@@ -0,0 +1,96 @@
|
||||
import json
|
||||
|
||||
|
||||
# pialert modules
|
||||
import conf
|
||||
from const import (apiPath, sql_devices_all, sql_nmap_scan_all, sql_pholus_scan_all, sql_events_pending_alert,
|
||||
sql_settings, sql_plugins_events, sql_plugins_history, sql_plugins_objects,sql_language_strings)
|
||||
from logger import mylog
|
||||
from helper import write_file
|
||||
|
||||
apiEndpoints = []
|
||||
|
||||
#===============================================================================
|
||||
# API
|
||||
#===============================================================================
|
||||
def update_api(db, isNotification = False, updateOnlyDataSources = []):
|
||||
mylog('verbose', ['[API] Update API starting'])
|
||||
# return
|
||||
|
||||
folder = apiPath
|
||||
|
||||
# update notifications moved to reporting send_api()
|
||||
|
||||
# Save plugins
|
||||
if conf.ENABLE_PLUGINS:
|
||||
write_file(folder + 'plugins.json' , json.dumps({"data" : conf.plugins}))
|
||||
|
||||
# prepare database tables we want to expose
|
||||
dataSourcesSQLs = [
|
||||
["devices", sql_devices_all],
|
||||
["nmap_scan", sql_nmap_scan_all],
|
||||
["pholus_scan", sql_pholus_scan_all],
|
||||
["events_pending_alert", sql_events_pending_alert],
|
||||
["settings", sql_settings],
|
||||
["plugins_events", sql_plugins_events],
|
||||
["plugins_history", sql_plugins_history],
|
||||
["plugins_objects", sql_plugins_objects],
|
||||
["language_strings", sql_language_strings],
|
||||
["custom_endpoint", conf.API_CUSTOM_SQL],
|
||||
]
|
||||
|
||||
# Save selected database tables
|
||||
for dsSQL in dataSourcesSQLs:
|
||||
|
||||
if updateOnlyDataSources == [] or dsSQL[0] in updateOnlyDataSources:
|
||||
|
||||
api_endpoint_class(db, dsSQL[1], folder + 'table_' + dsSQL[0] + '.json')
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class api_endpoint_class:
|
||||
def __init__(self, db, query, path):
|
||||
|
||||
global apiEndpoints
|
||||
self.db = db
|
||||
self.query = query
|
||||
self.jsonData = db.get_table_as_json(self.query).json
|
||||
self.path = path
|
||||
self.fileName = path.split('/')[-1]
|
||||
self.hash = hash(json.dumps(self.jsonData))
|
||||
|
||||
# check if the endpoint needs to be updated
|
||||
found = False
|
||||
changed = False
|
||||
changedIndex = -1
|
||||
index = 0
|
||||
|
||||
# search previous endpoint states to check if API needs updating
|
||||
for endpoint in apiEndpoints:
|
||||
# match sql and API endpoint path
|
||||
if endpoint.query == self.query and endpoint.path == self.path:
|
||||
found = True
|
||||
if endpoint.hash != self.hash:
|
||||
changed = True
|
||||
changedIndex = index
|
||||
|
||||
index = index + 1
|
||||
|
||||
# cehck if API endpoints have changed or if it's a new one
|
||||
if not found or changed:
|
||||
|
||||
mylog('verbose', [f'[API] Updating {self.fileName} file in /front/api'])
|
||||
|
||||
write_file(self.path, json.dumps(self.jsonData))
|
||||
|
||||
if not found:
|
||||
apiEndpoints.append(self)
|
||||
|
||||
elif changed and changedIndex != -1 and changedIndex < len(apiEndpoints):
|
||||
# update hash
|
||||
apiEndpoints[changedIndex].hash = self.hash
|
||||
else:
|
||||
mylog('info', [f'[API] ERROR Updating {self.fileName}'])
|
||||
|
||||
125
pialert/conf.py
Executable file
@@ -0,0 +1,125 @@
|
||||
""" config related functions for Pi.Alert """
|
||||
|
||||
|
||||
# These are global variables, not config items and should not exist !
|
||||
mySettings = []
|
||||
mySettingsSQLsafe = []
|
||||
debug_force_notification = False
|
||||
cycle = 1
|
||||
userSubnets = []
|
||||
mySchedules = [] # bad solution for global - TO-DO
|
||||
plugins = [] # bad solution for global - TO-DO
|
||||
tz = ''
|
||||
|
||||
# modified time of the most recently imported config file
|
||||
# set to a small value to force import at first run
|
||||
lastImportedConfFile = 1.1
|
||||
|
||||
plugins_once_run = False
|
||||
newVersionAvailable = False
|
||||
time_started = ''
|
||||
check_report = []
|
||||
log_timestamp = 0
|
||||
arpscan_devices = []
|
||||
# for MQTT
|
||||
mqtt_connected_to_broker = False
|
||||
mqtt_sensors = []
|
||||
client = None # mqtt client
|
||||
# for notifications
|
||||
changedPorts_json_struc = None
|
||||
|
||||
|
||||
|
||||
# ACTUAL CONFIGRATION ITEMS set to defaults
|
||||
|
||||
# General
|
||||
ENABLE_ARPSCAN = True
|
||||
SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0']
|
||||
LOG_LEVEL = 'verbose'
|
||||
TIMEZONE = 'Europe/Berlin'
|
||||
ENABLE_PLUGINS = True
|
||||
PIALERT_WEB_PROTECTION = False
|
||||
PIALERT_WEB_PASSWORD = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
|
||||
INCLUDED_SECTIONS = ['internet', 'new_devices', 'down_devices', 'events', 'ports']
|
||||
SCAN_CYCLE_MINUTES = 5
|
||||
DAYS_TO_KEEP_EVENTS = 90
|
||||
REPORT_DASHBOARD_URL = 'http://pi.alert/'
|
||||
DIG_GET_IP_ARG = '-4 myip.opendns.com @resolver1.opendns.com'
|
||||
UI_LANG = 'English'
|
||||
UI_PRESENCE = ['online', 'offline', 'archived']
|
||||
|
||||
|
||||
|
||||
# Email
|
||||
REPORT_MAIL = False
|
||||
SMTP_SERVER = ''
|
||||
SMTP_PORT = 587
|
||||
REPORT_TO = 'user@gmail.com'
|
||||
REPORT_FROM = 'Pi.Alert <user@gmail.com>'
|
||||
SMTP_SKIP_LOGIN = False
|
||||
SMTP_USER = ''
|
||||
SMTP_PASS = ''
|
||||
SMTP_SKIP_TLS = False
|
||||
SMTP_FORCE_SSL = False
|
||||
|
||||
# Webhooks
|
||||
REPORT_WEBHOOK = False
|
||||
WEBHOOK_URL = ''
|
||||
WEBHOOK_PAYLOAD = 'json'
|
||||
WEBHOOK_REQUEST_METHOD = 'GET'
|
||||
|
||||
# Apprise
|
||||
REPORT_APPRISE = False
|
||||
APPRISE_HOST = ''
|
||||
APPRISE_URL = ''
|
||||
APPRISE_PAYLOAD = 'html'
|
||||
|
||||
# NTFY
|
||||
REPORT_NTFY = False
|
||||
NTFY_HOST ='https://ntfy.sh'
|
||||
NTFY_TOPIC =''
|
||||
NTFY_USER = ''
|
||||
NTFY_PASSWORD = ''
|
||||
|
||||
# PUSHSAFER
|
||||
REPORT_PUSHSAFER = False
|
||||
PUSHSAFER_TOKEN = 'ApiKey'
|
||||
|
||||
# MQTT
|
||||
REPORT_MQTT = False
|
||||
MQTT_BROKER = ''
|
||||
MQTT_PORT = 1883
|
||||
MQTT_USER = ''
|
||||
MQTT_PASSWORD = ''
|
||||
MQTT_QOS = 0
|
||||
MQTT_DELAY_SEC = 2
|
||||
|
||||
# DynDNS
|
||||
DDNS_ACTIVE = False
|
||||
DDNS_DOMAIN = 'your_domain.freeddns.org'
|
||||
DDNS_USER = 'dynu_user'
|
||||
DDNS_PASSWORD = 'A0000000B0000000C0000000D0000000'
|
||||
DDNS_UPDATE_URL = 'https://api.dynu.com/nic/update?'
|
||||
|
||||
# PiHole
|
||||
PIHOLE_ACTIVE = False
|
||||
DHCP_ACTIVE = False
|
||||
|
||||
# PHOLUS
|
||||
PHOLUS_ACTIVE = False
|
||||
PHOLUS_TIMEOUT = 20
|
||||
PHOLUS_FORCE = False
|
||||
PHOLUS_RUN = 'once'
|
||||
PHOLUS_RUN_TIMEOUT = 600
|
||||
PHOLUS_RUN_SCHD = '0 4 * * *'
|
||||
PHOLUS_DAYS_DATA = 0
|
||||
|
||||
# Nmap
|
||||
NMAP_ACTIVE = True
|
||||
NMAP_TIMEOUT = 150
|
||||
NMAP_RUN = 'once'
|
||||
NMAP_RUN_SCHD = '0 2 * * *'
|
||||
NMAP_ARGS = '-p -10000 --max-parallelism 100'
|
||||
|
||||
# API
|
||||
API_CUSTOM_SQL = 'SELECT * FROM Devices WHERE dev_PresentLastScan = 0'
|
||||
54
pialert/const.py
Executable file
@@ -0,0 +1,54 @@
|
||||
""" CONSTANTS for Pi.Alert """
|
||||
|
||||
#===============================================================================
|
||||
# PATHS
|
||||
#===============================================================================
|
||||
pialertPath = '/home/pi/pialert'
|
||||
#pialertPath ='/home/roland/repos/Pi.Alert'
|
||||
|
||||
confPath = "/config/pialert.conf"
|
||||
dbPath = '/db/pialert.db'
|
||||
|
||||
|
||||
pluginsPath = pialertPath + '/front/plugins'
|
||||
logPath = pialertPath + '/front/log'
|
||||
apiPath = pialertPath + '/front/api/'
|
||||
fullConfPath = pialertPath + confPath
|
||||
fullDbPath = pialertPath + dbPath
|
||||
fullPholusPath = pialertPath+'/pholus/pholus3.py'
|
||||
|
||||
|
||||
vendorsDB = '/usr/share/arp-scan/ieee-oui.txt'
|
||||
piholeDB = '/etc/pihole/pihole-FTL.db'
|
||||
piholeDhcpleases = '/etc/pihole/dhcp.leases'
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# SQL queries
|
||||
#===============================================================================
|
||||
sql_devices_all = """select dev_MAC, dev_Name, dev_DeviceType, dev_Vendor, dev_Group,
|
||||
dev_FirstConnection, dev_LastConnection, dev_LastIP, dev_StaticIP,
|
||||
dev_PresentLastScan, dev_LastNotification, dev_NewDevice,
|
||||
dev_Network_Node_MAC_ADDR, dev_Network_Node_port,
|
||||
dev_Icon from Devices"""
|
||||
sql_devices_stats = """SELECT Online_Devices as online, Down_Devices as down, All_Devices as 'all', Archived_Devices as archived,
|
||||
(select count(*) from Devices a where dev_NewDevice = 1 ) as new,
|
||||
(select count(*) from Devices a where dev_Name = '(unknown)' or dev_Name = '(name not found)' ) as unknown
|
||||
from Online_History order by Scan_Date desc limit 1"""
|
||||
sql_nmap_scan_all = "SELECT * FROM Nmap_Scan"
|
||||
sql_pholus_scan_all = "SELECT * FROM Pholus_Scan"
|
||||
sql_events_pending_alert = "SELECT * FROM Events where eve_PendingAlertEmail is not 0"
|
||||
sql_settings = "SELECT * FROM Settings"
|
||||
sql_plugins_objects = "SELECT * FROM Plugins_Objects"
|
||||
sql_language_strings = "SELECT * FROM Plugins_Language_Strings"
|
||||
sql_plugins_events = "SELECT * FROM Plugins_Events"
|
||||
sql_plugins_history = "SELECT * FROM Plugins_History ORDER BY 'Index' DESC"
|
||||
sql_new_devices = """SELECT * FROM (
|
||||
SELECT eve_IP as dev_LastIP, eve_MAC as dev_MAC
|
||||
FROM Events_Devices
|
||||
WHERE eve_PendingAlertEmail = 1
|
||||
AND eve_EventType = 'New Device'
|
||||
ORDER BY eve_DateTime ) t1
|
||||
LEFT JOIN
|
||||
( SELECT dev_Name, dev_MAC as dev_MAC_t2 FROM Devices) t2
|
||||
ON t1.dev_MAC = t2.dev_MAC_t2"""
|
||||