mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Merge branch 'main' of https://github.com/jokob-sk/Pi.Alert
This commit is contained in:
11
.github/workflows/docker_dev.yml
vendored
11
.github/workflows/docker_dev.yml
vendored
@@ -53,6 +53,13 @@ jobs:
|
|||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
type=sha
|
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
|
- name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@@ -68,5 +75,5 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=registry,ref=docker.io/jokobsk/pi.alert:buildcache
|
cache-from: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache
|
||||||
cache-to: type=registry,ref=docker.io/jokobsk/pi.alert:buildcache,mode=max
|
cache-to: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache,mode=max
|
||||||
|
|||||||
11
.github/workflows/docker_prod.yml
vendored
11
.github/workflows/docker_prod.yml
vendored
@@ -58,6 +58,13 @@ jobs:
|
|||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
|
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
|
- name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@@ -73,5 +80,5 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=registry,ref=docker.io/jokobsk/pi.alert:buildcache
|
cache-from: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache
|
||||||
cache-to: type=registry,ref=docker.io/jokobsk/pi.alert:buildcache,mode=max
|
cache-to: type=registry,ref=ghcr.io/jokob-sk/pi.alert:buildcache,mode=max
|
||||||
|
|||||||
@@ -1,14 +1,50 @@
|
|||||||
# Pi.Alert all split into modules
|
# Pi.Alert modules
|
||||||
|
|
||||||
I am trying to split this big original file into modules and gives me some nice challanges to solve.
|
The original pilaert.py code is now moved to this new folder and split into different modules.
|
||||||
Since the original code is all in one file, the original author has taken quite some shortcuts by defining lots of variables as global !!
|
|
||||||
These need to be changed now.
|
|
||||||
|
|
||||||
Here is the main structure
|
|
||||||
|
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
|--------|-----------|
|
|--------|-----------|
|
||||||
|pialert.py | The MAIN program of Pi.Alert|
|
|```__main__.py```| The MAIN program of Pi.Alert|
|
||||||
|const.py | A place to define the constants for Pi.Alert like log path or config path.|
|
|```__init__.py```| an empty init file|
|
||||||
|const.py| const.py holds the configuration variables and makes them availabe for all modules. It is also the <b>workaround</b> for the global variables until I can work them out|
|
|```README.md```| this readme file|
|
||||||
|api.py| |
|
|**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 |
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user