diff --git a/docs/DATABASE.md b/docs/DATABASE.md new file mode 100755 index 00000000..bfb8a620 --- /dev/null +++ b/docs/DATABASE.md @@ -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. | ![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, taht 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 + diff --git a/docs/README.md b/docs/README.md index c0209820..40c6db2a 100755 --- a/docs/README.md +++ b/docs/README.md @@ -37,6 +37,7 @@ There is also an in-app Help / FAQ section that should be answering frequently a - [New Version notifications](/docs/VERSIONS.md) - [Version history (legacy)](/docs/VERSIONS_HISTORY.md) - [Invalid JSON errors debug help](/docs/DEBUG_INVALID_JSON.md) +- [Database structure](/docs/DATABASE.md) Feel free to suggest or submit new docs via a PR. diff --git a/docs/img/DATABASE/CurrentScan.png b/docs/img/DATABASE/CurrentScan.png new file mode 100755 index 00000000..18411ac6 Binary files /dev/null and b/docs/img/DATABASE/CurrentScan.png differ diff --git a/docs/img/DATABASE/DHCP_Leases.png b/docs/img/DATABASE/DHCP_Leases.png new file mode 100755 index 00000000..6426cce1 Binary files /dev/null and b/docs/img/DATABASE/DHCP_Leases.png differ diff --git a/docs/img/DATABASE/Devices.png b/docs/img/DATABASE/Devices.png new file mode 100755 index 00000000..33e5bef0 Binary files /dev/null and b/docs/img/DATABASE/Devices.png differ diff --git a/docs/img/DATABASE/Events.png b/docs/img/DATABASE/Events.png new file mode 100755 index 00000000..bc858f9d Binary files /dev/null and b/docs/img/DATABASE/Events.png differ diff --git a/docs/img/DATABASE/Nmap_Scan.png b/docs/img/DATABASE/Nmap_Scan.png new file mode 100755 index 00000000..eb2fe490 Binary files /dev/null and b/docs/img/DATABASE/Nmap_Scan.png differ diff --git a/docs/img/DATABASE/Online_History.png b/docs/img/DATABASE/Online_History.png new file mode 100755 index 00000000..1e7b498c Binary files /dev/null and b/docs/img/DATABASE/Online_History.png differ diff --git a/docs/img/DATABASE/Parameters.png b/docs/img/DATABASE/Parameters.png new file mode 100755 index 00000000..a7eb8275 Binary files /dev/null and b/docs/img/DATABASE/Parameters.png differ diff --git a/docs/img/DATABASE/Pholus_Scan.png b/docs/img/DATABASE/Pholus_Scan.png new file mode 100755 index 00000000..953a5a2a Binary files /dev/null and b/docs/img/DATABASE/Pholus_Scan.png differ diff --git a/docs/img/DATABASE/PiHole_Network.png b/docs/img/DATABASE/PiHole_Network.png new file mode 100755 index 00000000..3a8ed0d9 Binary files /dev/null and b/docs/img/DATABASE/PiHole_Network.png differ diff --git a/docs/img/DATABASE/Plugins_Events.png b/docs/img/DATABASE/Plugins_Events.png new file mode 100755 index 00000000..15734054 Binary files /dev/null and b/docs/img/DATABASE/Plugins_Events.png differ diff --git a/docs/img/DATABASE/Plugins_History.png b/docs/img/DATABASE/Plugins_History.png new file mode 100755 index 00000000..376be88e Binary files /dev/null and b/docs/img/DATABASE/Plugins_History.png differ diff --git a/docs/img/DATABASE/Plugins_Language_Strings.png b/docs/img/DATABASE/Plugins_Language_Strings.png new file mode 100755 index 00000000..664a16dd Binary files /dev/null and b/docs/img/DATABASE/Plugins_Language_Strings.png differ diff --git a/docs/img/DATABASE/Plugins_Objects.png b/docs/img/DATABASE/Plugins_Objects.png new file mode 100755 index 00000000..064106bc Binary files /dev/null and b/docs/img/DATABASE/Plugins_Objects.png differ diff --git a/docs/img/DATABASE/ScanCycles.png b/docs/img/DATABASE/ScanCycles.png new file mode 100755 index 00000000..d3eaffc4 Binary files /dev/null and b/docs/img/DATABASE/ScanCycles.png differ diff --git a/docs/img/DATABASE/Sessions.png b/docs/img/DATABASE/Sessions.png new file mode 100755 index 00000000..311eab62 Binary files /dev/null and b/docs/img/DATABASE/Sessions.png differ diff --git a/docs/img/DATABASE/Settings.png b/docs/img/DATABASE/Settings.png new file mode 100755 index 00000000..adc7a3bb Binary files /dev/null and b/docs/img/DATABASE/Settings.png differ