mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Compare commits
88 Commits
55e7bed5a8
...
v24.7.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4453ea59af | ||
|
|
31ecd6ac8c | ||
|
|
8e8493f638 | ||
|
|
adf24cebb6 | ||
|
|
5ac609e68e | ||
|
|
7f0debb04a | ||
|
|
a51571bd70 | ||
|
|
3af1f67956 | ||
|
|
9143b90bdf | ||
|
|
a892b8b5fb | ||
|
|
db621a110e | ||
|
|
4a3598e840 | ||
|
|
a19e268ea7 | ||
|
|
e9319cace3 | ||
|
|
74b2432729 | ||
|
|
d65b07685f | ||
|
|
a8dc4099e8 | ||
|
|
9c368982ce | ||
|
|
662394618b | ||
|
|
147166e46e | ||
|
|
fb8a7432cd | ||
|
|
fa00fa3004 | ||
|
|
294cfe80f2 | ||
|
|
b45e82b2a0 | ||
|
|
bf2ce3262d | ||
|
|
f468903b00 | ||
|
|
d706a156c0 | ||
|
|
71c631d784 | ||
|
|
460d2f4658 | ||
|
|
f502d93854 | ||
|
|
68fb1b7cbb | ||
|
|
942908d074 | ||
|
|
1aeed6b433 | ||
|
|
698876065c | ||
|
|
7e554242c2 | ||
|
|
129ae92141 | ||
|
|
25647023d0 | ||
|
|
fe752192e1 | ||
|
|
0ea0cd5ee0 | ||
|
|
bac78e926d | ||
|
|
d6125ef4e2 | ||
|
|
bf90ee81c7 | ||
|
|
ae74f1f538 | ||
|
|
3ae0daad3c | ||
|
|
8e7e0afb1e | ||
|
|
d7d7306a85 | ||
|
|
4b26044427 | ||
|
|
0a9ae5e9d9 | ||
|
|
ade1d9997f | ||
|
|
578b992c5a | ||
|
|
52b293a662 | ||
|
|
bd52536107 | ||
|
|
9f44c0de01 | ||
|
|
41b5de9292 | ||
|
|
95d5dbcf68 | ||
|
|
0eff7cc3f1 | ||
|
|
f31c55d6c4 | ||
|
|
6049ba00c7 | ||
|
|
8e4bd246df | ||
|
|
07164429d5 | ||
|
|
cac33fde2b | ||
|
|
5f71e9fc92 | ||
|
|
d834708220 | ||
|
|
6ea3d14480 | ||
|
|
0a11ec5379 | ||
|
|
b65c8022d6 | ||
|
|
55440090fe | ||
|
|
75bcf42225 | ||
|
|
6db9cd2f61 | ||
|
|
eff98257d6 | ||
|
|
2f97c8fd55 | ||
|
|
f03f3f33b1 | ||
|
|
457059cae8 | ||
|
|
5afc82f33e | ||
|
|
06e24b4585 | ||
|
|
482902f6e4 | ||
|
|
6e6b99fa46 | ||
|
|
30f4cba3e5 | ||
|
|
e9c0bf151f | ||
|
|
70d117cb6d | ||
|
|
624e30842a | ||
|
|
7c22f209d1 | ||
|
|
760a3c981f | ||
|
|
b86ab576bd | ||
|
|
1b6e806830 | ||
|
|
612ff7c293 | ||
|
|
74fc7ecdbf | ||
|
|
b6451e6e76 |
4
.github/ISSUE_TEMPLATE/i-have-an-issue.yml
vendored
4
.github/ISSUE_TEMPLATE/i-have-an-issue.yml
vendored
@@ -1,5 +1,5 @@
|
||||
name: Bug Report
|
||||
description: 'When submitting an issue enable debug and have a look at the docs.'
|
||||
description: 'When submitting an issue enable LOG_LEVEL="trace" and have a look at the docs.'
|
||||
labels: ['bug 🐛']
|
||||
body:
|
||||
- type: checkboxes
|
||||
@@ -64,7 +64,7 @@ body:
|
||||
***Generally speaking, all bug reports should have logs provided.***
|
||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
||||
Additionally, any additional info? Screenshots? References? Anything that will give us more context about the issue you are encountering!
|
||||
You can use `tail -100 /app/front/log/app.log` in the container if you have troubles getting to the log files.
|
||||
You can use `tail -100 /app/front/log/app.log` in the container if you have trouble getting to the log files.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
|
||||
@@ -40,7 +40,7 @@ ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
|
||||
|
||||
RUN apk update --no-cache \
|
||||
&& apk add --no-cache bash zip lsblk gettext-envsubst sudo mtr tzdata s6-overlay \
|
||||
&& apk add --no-cache curl arp-scan iproute2 iproute2-ss nmap nmap-scripts traceroute net-tools net-snmp-tools bind-tools awake ca-certificates \
|
||||
&& apk add --no-cache curl arp-scan iproute2 iproute2-ss nmap nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \
|
||||
&& apk add --no-cache sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session \
|
||||
&& apk add --no-cache python3 nginx \
|
||||
&& apk add --no-cache dcron \
|
||||
|
||||
@@ -33,7 +33,7 @@ COPY --chmod=775 --chown=${USER_ID}:${USER_GID} . ${INSTALL_DIR}/
|
||||
RUN apt-get install -y \
|
||||
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 php-openssl \
|
||||
python3 python3-dev iproute2 nmap python3-pip zip systemctl usbutils traceroute
|
||||
python3 python3-dev iproute2 nmap python3-pip zip systemctl usbutils traceroute nbtscan
|
||||
|
||||
# Alternate dependencies
|
||||
RUN apt-get install nginx nginx-core mtr php-fpm php8.2-fpm php-cli php8.2 php8.2-sqlite3 -y
|
||||
|
||||
@@ -92,7 +92,7 @@ Thank you to all the wonderful people who are sponsoring this project.
|
||||
<!-- SPONSORS-LIST DO NOT MODIFY BELOW -->
|
||||
| All Sponsors |
|
||||
|---|
|
||||
| [fama-lama](https://github.com/fama-lama) |
|
||||
| [iptvcld](https://github.com/iptvcld) |
|
||||
|
||||
<!-- SPONSORS-LIST DO NOT MODIFY ABOVE -->
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@ DAYS_TO_KEEP_EVENTS=90
|
||||
# Used for generating links in emails. Make sure not to add a trailing slash!
|
||||
REPORT_DASHBOARD_URL='http://netalertx'
|
||||
|
||||
# Make sure at least these scanners are enabled for new installs, other defaults are taken from the config.json
|
||||
INTRNT_RUN='schedule'
|
||||
ARPSCAN_RUN='schedule'
|
||||
PHOLUS_RUN='on_new_device'
|
||||
NSLOOKUP_RUN='before_name_updates'
|
||||
|
||||
# Email
|
||||
#-------------------------------------
|
||||
|
||||
@@ -83,16 +83,17 @@ These are the most important settings to get at least some output in your Device
|
||||
|
||||
#### 🧭 Community guides
|
||||
|
||||
Use the official installation guides at first and use community content as suplementary material. Open an issue if you'd like to add your link to the list 🙏
|
||||
Use the official installation guides at first and use community content as supplementary material. Open an issue if you'd like to add your link to the list 🙏
|
||||
|
||||
- 📄 [How to Install Pi.Alert on Your Synology NAS - Marius hosting (English)](https://mariushosting.com/how-to-install-pi-alert-on-your-synology-nas/) (Updated frequently)
|
||||
- 📄 [Using the PiAlert Network Security Scanner on a Raspberry Pi - PiMyLifeUp (English)](https://pimylifeup.com/raspberry-pi-pialert/)
|
||||
- ▶ [How to Setup Pi.Alert on Your Synology NAS - Digital Aloha (English)](https://www.youtube.com/watch?v=M4YhpuRFaUg)
|
||||
- ▶ [Home Lab Network Monitoring - Scotti-BYTE Enterprise Consulting Services](https://www.youtube.com/watch?v=0DryhzrQSJA) (July 2024)
|
||||
- 📄 [How to Install NetAlertX on Your Synology NAS - Marius hosting](https://mariushosting.com/how-to-install-pi-alert-on-your-synology-nas/) (Updated frequently)
|
||||
- 📄 [Using the PiAlert Network Security Scanner on a Raspberry Pi - PiMyLifeUp](https://pimylifeup.com/raspberry-pi-pialert/)
|
||||
- ▶ [How to Setup Pi.Alert on Your Synology NAS - Digital Aloha](https://www.youtube.com/watch?v=M4YhpuRFaUg)
|
||||
- 📄 [시놀/헤놀에서 네트워크 스캐너 Pi.Alert Docker로 설치 및 사용하기 (Korean)](https://blog.dalso.org/article/%EC%8B%9C%EB%86%80-%ED%97%A4%EB%86%80%EC%97%90%EC%84%9C-%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC-%EC%8A%A4%EC%BA%90%EB%84%88-pi-alert-docker%EB%A1%9C-%EC%84%A4%EC%B9%98-%EB%B0%8F-%EC%82%AC%EC%9A%A9) (July 2023)
|
||||
- 📄 [网络入侵探测器Pi.Alert (Chinese)](https://codeantenna.com/a/VgUvIAjZ7J) (May 2023)
|
||||
- ▶ [Pi.Alert auf Synology & Docker by - Jürgen Barth (German)](https://www.youtube.com/watch?v=-ouvA2UNu-A) (March 2023)
|
||||
- ▶ [Top Docker Container for Home Server Security - VirtualizationHowto (English)](https://www.youtube.com/watch?v=tY-w-enLF6Q) (March 2023)
|
||||
- ▶ [Pi.Alert or WatchYourLAN can alert you to unknown devices appearing on your WiFi or LAN network - Danie van der Merwe (English)](https://www.youtube.com/watch?v=v6an9QG2xF0) (November 2022)
|
||||
- ▶ [Top Docker Container for Home Server Security - VirtualizationHowto](https://www.youtube.com/watch?v=tY-w-enLF6Q) (March 2023)
|
||||
- ▶ [Pi.Alert or WatchYourLAN can alert you to unknown devices appearing on your WiFi or LAN network - Danie van der Merwe](https://www.youtube.com/watch?v=v6an9QG2xF0) (November 2022)
|
||||
|
||||
> Ordered by last update time.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Please follow tips 1 - 4 to get a more detailed error.
|
||||
|
||||
When debugging an issue always set the highest log level:
|
||||
|
||||
`LOG_LEVEL='debug'`
|
||||
`LOG_LEVEL='trace'`
|
||||
|
||||
|
||||
## 2. Surfacing errors when container restarts 🔁
|
||||
|
||||
@@ -12,7 +12,7 @@ NetAlertX comes with a plugin system to feed events from third-party scripts int
|
||||
|
||||
### 🎥 Watch the video:
|
||||
|
||||
[](https://youtu.be/bjA7wIK_jXY)
|
||||
[](https://youtu.be/cdbxlwiWhv8)
|
||||
|
||||
### 📸 Screenshots
|
||||
|
||||
@@ -91,6 +91,16 @@ More on specifics below.
|
||||
|
||||
The `config.json` file is the manifest of the plugin. It contains mainly settings definitions and the mapping of Plugin objects to NetAlertX objects.
|
||||
|
||||
## Execution order
|
||||
|
||||
The execution order is used to specify wwhen a plugin is executed. This is useful if a plugin has access and surfaces more information than others. If a device is detected by 2 plugins and inserted into the `CurrentScan` table, the plugin with the higher priority (e.g.: `Level_0` is a higher priority than `Level_1`) will insert it's values first. These values (devices) will be then prioritized over any values inserted later.
|
||||
|
||||
```json
|
||||
{
|
||||
"execution_order" : "Layer_0"
|
||||
}
|
||||
```
|
||||
|
||||
## Supported data sources
|
||||
|
||||
Currently, these data sources are supported (valid `data_source` value).
|
||||
@@ -191,7 +201,7 @@ This SQL query is executed on the `app.db` SQLite database file.
|
||||
> ```json
|
||||
> {
|
||||
> "function": "CMD",
|
||||
> "type": "text",
|
||||
> "type": {"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [] ,"transformers": []}]},
|
||||
> "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"],
|
||||
@@ -222,7 +232,7 @@ For example for `PIHOLE` (`"unique_prefix": "PIHOLE"`) it is `EXTERNAL_PIHOLE.`.
|
||||
> ...
|
||||
>{
|
||||
> "function": "DB_PATH",
|
||||
> "type": "readonly",
|
||||
> "type": {"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [{"readonly": "true"}] ,"transformers": []}]},
|
||||
> "default_value":"/etc/pihole/pihole-FTL.db",
|
||||
> "options": [],
|
||||
> "localized": ["name", "description"],
|
||||
@@ -247,7 +257,7 @@ The actual SQL query you want to execute is then stored as a `CMD` setting, simi
|
||||
>```json
|
||||
>{
|
||||
> "function": "CMD",
|
||||
> "type": "text",
|
||||
> "type": {"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [] ,"transformers": []}]},
|
||||
> "default_value":"SELECT hwaddr as Object_PrimaryID, cast('http://' || (SELECT ip FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1) as VARCHAR(100)) || ':' || cast( SUBSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1), 0, INSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1), '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, macVendor as Watched_Value1, lastQuery as Watched_Value2, (SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC, ip LIMIT 1) as Watched_Value3, 'null' as Watched_Value4, '' as Extra, hwaddr as ForeignKey FROM EXTERNAL_PIHOLE.network WHERE hwaddr NOT LIKE 'ip-%' AND hwaddr <> '00:00:00:00:00:00'; ",
|
||||
> "options": [],
|
||||
> "localized": ["name", "description"],
|
||||
@@ -425,7 +435,7 @@ The `params` array in the `config.json` is used to enable the user to change the
|
||||
```json
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [] ,"transformers": []}]},
|
||||
"default_value":"python3 /app/front/plugins/website_monitor/script.py urls={urls}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -508,18 +518,7 @@ Required attributes are:
|
||||
| -------- | ----------- |
|
||||
| `"function"` | Specifies the function the setting drives or a simple unique code name. See Supported settings function values for options. |
|
||||
| `"type"` | Specifies the form control used for the setting displayed in the Settings page and what values are accepted. Supported options include: |
|
||||
| | - `text` |
|
||||
| | - `integer` |
|
||||
| | - `boolean` |
|
||||
| | - `password` |
|
||||
| | - `readonly` |
|
||||
| | - `integer.select` |
|
||||
| | - `text.select` |
|
||||
| | - `text.multiselect` |
|
||||
| | - `list` |
|
||||
| | - `list.select` |
|
||||
| | - `integer.checkbox` |
|
||||
| | - `text.template` |
|
||||
| | - `{"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [{"type":"password"}] ,"transformers": ["sha256"]}]}` |
|
||||
| `"localized"` | A list of properties on the current JSON level that need to be localized. |
|
||||
| `"name"` | Displayed on the Settings page. An array of localized strings. See Localized strings below. |
|
||||
| `"description"` | Displayed on the Settings page. An array of localized strings. See Localized strings below. |
|
||||
@@ -562,7 +561,7 @@ You can have any `"function": "my_custom_name"` custom name, however, the ones l
|
||||
> ```json
|
||||
> {
|
||||
> "function": "RUN",
|
||||
> "type": "text.select",
|
||||
> "type": {"dataType":"string", "elements": [{"elementType" : "select", "elementOptions" : [] ,"transformers": []}]},
|
||||
> "default_value":"disabled",
|
||||
> "options": ["disabled", "once", "schedule", "always_after_scan", "on_new_device"],
|
||||
> "localized": ["name", "description"],
|
||||
@@ -627,7 +626,7 @@ The UI will adjust how columns are displayed in the UI based on the resolvers de
|
||||
|
||||
```json
|
||||
"function": "dev_DeviceType",
|
||||
"type": "text.select",
|
||||
"type": {"dataType":"string", "elements": [{"elementType" : "select", "elementOptions" : [] ,"transformers": []}]},
|
||||
"maxLength": 30,
|
||||
"default_value": "",
|
||||
"options": ["{value}"],
|
||||
|
||||
@@ -25,13 +25,27 @@
|
||||
color:white;
|
||||
background-color: black;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: .85em;
|
||||
|
||||
}
|
||||
.logs-row textarea
|
||||
{
|
||||
width: 100%;
|
||||
}
|
||||
.logs-row button{
|
||||
#tab_Logging .actions{
|
||||
display:contents;
|
||||
position: relative;
|
||||
padding: 0.4em
|
||||
|
||||
}
|
||||
|
||||
#tab_Logging .actions .toggle{
|
||||
|
||||
margin: 0.5em;
|
||||
height: 3em;
|
||||
}
|
||||
|
||||
.logs-row .button{
|
||||
margin: 2px;
|
||||
}
|
||||
.logs-row
|
||||
@@ -54,7 +68,7 @@
|
||||
}
|
||||
.logs-small
|
||||
{
|
||||
height: 100px;
|
||||
height: 150px;
|
||||
}
|
||||
.log-file
|
||||
{
|
||||
@@ -218,9 +232,15 @@
|
||||
.content-wrapper,
|
||||
.right-side,
|
||||
.main-footer {
|
||||
margin-left: 150px;
|
||||
margin-left: 150px;
|
||||
}
|
||||
|
||||
#settingsPage
|
||||
{
|
||||
display: grid;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.main-header .logo {
|
||||
width: 100%;
|
||||
@@ -235,6 +255,15 @@
|
||||
.main-footer {
|
||||
margin-left: 0px;
|
||||
}
|
||||
.fixed .content-wrapper, .fixed .right-side {
|
||||
padding-top: 50px;
|
||||
}
|
||||
.main-sidebar {
|
||||
padding-top: 50px;
|
||||
}
|
||||
.content-header {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-open .content-wrapper,
|
||||
@@ -1116,7 +1145,7 @@ input[readonly] {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#dropdownIcon li svg, #dropdownIcon li i{
|
||||
#dropdownIcon li svg, #dropdownIcon li i, .dropdownIcon li svg, .dropdownIcon li i, .icon-maxsize svg, .icon-maxsize i{
|
||||
height: 1.5em !important;
|
||||
}
|
||||
|
||||
@@ -1251,6 +1280,21 @@ input[readonly] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.networkNodeTabHeaders
|
||||
{
|
||||
max-width: 200px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
||||
.networkNodeTabHeaders .node-name
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* PLUGINS page */
|
||||
|
||||
@@ -824,20 +824,20 @@ function initializeCombos () {
|
||||
initializeCombo ( '#dropdownDevices', 'getDevices', 'txtFromDevice', false);
|
||||
|
||||
// Initiate dropdown
|
||||
// function initSettingDropdown(settingKey, // Identifier for the setting
|
||||
// valuesArray, // Array of values to be pre-selected in the dropdown
|
||||
// targetLocation, // ID of the HTML element where dropdown should be rendered (will be replaced)
|
||||
// callbackToGenerateEntries, // Callback function to generate entries based on options
|
||||
// targetField, // Target field or element where selected value should be applied or updated
|
||||
// nameTransformer) // callback to transform name
|
||||
// generateSetOptions(settingKey, // Identifier for the setting
|
||||
// valuesArray, // Array of values to be pre-selected in the dropdown
|
||||
// targetLocation, // ID of the HTML element where dropdown should be rendered (will be replaced)
|
||||
// callbackToGenerateEntries, // Callback function to generate entries based on options
|
||||
// targetField, // Target field or element where selected value should be applied or updated
|
||||
// nameTransformer) // callback to transform name
|
||||
|
||||
|
||||
initSettingDropdown("NEWDEV_dev_Icon", [], "dropdownIcon_tmp", genListWithInputSet, 'txtIcon', atob )
|
||||
initSettingDropdown("NEWDEV_dev_DeviceType", [], "dropdownDeviceType_tmp", genListWithInputSet, 'txtDeviceType' )
|
||||
initSettingDropdown("NEWDEV_dev_Owner", [], "dropdownOwner_tmp", genListWithInputSet, 'txtOwner' )
|
||||
initSettingDropdown("NEWDEV_dev_Group", [], "dropdownGroup_tmp", genListWithInputSet, 'txtGroup' )
|
||||
initSettingDropdown("NEWDEV_dev_Location", [], "dropdownLocation_tmp", genListWithInputSet, 'txtLocation' )
|
||||
initSettingDropdown("NEWDEV_dev_Network_Node_MAC_ADDR", [], "dropdownNetworkNodeMac_tmp", genListWithInputSet, 'txtNetworkNodeMac' )
|
||||
generateOptionsOrSetOptions("NEWDEV_dev_Icon", [], "dropdownIcon_tmp", genListWithInputSet, 'txtIcon', ["base64"])
|
||||
generateOptionsOrSetOptions("NEWDEV_dev_DeviceType", [], "dropdownDeviceType_tmp", genListWithInputSet, 'txtDeviceType' )
|
||||
generateOptionsOrSetOptions("NEWDEV_dev_Owner", [], "dropdownOwner_tmp", genListWithInputSet, 'txtOwner' )
|
||||
generateOptionsOrSetOptions("NEWDEV_dev_Group", [], "dropdownGroup_tmp", genListWithInputSet, 'txtGroup' )
|
||||
generateOptionsOrSetOptions("NEWDEV_dev_Location", [], "dropdownLocation_tmp", genListWithInputSet, 'txtLocation' )
|
||||
generateOptionsOrSetOptions("NEWDEV_dev_Network_Node_MAC_ADDR", [], "dropdownNetworkNodeMac_tmp", genListWithInputSet, 'txtNetworkNodeMac' )
|
||||
|
||||
// Initialize static combos
|
||||
initializeComboSkipRepeated ();
|
||||
|
||||
@@ -124,8 +124,10 @@ function cacheSettings()
|
||||
settingsData.forEach((set) => {
|
||||
|
||||
resolvedOptions = createArray(set.Options)
|
||||
resolvedOptionsOld = resolvedOptions
|
||||
setPlugObj = {};
|
||||
options_params = [];
|
||||
resolved = ""
|
||||
|
||||
// proceed only if first option item contains something to resolve
|
||||
if( !set.Code_Name.includes("__metadata") &&
|
||||
@@ -158,7 +160,7 @@ function cacheSettings()
|
||||
}
|
||||
}
|
||||
|
||||
setCache(`pia_set_${set.Code_Name}`, set.Value)
|
||||
setCache(`pia_set_${set.Code_Name}`, set.Value)
|
||||
setCache(`pia_set_opt_${set.Code_Name}`, resolvedOptions)
|
||||
});
|
||||
}).then(() => handleSuccess('cacheSettings', resolve())).catch(() => handleFailure('cacheSettings', reject("cacheSettings already completed"))); // handle AJAX synchronization
|
||||
@@ -179,6 +181,7 @@ function getSettingOptions (key) {
|
||||
if (result == "")
|
||||
{
|
||||
console.log(`Setting options with key "${key}" not found`)
|
||||
result = []
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -743,10 +746,14 @@ function isRandomMAC(mac)
|
||||
// ---------------------------------------------------------
|
||||
// Generate an array object from a string representation of an array
|
||||
function createArray(input) {
|
||||
// Empty array
|
||||
if (input === '[]') {
|
||||
return [];
|
||||
// Is already array, return
|
||||
if (Array.isArray(input)) {
|
||||
return input;
|
||||
}
|
||||
// Empty array
|
||||
if (input === '[]' || input === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Regex pattern for brackets
|
||||
const patternBrackets = /(^\s*\[)|(\]\s*$)/g;
|
||||
@@ -945,7 +952,8 @@ function updateApi()
|
||||
{
|
||||
|
||||
// value has to be in format event|param. e.g. run|ARPSCAN
|
||||
action = `update_api|devices,appevents`
|
||||
action = `${getGuid()}|update_api|devices,appevents`
|
||||
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
|
||||
@@ -2,51 +2,108 @@
|
||||
// General utilities to interact with the database
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// // Call to render lists
|
||||
// renderList(
|
||||
// options,
|
||||
// callbackToGenerateEntries,
|
||||
// valuesArray,
|
||||
// placeholder,
|
||||
// targetField,
|
||||
// transformers
|
||||
// );
|
||||
|
||||
// --------------------------------------------------
|
||||
// Read data and place intotarget location, callback processies the results
|
||||
function readData(sqlQuery, processDataCallback, valuesArray, targetLocation, targetField, nameTransformer) {
|
||||
var apiUrl = `php/server/dbHelper.php?action=read&rawSql=${encodeURIComponent(sqlQuery)}`;
|
||||
$.get(apiUrl, function(data) {
|
||||
// Process the JSON data using the provided callback function
|
||||
function renderList(
|
||||
options,
|
||||
processDataCallback,
|
||||
valuesArray,
|
||||
placeholder,
|
||||
targetField,
|
||||
transformers
|
||||
) {
|
||||
// Check if there are options provided
|
||||
if (options.length > 0) {
|
||||
// Determine if the first option's name is an SQL query
|
||||
const sqlQuery = isSQLQuery(options[0].name) ? options[0].name : "";
|
||||
|
||||
data = JSON.parse(data)
|
||||
// If there is an SQL query, fetch additional options
|
||||
if (sqlQuery) {
|
||||
// remove first item containing the SQL query
|
||||
options.shift();
|
||||
|
||||
var htmlResult = processDataCallback(data, valuesArray, targetField, nameTransformer);
|
||||
const apiUrl = `php/server/dbHelper.php?action=read&rawSql=${encodeURIComponent(sqlQuery)}`;
|
||||
|
||||
// Place the resulting HTML into the specified placeholder div
|
||||
$("#" + targetLocation).replaceWith(htmlResult);
|
||||
});
|
||||
$.get(apiUrl, function (sqlOptionsData) {
|
||||
|
||||
// Parse the returned SQL data
|
||||
const sqlOption = JSON.parse(sqlOptionsData);
|
||||
|
||||
// Concatenate options from SQL query with the supplied options
|
||||
options = options.concat(sqlOption);
|
||||
|
||||
|
||||
// Process the combined options
|
||||
setTimeout(() => {
|
||||
processDataCallback(
|
||||
options,
|
||||
valuesArray,
|
||||
targetField,
|
||||
transformers,
|
||||
placeholder
|
||||
);
|
||||
}, 1);
|
||||
});
|
||||
} else {
|
||||
// No SQL query, directly process the supplied options
|
||||
setTimeout(() => {
|
||||
processDataCallback(
|
||||
options,
|
||||
valuesArray,
|
||||
targetField,
|
||||
transformers,
|
||||
placeholder
|
||||
);
|
||||
}, 1);
|
||||
}
|
||||
} else {
|
||||
// No options provided, directly process with empty options
|
||||
setTimeout(() => {
|
||||
processDataCallback(
|
||||
options,
|
||||
valuesArray,
|
||||
targetField,
|
||||
transformers,
|
||||
placeholder
|
||||
);
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------
|
||||
// Check if database is locked
|
||||
function checkDbLock() {
|
||||
$.ajax({
|
||||
url: 'log/db_is_locked.log', // Replace with the actual path to your PHP file
|
||||
type: 'GET',
|
||||
|
||||
success: function(response) {
|
||||
// console.log(response);
|
||||
if (response == 0) {
|
||||
// console.log('Database is not locked');
|
||||
$(".header-status-locked-db").hide()
|
||||
|
||||
} else {
|
||||
console.log('🟥 Database is locked:');
|
||||
console.log(response);
|
||||
$(".header-status-locked-db").show()
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
console.log('🟥 Error checking database lock status');
|
||||
$(".header-status-locked-db").show()
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: "log/db_is_locked.log", // Replace with the actual path to your PHP file
|
||||
type: "GET",
|
||||
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
if (response == 0) {
|
||||
// console.log('Database is not locked');
|
||||
$(".header-status-locked-db").hide();
|
||||
} else {
|
||||
console.log("🟥 Database is locked:");
|
||||
console.log(response);
|
||||
$(".header-status-locked-db").show();
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
console.log("🟥 Error checking database lock status");
|
||||
$(".header-status-locked-db").show();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(checkDbLock(), 1000);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -78,42 +78,50 @@ function initDeviceSelectors() {
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Initiate dropdown
|
||||
function initSettingDropdown(settingKey, // Identifier for the setting
|
||||
valuesArray, // Array of values to be pre-selected in the dropdown
|
||||
targetLocation, // ID of the HTML element where dropdown should be rendered (will be replaced)
|
||||
callbackToGenerateEntries, // Callback function to generate entries based on options
|
||||
targetField, // Target field or element where selected value should be applied or updated
|
||||
nameTransformer) // callback to transform the name (e.g. base64)
|
||||
{
|
||||
// // -----------------------------------------------------------------------------
|
||||
// // (ASYNC) Initiate dropdown
|
||||
// function generateSetOptions(settingKey, // Identifier for the setting
|
||||
// valuesArray, // Array of values to be pre-selected in the dropdown
|
||||
// targetLocation, // ID of the HTML element where dropdown should be rendered (will be replaced)
|
||||
// callbackToGenerateEntries, // Callback function to generate entries based on options
|
||||
// targetField, // Target field or element where selected value should be applied or updated
|
||||
// nameTransformer) // callback to transform the name (e.g. base64)
|
||||
// {
|
||||
|
||||
var optionsHtml = ""
|
||||
// var optionsHtml = ""
|
||||
|
||||
// NOTE {value} options to replace with a setting or SQL value are handled in the cacheSettings() function
|
||||
optionsArray = createArray(getSettingOptions(settingKey))
|
||||
// // NOTE {value} options to replace with a setting or SQL value are handled in the cacheSettings() function
|
||||
// optionsArray = createArray(getSettingOptions(settingKey))
|
||||
|
||||
// check if the result is a SQL query
|
||||
if(isSQLQuery(optionsArray[0]))
|
||||
{
|
||||
readData(optionsArray[0], callbackToGenerateEntries, valuesArray, targetLocation, targetField, nameTransformer);
|
||||
|
||||
} else // this should be already an array, e.g. from a setting or pre-defined
|
||||
{
|
||||
optionsArray.forEach(option => {
|
||||
let selected = valuesArray.includes(option) ? 'selected' : '';
|
||||
optionsHtml += `<option value="${option}" ${selected}>${option}</option>`;
|
||||
});
|
||||
|
||||
// Replace the specified placeholder div with the resulting HTML
|
||||
setTimeout(() => {
|
||||
// // check if the result is a SQL query
|
||||
// if(optionsArray.length > 0 && isSQLQuery(optionsArray[0]))
|
||||
// {
|
||||
|
||||
$("#" + targetLocation).replaceWith(optionsHtml);
|
||||
// if (settingKey == "NEWDEV_dev_Network_Node_MAC_ADDR") {
|
||||
// console.log("isSQLQuery in generateSetOptions");
|
||||
|
||||
// }
|
||||
// readData(optionsArray[0], callbackToGenerateEntries, valuesArray, targetLocation, targetField, nameTransformer);
|
||||
|
||||
// } else // this should be already an array, e.g. from a setting or pre-defined
|
||||
// {
|
||||
// optionsArray.forEach(option => {
|
||||
// let selected = valuesArray.includes(option) ? 'selected' : '';
|
||||
// optionsHtml += `<option value="${option}" ${selected}>${option}</option>`;
|
||||
// });
|
||||
|
||||
// // Replace the specified placeholder div with the resulting HTML
|
||||
// setTimeout(() => {
|
||||
|
||||
// $("#" + targetLocation).replaceWith(optionsHtml);
|
||||
|
||||
}, 50);
|
||||
|
||||
}
|
||||
}
|
||||
// }, 50);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -145,86 +153,6 @@ function hideUIelements(settingKey) {
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Data processors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Processor to generate options for a dropdown menu
|
||||
function generateDropdownOptions(data, valuesArray, targetField, nameTransformer) {
|
||||
var optionsHtml = "";
|
||||
data.forEach(function(item) {
|
||||
|
||||
labelName = item.name
|
||||
|
||||
// console.log(nameTransformer);
|
||||
// console.log(labelName);
|
||||
|
||||
// if(nameTransformer && nameTransformer != '' && labelName != '❌None')
|
||||
// {
|
||||
// console.log(labelName);
|
||||
// labelName = nameTransformer(labelName)
|
||||
// console.log(labelName);
|
||||
// }
|
||||
|
||||
let selected = valuesArray.includes(item.id) ? 'selected' : '';
|
||||
|
||||
optionsHtml += `<option value="${item.id}" ${selected}>${labelName}</option>`;
|
||||
});
|
||||
return `${optionsHtml}`;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Processor to generate a list
|
||||
function generateList(data, valuesArray, targetField, nameTransformer) {
|
||||
var listHtml = "";
|
||||
data.forEach(function(item) {
|
||||
|
||||
labelName = item.name
|
||||
|
||||
if(nameTransformer && nameTransformer != '' && labelName != '❌None')
|
||||
{
|
||||
labelName = nameTransformer(labelName)
|
||||
}
|
||||
|
||||
let selected = valuesArray.includes(item.id) ? 'selected' : '';
|
||||
|
||||
listHtml += `<li ${selected}>${labelName}</li>`;
|
||||
});
|
||||
|
||||
return listHtml;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Processor to generate a list in the deviceDetails page
|
||||
function genListWithInputSet(data, valuesArray, targetField, nameTransformer) {
|
||||
|
||||
var listHtml = "";
|
||||
|
||||
console.log(data);
|
||||
data.forEach(function(item) {
|
||||
|
||||
let selected = valuesArray.includes(item.id) ? 'selected' : '';
|
||||
|
||||
// console.log(item);
|
||||
|
||||
labelName = item.name
|
||||
|
||||
if(nameTransformer && nameTransformer != '' && labelName != '❌None')
|
||||
{
|
||||
labelName = nameTransformer(labelName)
|
||||
}
|
||||
|
||||
listHtml += `<li ${selected}>
|
||||
<a href="javascript:void(0)" onclick="setTextValue('${targetField}','${item.id}')">${labelName}</a>
|
||||
</li>`;
|
||||
|
||||
});
|
||||
|
||||
return listHtml;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -314,7 +242,7 @@ function getCellValue(row, index) {
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Calls a backend function to add a front-end event (specified by the attributes 'data-myevent' and 'data-myparam-plugin' on the passed element) to an execution queue
|
||||
function addToExecutionQueue(element)
|
||||
function addToExecutionQueue_settingEvent(element)
|
||||
{
|
||||
|
||||
// value has to be in format event|param. e.g. run|ARPSCAN
|
||||
|
||||
@@ -370,9 +370,27 @@ $db->close();
|
||||
</div>
|
||||
<div class="tab-pane" id="tab_BackupRestore">
|
||||
<div class="db_info_table">
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn bg-green dbtools-button" id="btnExportCSV" onclick="ExportCSV()"><?= lang('Maintenance_Tool_ExportCSV');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_ExportCSV_text');?></div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnPiaBackupDBtoArchive" onclick="askPiaBackupDBtoArchive()"><?= lang('Maintenance_Tool_backup');?></button>
|
||||
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnImportCSV" onclick="askImportCSV()"><?= lang('Maintenance_Tool_ImportCSV');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_ImportCSV_text');?></div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnImportPastedCSV" onclick="askImportPastedCSV()"><?= lang('Maintenance_Tool_ImportPastedCSV');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_ImportPastedCSV_text');?></div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn bg-green dbtools-button" id="btnPiaBackupDBtoArchive" onclick="askPiaBackupDBtoArchive()"><?= lang('Maintenance_Tool_backup');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_backup_text');?></div>
|
||||
</div>
|
||||
@@ -388,42 +406,54 @@ $db->close();
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_purgebackup_text');?></div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn bg-green dbtools-button" id="btnExportCSV" onclick="askExportCSV()"><?= lang('Maintenance_Tool_ExportCSV');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_ExportCSV_text');?></div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnImportCSV" onclick="askImportCSV()"><?= lang('Maintenance_Tool_ImportCSV');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_ImportCSV_text');?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ---------------------------Logging-------------------------------------------- -->
|
||||
<div class="tab-pane" id="tab_Logging">
|
||||
<div class="db_info_table">
|
||||
|
||||
<div id="logsPlc"></div>
|
||||
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row actions">
|
||||
<div class="col-sm-2">
|
||||
<div class="form-check toggle">
|
||||
<label class="form-check-label pointer" for="logsAutoRefresh">
|
||||
<input class="form-check-input" type="checkbox" id="logsAutoRefresh" onchange="toggleAutoRefresh()" />
|
||||
Auto-refresh
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ---------------------------Bulk edit -------------------------------------------- -->
|
||||
<div class="tab-pane" id="tab_multiEdit">
|
||||
<div class="db_info_table">
|
||||
<div class="box box-solid">
|
||||
<?php
|
||||
require 'multiEditCore.php';
|
||||
?>
|
||||
<div class="col-sm-2">
|
||||
<div class="form-check toggle">
|
||||
<label class="form-check-label pointer" for="logsAutoScroll">
|
||||
<input class="form-check-input" type="checkbox" checked id="logsAutoScroll" />
|
||||
Auto-scroll
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-inline toggle">
|
||||
<input class="form-control" type="text" id="logsFilter" oninput="applyFilter()" placeholder="Filter lines with text..." />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table">
|
||||
|
||||
<div id="logsPlc"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ---------------------------Bulk edit -------------------------------------------- -->
|
||||
<div class="tab-pane" id="tab_multiEdit">
|
||||
<div class="db_info_table">
|
||||
<div class="box box-solid">
|
||||
<?php
|
||||
require 'multiEditCore.php';
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- ------------------------------------------------------------------------------ -->
|
||||
</div>
|
||||
<!-- ------------------------------------------------------------------------------ -->
|
||||
|
||||
</div>
|
||||
|
||||
@@ -624,7 +654,7 @@ function restartBackend() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "php/server/util.php",
|
||||
data: { function: "addToExecutionQueue", action: 'cron_restart_backend' },
|
||||
data: { function: "addToExecutionQueue", action: `${getGuid()}|cron_restart_backend` },
|
||||
success: function(data, textStatus) {
|
||||
// showModalOk ('Result', data );
|
||||
|
||||
@@ -640,11 +670,6 @@ function restartBackend() {
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Export CSV
|
||||
function askExportCSV() {
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_ExportCSV_noti');?>', '<?= lang('Maintenance_Tool_ExportCSV_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', 'ExportCSV');
|
||||
}
|
||||
function ExportCSV()
|
||||
{
|
||||
// Execute
|
||||
@@ -667,6 +692,26 @@ function ImportCSV()
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Import pasted CSV
|
||||
function askImportPastedCSV() {
|
||||
|
||||
// Add new icon as base64 string
|
||||
showModalInput ('<i class="fa fa-square-plus pointer"></i> <?= lang('Maintenance_Tool_ImportCSV_noti');?>', '<?= lang('Maintenance_Tool_ImportPastedCSV_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', 'ImportPastedCSV');
|
||||
}
|
||||
|
||||
function ImportPastedCSV()
|
||||
{
|
||||
var csv = $('#modal-input-textarea').val();
|
||||
csvBase64 = btoa(csv)
|
||||
// Execute
|
||||
$.post('php/server/devices.php?action=ImportCSV', { content: csvBase64 }, function(msg) {
|
||||
showMessage(msg);
|
||||
write_notification(`[Maintenance] Devices imported from pasted content`, 'info');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Switch Darkmode
|
||||
@@ -740,35 +785,22 @@ function performLogManage() {
|
||||
|
||||
// --------------------------------------------------------
|
||||
// scroll down the log areas
|
||||
function scrollDown()
|
||||
{
|
||||
setTimeout(() => {
|
||||
|
||||
function scrollDown() {
|
||||
|
||||
var elementToCheck = $("#tab_Logging_id");
|
||||
|
||||
// Check if the parent <li> is active
|
||||
if (elementToCheck.parent().hasClass("active")) {
|
||||
{
|
||||
var areaIDs = ['app_log', 'app_front_log', 'IP_changes_log', 'stdout_log', 'stderr_log', 'app_pholus_log', 'app_pholus_lastrun_log', 'app_php_log'];
|
||||
|
||||
for (let i = 0; i < areaIDs.length; i++) {
|
||||
var textAreas = $("#logsPlc textarea");
|
||||
|
||||
var tempArea = $('#' + areaIDs[i]);
|
||||
|
||||
if (tempArea.length > 0)
|
||||
{
|
||||
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
textAreas.each(function() {
|
||||
$(this).scrollTop(this.scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
}, 200);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Manage displayed columns
|
||||
// --------------------------------------------------------
|
||||
@@ -885,8 +917,46 @@ function initializeTabs () {
|
||||
}, 50);
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Logs render functionality
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Manages the auto-refresh functionality for the logs
|
||||
let intervalId;
|
||||
|
||||
function toggleAutoRefresh() {
|
||||
const checkbox = $('#logsAutoRefresh')[0];
|
||||
|
||||
if (checkbox.checked) {
|
||||
intervalId = setInterval(renderLogs, 1000);
|
||||
} else {
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Manages thefilter application
|
||||
function applyFilter() {
|
||||
const filterText = $("#logsFilter").val().toLowerCase();
|
||||
|
||||
$(".logs").each(function() {
|
||||
const originalText = $(this).data('originalText') || $(this).val();
|
||||
|
||||
if (!$(this).data('originalText')) {
|
||||
$(this).data('originalText', originalText);
|
||||
}
|
||||
|
||||
const filteredLines = originalText.split('\n').filter(line =>
|
||||
line.toLowerCase().includes(filterText)
|
||||
);
|
||||
|
||||
$(this).val(filteredLines.join('\n'));
|
||||
});
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Renders all the logs
|
||||
function renderLogs(customData) {
|
||||
$.ajax({
|
||||
url: 'php/components/logs.php', // PHP script URL
|
||||
@@ -895,6 +965,14 @@ function renderLogs(customData) {
|
||||
// data: { items: JSON.stringify(customData) }, // Send customData as JSON
|
||||
success: function(response) {
|
||||
$('#logsPlc').html(response); // Replace container content with fetched HTML
|
||||
|
||||
applyFilter();
|
||||
|
||||
if($('#logsAutoScroll')[0].checked)
|
||||
{
|
||||
scrollDown(); // scroll down the logs
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching infoboxes:', error);
|
||||
@@ -902,14 +980,13 @@ function renderLogs(customData) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Init
|
||||
window.onload = function asyncFooter()
|
||||
{
|
||||
initializeSelectedColumns();
|
||||
renderLogs();
|
||||
scrollDown(); // scroll down the logs
|
||||
|
||||
|
||||
// initializeTabs();
|
||||
|
||||
$("#lastCommit").append('<a href="https://github.com/jokob-sk/NetAlertX/commits" target="_blank"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/jokob-sk/netalertx/main?logo=github"></a>');
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="callout callout-warning">
|
||||
<h4><?= lang('Gen_Warning');?></h4>
|
||||
@@ -102,26 +100,35 @@
|
||||
// Append form groups to the column
|
||||
for (let j = i * elementsPerColumn; j < Math.min((i + 1) * elementsPerColumn, columns.length); j++) {
|
||||
|
||||
let inputType;
|
||||
const setTypeObject = JSON.parse(columns[j].Type.replace(/'/g, '"'));
|
||||
// console.log(setTypeObject);
|
||||
const lastElementObj = setTypeObject.elements[setTypeObject.elements.length - 1]
|
||||
|
||||
switch (columns[j].Type) {
|
||||
case 'integer.checkbox':
|
||||
case 'checkbox':
|
||||
inputType = 'checkbox';
|
||||
break;
|
||||
case 'text.select':
|
||||
inputType = 'text.select';
|
||||
break;
|
||||
default:
|
||||
inputType = 'text';
|
||||
break;
|
||||
}
|
||||
|
||||
if (inputType === 'text.select') {
|
||||
const { elementType, elementOptions = [], transformers = [] } = lastElementObj;
|
||||
const {
|
||||
inputType,
|
||||
readOnly,
|
||||
isMultiSelect,
|
||||
cssClasses,
|
||||
placeholder,
|
||||
suffix,
|
||||
sourceIds,
|
||||
separator,
|
||||
editable,
|
||||
valRes,
|
||||
getStringKey,
|
||||
onClick
|
||||
} = handleElementOptions('none', elementOptions, transformers, val = "");
|
||||
|
||||
targetLocation = columns[j].Code_Name + "_initSettingDropdown"
|
||||
// console.log(setTypeObject);
|
||||
// console.log(inputType);
|
||||
|
||||
initSettingDropdown(columns[j].Code_Name, [], targetLocation, generateDropdownOptions)
|
||||
// render based on element type
|
||||
if (lastElementObj.elementType === 'select') {
|
||||
|
||||
targetLocation = columns[j].Code_Name + "_generateSetOptions"
|
||||
|
||||
generateOptionsOrSetOptions(columns[j].Code_Name, [], targetLocation, generateOptions)
|
||||
|
||||
// Handle Icons as tehy need a preview
|
||||
if(columns[j].Code_Name == 'NEWDEV_dev_Icon')
|
||||
@@ -147,15 +154,11 @@
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
} else if (lastElementObj.elementType === 'input'){
|
||||
|
||||
// Add classes specifically for checkboxes
|
||||
if (inputType === 'checkbox') {
|
||||
inputClass = 'checkbox';
|
||||
|
||||
} else {
|
||||
inputClass = 'form-control';
|
||||
}
|
||||
inputType === 'checkbox' ? inputClass = 'checkbox' : inputClass = 'form-control';
|
||||
|
||||
|
||||
input = `<input class="${inputClass}"
|
||||
id="${columns[j].Code_Name}"
|
||||
|
||||
@@ -50,10 +50,10 @@
|
||||
|
||||
$decoded_icon = base64_decode($icon);
|
||||
$idFromMac = str_replace(":", "_", $node_mac);
|
||||
$str_tab_header = '<li class="'.$activetab.'">
|
||||
$str_tab_header = '<li class="networkNodeTabHeaders '.$activetab.' " >
|
||||
|
||||
<a href="#'.$idFromMac.'" data-mytabmac="'.$node_mac.'" id="'.$idFromMac.'_id" data-toggle="tab" >' // _id is added so it doesn't conflict with AdminLTE tab behavior
|
||||
.'<div class="icon">'.$decoded_icon.' </div>'.$node_name.' ' .$str_port.$node_badge.
|
||||
<a href="#'.$idFromMac.'" data-mytabmac="'.$node_mac.'" id="'.$idFromMac.'_id" data-toggle="tab" title="'.$node_name.' ">' // _id is added so it doesn't conflict with AdminLTE tab behavior
|
||||
.'<div class="icon">'.$decoded_icon.' </div> <span class="node-name">'.$node_name.'</span>' .$str_port.$node_badge.
|
||||
'</a>
|
||||
</li>';
|
||||
|
||||
@@ -464,7 +464,7 @@
|
||||
<script src="lib/treeviz/require.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
<script defer>
|
||||
$.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) {
|
||||
|
||||
rawData = JSON.parse (data)
|
||||
@@ -528,8 +528,10 @@
|
||||
for(var i in list)
|
||||
{
|
||||
//... of the current node
|
||||
if(list[i].parentMac == node.mac && !hiddenMacs.includes(list[i].parentMac))
|
||||
|
||||
if(list[i].parentMac.toLowerCase() == node.mac.toLowerCase() && !hiddenMacs.includes(list[i].parentMac))
|
||||
{
|
||||
|
||||
visibleNodesCount++
|
||||
|
||||
// and process them
|
||||
@@ -546,7 +548,6 @@
|
||||
{
|
||||
parentNodesCount++
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
name: node.name,
|
||||
@@ -570,7 +571,6 @@
|
||||
|
||||
function getHierarchy()
|
||||
{
|
||||
|
||||
for(i in deviceListGlobal)
|
||||
{
|
||||
if(deviceListGlobal[i].mac == 'Internet')
|
||||
@@ -615,10 +615,10 @@
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Handle network node click - select correct tab in teh bottom table
|
||||
// Handle network node click - select correct tab in the bottom table
|
||||
function handleNodeClick(event)
|
||||
{
|
||||
console.log(event.target.offsetParent.offsetParent)
|
||||
// console.log(event.target.offsetParent.offsetParent)
|
||||
|
||||
const targetTabMAC = $(event.target.offsetParent.offsetParent).attr("data-mytreemacmain");
|
||||
|
||||
@@ -630,14 +630,24 @@
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
var myTree;
|
||||
var visibleTreeArea = $(window).height()-135;
|
||||
var treeAreaHeight = visibleTreeArea > 800 ? 800 : visibleTreeArea;
|
||||
var visibleTreeArea = $(window).height()-155;
|
||||
var nodeWidth = 160;
|
||||
var emSize;
|
||||
var nodeHeight;
|
||||
var sizeCoefficient = 1
|
||||
|
||||
function initTree(myHierarchy)
|
||||
{
|
||||
console.log(myHierarchy)
|
||||
|
||||
// calculate the drawing area based on teh tree width and available screen size
|
||||
var treeAreaHeight = visibleTreeArea > 800 ? 800 : visibleTreeArea;
|
||||
let screenWidth = $('.content-header').width();
|
||||
let treeWidth = (nodeWidth + 20) * parentNodesCount;
|
||||
let treeAreaWidth = screenWidth < treeWidth ? treeWidth : screenWidth;
|
||||
|
||||
// init the drawing area size
|
||||
$("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${treeAreaWidth}px`)
|
||||
|
||||
if(myHierarchy.type == "")
|
||||
{
|
||||
@@ -654,7 +664,7 @@
|
||||
// nodeHeight = ((emSize*100*0.30).toFixed(0))
|
||||
nodeHeight = ((emSize*100*0.30).toFixed(0))
|
||||
|
||||
$("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${$('.content-header').width()}px`)
|
||||
console.log(Treeviz);
|
||||
|
||||
myTree = Treeviz.create({
|
||||
htmlId: "networkTree",
|
||||
@@ -703,7 +713,7 @@
|
||||
>
|
||||
<div class="netNodeText">
|
||||
<strong>${devicePort} ${deviceIcon}
|
||||
<span class="spanNetworkTree anonymizeDev">${nodeData.data.name}</span>
|
||||
<span class="spanNetworkTree anonymizeDev" >${nodeData.data.name}</span>
|
||||
</strong>
|
||||
${collapseExpandHtml}
|
||||
</div>
|
||||
@@ -718,8 +728,8 @@
|
||||
secondaryAxisNodeSpacing: 0.3,
|
||||
nodeHeight: nodeHeight.toString(),
|
||||
marginTop: '5',
|
||||
hasZoom: false,
|
||||
hasPan: false,
|
||||
hasZoom: true,
|
||||
hasPan: true,
|
||||
// marginLeft: '15',
|
||||
idKey: "id",
|
||||
hasFlatData: false,
|
||||
@@ -728,8 +738,8 @@
|
||||
onNodeClick: (nodeData) => handleNodeClick(nodeData),
|
||||
relationnalField: "children",
|
||||
});
|
||||
|
||||
|
||||
console.log(myHierarchy)
|
||||
|
||||
myTree.refresh(myHierarchy);
|
||||
|
||||
|
||||
@@ -29,31 +29,41 @@ function renderLogArea($params) {
|
||||
|
||||
// Prepare buttons HTML
|
||||
$buttonsHtml = '';
|
||||
$totalButtons = count($buttons);
|
||||
if ($totalButtons > 0) {
|
||||
$colClass = 12 / $totalButtons;
|
||||
// Use $colClass in your HTML generation or further logic
|
||||
} else {
|
||||
// Handle case where $buttons array is empty
|
||||
$colClass = 12;
|
||||
}
|
||||
|
||||
foreach ($buttons as $button) {
|
||||
$labelStringCode = isset($button['labelStringCode']) ? $button['labelStringCode'] : '';
|
||||
$event = isset($button['event']) ? $button['event'] : '';
|
||||
|
||||
$buttonsHtml .= '
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<button class="btn btn-primary" onclick="' . htmlspecialchars($event) . '">' . lang($labelStringCode) . '</button>
|
||||
<div class="button-wrap col-sm-' . $colClass . ' col-xs-' . $colClass . '">
|
||||
<button class="btn btn-primary col-sm-12 col-xs-12" onclick="' . htmlspecialchars($event) . '">' . lang($labelStringCode) . '</button>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
// Render the log area HTML
|
||||
$html = '
|
||||
<div class="log-area box box-solid box-primary">
|
||||
<div class="row logs-row col-sm-12 col-xs-12">
|
||||
<textarea id="app_log" class="' . htmlspecialchars($textAreaCssClass) . '" cols="70" rows="10" wrap="off" readonly>'
|
||||
<textarea class="' . htmlspecialchars($textAreaCssClass) . '" cols="70" rows="20" wrap="off" readonly>'
|
||||
. htmlspecialchars($content) .
|
||||
'</textarea>
|
||||
</div>
|
||||
<div class="row logs-row">
|
||||
<div class="log-file col-sm-8 col-xs-12">' . htmlspecialchars($fileName) . '
|
||||
<div class="log-file col-sm-6 col-xs-12">' . htmlspecialchars($fileName) . '
|
||||
<div class="logs-size">' . number_format((filesize($filePath) / 1000000), 2, ",", ".") . ' MB'
|
||||
. $downloadButtonHtml .
|
||||
'</div>
|
||||
</div>
|
||||
<div class="col-sm-4 col-xs-12">'
|
||||
<div class="col-sm-6 col-xs-12">'
|
||||
. $buttonsHtml .
|
||||
'</div>
|
||||
</div>
|
||||
|
||||
@@ -37,6 +37,17 @@
|
||||
"filePath": "/app/front/log/app.php_errors.log",
|
||||
"textAreaCssClass": "logs logs-small"
|
||||
},
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"labelStringCode": "Maint_PurgeLog",
|
||||
"event": "logManage('execution_queue.log', 'cleanLog')"
|
||||
}
|
||||
],
|
||||
"fileName": "execution_queue.log",
|
||||
"filePath": "/app/front/log/execution_queue.log",
|
||||
"textAreaCssClass": "logs logs-small"
|
||||
},
|
||||
{
|
||||
"buttons": [
|
||||
],
|
||||
@@ -55,6 +66,13 @@
|
||||
"filePath": "/app/front/log/app_front.log",
|
||||
"textAreaCssClass": "logs logs-small"
|
||||
},
|
||||
{
|
||||
"buttons": [
|
||||
],
|
||||
"fileName": "db_is_locked.log",
|
||||
"filePath": "/app/front/log/db_is_locked.log",
|
||||
"textAreaCssClass": "logs logs-small"
|
||||
},
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
|
||||
@@ -463,15 +463,29 @@ function ExportCSV() {
|
||||
// Import CSV of devices
|
||||
//------------------------------------------------------------------------------
|
||||
function ImportCSV() {
|
||||
$file = '../../../config/devices.csv';
|
||||
|
||||
if (file_exists($file)) {
|
||||
global $db;
|
||||
$skipped = "";
|
||||
$error = "";
|
||||
global $db;
|
||||
$file = '../../../config/devices.csv';
|
||||
$data = "";
|
||||
$skipped = "";
|
||||
$error = "";
|
||||
|
||||
// check if content passed in query string
|
||||
if(isset ($_POST['content']) && !empty ($_POST['content']))
|
||||
{
|
||||
// Decode the Base64 string
|
||||
$data = base64_decode($_POST['content']);
|
||||
|
||||
} else if (file_exists($file)) { // try to get the data form the file
|
||||
|
||||
// Read the CSV file
|
||||
$data = file_get_contents($file);
|
||||
} else {
|
||||
echo lang('BackDevices_DBTools_ImportCSVMissing');
|
||||
}
|
||||
|
||||
if($data != "")
|
||||
{
|
||||
$lines = explode("\n", $data);
|
||||
|
||||
// Get the column headers from the first line of the CSV
|
||||
@@ -517,8 +531,6 @@ function ImportCSV() {
|
||||
// An error occurred while writing to the DB, display the last error message
|
||||
echo lang('BackDevices_DBTools_ImportCSVError') . "\n" . $error . "\n" . $sql . "\n\n" . $result;
|
||||
}
|
||||
} else {
|
||||
echo lang('BackDevices_DBTools_ImportCSVMissing');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,18 +913,11 @@ 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 ";
|
||||
$sql = "DROP TABLE IF EXISTS temp_devices ";
|
||||
$result = $db->query($sql);
|
||||
|
||||
// create temporary table with the source data
|
||||
|
||||
@@ -225,6 +225,7 @@ function displayMessage($message, $logAlert = FALSE, $logConsole = TRUE, $logFil
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Adds an action to perform into the execution_queue.log file
|
||||
function addToExecutionQueue($action)
|
||||
@@ -253,7 +254,7 @@ function cleanLog($logFile)
|
||||
|
||||
$path = "";
|
||||
|
||||
$allowedFiles = ['app.log', 'app_front.log', 'IP_changes.log', 'stdout.log', 'stderr.log', "pholus_lastrun.log", 'app.php_errors.log'];
|
||||
$allowedFiles = ['app.log', 'app_front.log', 'IP_changes.log', 'stdout.log', 'stderr.log', "pholus_lastrun.log", 'app.php_errors.log', 'execution_queue.log'];
|
||||
|
||||
if(in_array($logFile, $allowedFiles))
|
||||
{
|
||||
@@ -305,7 +306,7 @@ function saveSettings()
|
||||
$txt = $txt."# Generated: ".$timestamp." #\n";
|
||||
$txt = $txt."# #\n";
|
||||
$txt = $txt."# Config file for the LAN intruder detection app: #\n";
|
||||
$txt = $txt."# https://github.com/jokob-sk/NetAlertX #\n";
|
||||
$txt = $txt."# https://github.com/jokob-sk/NetAlertX #\n";
|
||||
$txt = $txt."# #\n";
|
||||
$txt = $txt."#-----------------AUTOGENERATED FILE-----------------#\n";
|
||||
|
||||
@@ -325,56 +326,57 @@ function saveSettings()
|
||||
$txt .= "\n#---------------------------\n";
|
||||
|
||||
foreach ($decodedSettings as $setting) {
|
||||
$settingGroup = $setting[0];
|
||||
$settingKey = $setting[1];
|
||||
$settingType = $setting[2];
|
||||
$settingValue = $setting[3];
|
||||
|
||||
// sanity check
|
||||
if($settingKey == "UI_LANG" && $settingValue == "")
|
||||
{
|
||||
$settingGroup = $setting[0];
|
||||
$settingKey = $setting[1];
|
||||
$dataType = $setting[2];
|
||||
$settingValue = $setting[3];
|
||||
|
||||
// // Parse the settingType JSON
|
||||
// $settingType = json_decode($settingTypeJson, true);
|
||||
|
||||
// Sanity check
|
||||
if($settingKey == "UI_LANG" && $settingValue == "") {
|
||||
echo "🔴 Error: important settings missing. Refresh the page with 🔃 on the top and try again.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($group == $settingGroup) {
|
||||
|
||||
if ($dataType == 'string' ) {
|
||||
$val = encode_single_quotes($settingValue);
|
||||
$txt .= $settingKey . "='" . $val . "'\n";
|
||||
} elseif ($dataType == 'integer') {
|
||||
$txt .= $settingKey . "=" . $settingValue . "\n";
|
||||
} elseif ($dataType == 'json') {
|
||||
$txt .= $settingKey . "=" . $settingValue . "\n";
|
||||
} elseif ($dataType == 'boolean') {
|
||||
$val = ($settingValue === true || $settingValue === 1 || strtolower($settingValue) === 'true') ? "True" : "False";
|
||||
$txt .= $settingKey . "=" . $val . "\n";
|
||||
} elseif ($dataType == 'array' ) {
|
||||
$temp = '';
|
||||
|
||||
if(is_array($settingValue) == FALSE)
|
||||
{
|
||||
$settingValue = json_decode($settingValue);
|
||||
}
|
||||
// skipping __metadata entries (?)
|
||||
if (count($setting) > 3 && is_array($settingValue) == true) {
|
||||
foreach ($settingValue as $val) {
|
||||
$temp .= "'" . encode_single_quotes($val) . "',";
|
||||
}
|
||||
|
||||
if ($group == $settingGroup) {
|
||||
if ($settingType == 'text' || $settingType == 'password' || $settingType == 'password.SHA256' || $settingType == 'readonly' || $settingType == 'text.select') {
|
||||
$val = encode_single_quotes($settingValue);
|
||||
$txt .= $settingKey . "='" . $val . "'\n";
|
||||
} elseif ($settingType == 'integer' || $settingType == 'integer.select') {
|
||||
$txt .= $settingKey . "=" . $settingValue . "\n";
|
||||
} elseif ($settingType == 'boolean' || $settingType == 'integer.checkbox') {
|
||||
$temp = substr_replace($temp, "", -1); // remove last comma ','
|
||||
}
|
||||
|
||||
if ($settingValue === true || $settingValue === 1 || strtolower($settingValue) === 'true') {
|
||||
$val = "True";
|
||||
} else {
|
||||
$val = "False";
|
||||
}
|
||||
|
||||
$txt .= $settingKey . "=" . $val . "\n";
|
||||
} elseif ($settingType == 'text.multiselect' || $settingType == 'subnets' || $settingType == 'list' || $settingType == 'list.select') {
|
||||
$temp = '';
|
||||
|
||||
if(is_array($settingValue) == FALSE)
|
||||
{
|
||||
$settingValue = json_decode($settingValue);
|
||||
}
|
||||
|
||||
if (count($setting) > 3 && is_array($settingValue) == true) {
|
||||
foreach ($settingValue as $val) {
|
||||
$temp .= "'" . encode_single_quotes($val) . "',";
|
||||
}
|
||||
|
||||
$temp = substr_replace($temp, "", -1); // remove last comma ','
|
||||
}
|
||||
|
||||
$temp = '['.$temp.']'; // wrap brackets
|
||||
$txt .= $settingKey . "=" . $temp . "\n";
|
||||
} elseif ($settingType == 'json') {
|
||||
$txt .= $settingKey . "=" . $settingValue . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$temp = '['.$temp.']'; // wrap brackets
|
||||
$txt .= $settingKey . "=" . $temp . "\n";
|
||||
|
||||
} else {
|
||||
$txt .= $settingKey . "='⭕Not handled⭕'\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
require dirname(__FILE__).'/../templates/timezone.php';
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Check if the action parameter is set in the GET request
|
||||
if (isset($_GET['action'])) {
|
||||
// Collect GUID if provided
|
||||
@@ -46,6 +46,8 @@ if (isset($_GET['action'])) {
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Generates a random GUID
|
||||
function generate_guid() {
|
||||
if (function_exists('com_create_guid') === true) {
|
||||
return trim(com_create_guid(), '{}');
|
||||
@@ -54,8 +56,10 @@ function generate_guid() {
|
||||
mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535),
|
||||
mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535),
|
||||
mt_rand(0, 65535), mt_rand(0, 65535));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Logs a notification in in-app notification system
|
||||
function write_notification($content, $level = "interrupt") {
|
||||
$NOTIFICATION_API_FILE = '/app/front/api/user_notifications.json';
|
||||
|
||||
@@ -87,6 +91,8 @@ function write_notification($content, $level = "interrupt") {
|
||||
file_put_contents($NOTIFICATION_API_FILE, json_encode($notifications));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Removes a notification based on GUID
|
||||
function remove_notification($guid) {
|
||||
$NOTIFICATION_API_FILE = '/app/front/api/user_notifications.json';
|
||||
|
||||
@@ -102,6 +108,8 @@ function remove_notification($guid) {
|
||||
file_put_contents($NOTIFICATION_API_FILE, json_encode(array_values($filtered_notifications)));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Deletes all notifications
|
||||
function notifications_clear() {
|
||||
$NOTIFICATION_API_FILE = '/app/front/api/user_notifications.json';
|
||||
|
||||
@@ -109,6 +117,8 @@ function notifications_clear() {
|
||||
file_put_contents($NOTIFICATION_API_FILE, json_encode(array()));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Mark a notification read based on GUID
|
||||
function mark_notification_as_read($guid) {
|
||||
$NOTIFICATION_API_FILE = '/app/front/api/user_notifications.json';
|
||||
$max_attempts = 3;
|
||||
@@ -152,10 +162,12 @@ function mark_notification_as_read($guid) {
|
||||
echo "Failed to read notification file after $max_attempts attempts.";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
function notifications_mark_all_read() {
|
||||
mark_notification_as_read(null);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
function get_unread_notifications() {
|
||||
$NOTIFICATION_API_FILE = '/app/front/api/user_notifications.json';
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<!-- NetAlertX -->
|
||||
<script src="js/handle_version.js"></script>
|
||||
<script src="js/ui_components.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
<script src="js/db_methods.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
|
||||
|
||||
<!-- Select2 JavaScript -->
|
||||
<script src="lib/AdminLTE/bower_components/select2/dist/js/select2.full.min.js" defer></script>
|
||||
|
||||
@@ -33,6 +33,8 @@ require dirname(__FILE__).'/security.php';
|
||||
<script src="js/common.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
<script src="js/modal.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
<script src="js/tests.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
<script src="js/db_methods.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
<script src="js/settings_utils.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/bower_components/bootstrap/dist/css/bootstrap.min.css">
|
||||
@@ -339,7 +341,7 @@ if ($ENABLED_DARKMODE === True) {
|
||||
</a>
|
||||
<ul class="treeview-menu" style="display: <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('settings.php') ) ){ echo 'block'; } else {echo 'none';} ?>;">
|
||||
<li>
|
||||
<a href="settings.php#pageTitle"> <?= lang("settings_enabled");?> </a>
|
||||
<a href="settings.php#settingsOverview"> <?= lang("settings_enabled");?> </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="settings.php#core_content_header"> <?= lang("settings_core_label");?> </a>
|
||||
@@ -348,13 +350,13 @@ if ($ENABLED_DARKMODE === True) {
|
||||
<a href="settings.php#system_content_header"> <?= lang("settings_system_label");?> </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="settings.php#device_scanner_content_header"> <?= lang("settings_device_scanners_label");?> </a>
|
||||
<a href="settings.php#device_scanners_content_header"> <?= lang("settings_device_scanners_label");?> </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="settings.php#other_content_header"> <?= lang("settings_other_scanners_label");?> </a>
|
||||
<a href="settings.php#other_scanners_content_header"> <?= lang("settings_other_scanners_label");?> </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="settings.php#publisher_content_header"> <?= lang("settings_publishers_label");?> </a>
|
||||
<a href="settings.php#publishers_content_header"> <?= lang("settings_publishers_label");?> </a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@@ -370,7 +372,7 @@ if ($ENABLED_DARKMODE === True) {
|
||||
</a>
|
||||
<ul class="treeview-menu " style="display: <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('plugins.php', 'workflows.php' ) ) ){ echo 'block'; } else {echo 'none';} ?>;">
|
||||
<li>
|
||||
<div class="info-icon-nav work-in-progress"> </div>
|
||||
<div class="info-icon-nav"> </div>
|
||||
<a href="workflows.php"><?= lang('Navigation_Workflows');?></a>
|
||||
</li>
|
||||
<li>
|
||||
@@ -414,7 +416,7 @@ if ($ENABLED_DARKMODE === True) {
|
||||
// Generate work-in-progress icons
|
||||
function workInProgress() {
|
||||
|
||||
if($(".work-in-progress").html().trim() == "")
|
||||
if($(".work-in-progress").length > 0 && $(".work-in-progress").html().trim() == "")
|
||||
{
|
||||
$(".work-in-progress").append(`
|
||||
<a href="https://github.com/jokob-sk/NetAlertX/issues" target="_blank">
|
||||
|
||||
41
front/php/templates/language/de_de.json
Executable file → Normal file
41
front/php/templates/language/de_de.json
Executable file → Normal file
@@ -5,7 +5,7 @@
|
||||
"API_icon": "<i class=\"fa fa-arrow-down-up-across-line\"></i>",
|
||||
"APPRISE_HOST_description": "Apprise host URL starting with <code>http://</code> or <code>https://</code>. (do not forget to include <code>/notify</code> at the end)",
|
||||
"APPRISE_HOST_name": "Apprise host URL",
|
||||
"APPRISE_PAYLOAD_description": "Select the payoad type sent to Apprise. For example <code>html</code> works well with emails, <code>text</code> with chat apps, such as Telegram.",
|
||||
"APPRISE_PAYLOAD_description": "Select the payload type sent to Apprise. For example <code>html</code> works well with emails, <code>text</code> with chat apps, such as Telegram.",
|
||||
"APPRISE_PAYLOAD_name": "Payload type",
|
||||
"APPRISE_SIZE_description": "The maximum size of the apprise 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_SIZE_name": "Max payload size",
|
||||
@@ -13,7 +13,7 @@
|
||||
"APPRISE_URL_name": "Apprise notification URL",
|
||||
"About_Design": "Designed for:",
|
||||
"About_Exit": "Abmelden",
|
||||
"About_Title": "Open Source Network Guard",
|
||||
"About_Title": "Netzwerksicherheitsscanner und Benachrichtigungsframework",
|
||||
"AppEvents_DateTimeCreated": "protokolliert",
|
||||
"AppEvents_Extra": "Extra",
|
||||
"AppEvents_GUID": "Anwendungsereignis-GUID",
|
||||
@@ -93,17 +93,17 @@
|
||||
"DevDetail_MainInfo_Group": "Gruppe",
|
||||
"DevDetail_MainInfo_Location": "Standort",
|
||||
"DevDetail_MainInfo_Name": "Name",
|
||||
"DevDetail_MainInfo_Network": "Netzwerk Knoten",
|
||||
"DevDetail_MainInfo_Network_Port": "Netzwerk Knoten Port",
|
||||
"DevDetail_MainInfo_Network": "<i class=\"fa fa-server\"></i> Knoten (MAC)",
|
||||
"DevDetail_MainInfo_Network_Port": "<i class=\"fa fa-ethernet\"></i> Port",
|
||||
"DevDetail_MainInfo_Network_Site": "",
|
||||
"DevDetail_MainInfo_Network_Title": "<i class=\"fa fa-network-wired\"></i> Network",
|
||||
"DevDetail_MainInfo_Owner": "Eigen­tümer",
|
||||
"DevDetail_MainInfo_SSID": "",
|
||||
"DevDetail_MainInfo_Title": "Haupt Infos",
|
||||
"DevDetail_MainInfo_Title": "<i class=\"fa fa-pencil\"></i> Hauptinformation",
|
||||
"DevDetail_MainInfo_Type": "Typ",
|
||||
"DevDetail_MainInfo_Vendor": "Hersteller",
|
||||
"DevDetail_MainInfo_mac": "MAC",
|
||||
"DevDetail_Network_Node_hover": "Select the parent network device the current device is connected to to populate the Network tree.",
|
||||
"DevDetail_Network_Node_hover": "Wählen Sie das Elternnetzgerät aus, an das das aktuelle Gerät angeschlossen ist, um den Netzwerkbaum zu erstellen.",
|
||||
"DevDetail_Network_Port_hover": "The port this device is connected to on the parent network device. If left empty a wifi icon is displayed in the Network tree.",
|
||||
"DevDetail_Nmap_Scans": "Nmap Scans",
|
||||
"DevDetail_Nmap_Scans_desc": "Hier kannst du manuelle NMAP Scans starten. Reguläre automatische NMAP Scans können mit dem Services & Ports (NMAP) Plugin geplant werden. Gehe zu den <a href='/settings.php' target='_blank'>Einstellungen</a> um mehr herauszufinden.",
|
||||
@@ -129,7 +129,7 @@
|
||||
"DevDetail_SessionInfo_LastSession": "Letzte Sitzung",
|
||||
"DevDetail_SessionInfo_StaticIP": "Statische IP",
|
||||
"DevDetail_SessionInfo_Status": "Status",
|
||||
"DevDetail_SessionInfo_Title": "Sitzungsinfos",
|
||||
"DevDetail_SessionInfo_Title": "<i class=\"fa fa-calendar\"></i> Sitzungsinformation",
|
||||
"DevDetail_SessionTable_Additionalinfo": "Zusätzliche Info",
|
||||
"DevDetail_SessionTable_Connection": "Verbindung",
|
||||
"DevDetail_SessionTable_Disconnection": "Trennung",
|
||||
@@ -140,13 +140,13 @@
|
||||
"DevDetail_Shortcut_DownAlerts": "Down Meldungen",
|
||||
"DevDetail_Shortcut_Presence": "Anwesenheit",
|
||||
"DevDetail_Shortcut_Sessions": "Sitzungen",
|
||||
"DevDetail_Tab_Details": "Details",
|
||||
"DevDetail_Tab_Events": "Ereignisse",
|
||||
"DevDetail_Tab_Details": "<i class=\"fa fa-info-circle\"></i> Details",
|
||||
"DevDetail_Tab_Events": "<i class=\"fa fa-bolt\"></i> Ereignisse",
|
||||
"DevDetail_Tab_EventsTableDate": "Datum",
|
||||
"DevDetail_Tab_EventsTableEvent": "Ereignistype",
|
||||
"DevDetail_Tab_EventsTableIP": "IP",
|
||||
"DevDetail_Tab_EventsTableInfo": "Zusätzliche Informationen",
|
||||
"DevDetail_Tab_Nmap": "Nmap",
|
||||
"DevDetail_Tab_Nmap": "<i class=\"fa fa-ethernet\"></i> Nmap",
|
||||
"DevDetail_Tab_NmapEmpty": "An diesem Gerät wurden keine offenen Ports mit Nmap gefunden.",
|
||||
"DevDetail_Tab_NmapTableExtra": "Extra",
|
||||
"DevDetail_Tab_NmapTableHeader": "Ergebnisse geplanter Scans",
|
||||
@@ -157,8 +157,8 @@
|
||||
"DevDetail_Tab_NmapTableText": "Erstelle einen Plan über die<a href=\"/settings.php#NMAP_ACTIVE\">Einstellungen</a>",
|
||||
"DevDetail_Tab_NmapTableTime": "Zeit",
|
||||
"DevDetail_Tab_Plugins": "<i class=\"fa fa-plug\"></i> Plugins",
|
||||
"DevDetail_Tab_Presence": "Anwesenheit",
|
||||
"DevDetail_Tab_Sessions": "Sitzungen",
|
||||
"DevDetail_Tab_Presence": "<i class=\"fa fa-calendar\"></i> Anwesenheit",
|
||||
"DevDetail_Tab_Sessions": "<i class=\"fa fa-list-ol\"></i> Sitzungen",
|
||||
"DevDetail_Tab_Tools": "<i class=\"fa fa-screwdriver-wrench\"></i> Tools",
|
||||
"DevDetail_Tab_Tools_Internet_Info_Description": "Das Internet-Info-Tool zeigt Informationen über die Internetverbindung an, wie z. B. IP-Adresse, Stadt, Land, Ortsvorwahl und Zeitzone.",
|
||||
"DevDetail_Tab_Tools_Internet_Info_Error": "Es ist ein Fehler aufgetreten",
|
||||
@@ -314,17 +314,17 @@
|
||||
"Gen_Work_In_Progress": "Keine Finalversion, feedback bitte unter: https://github.com/jokob-sk/NetAlertX/issues",
|
||||
"General_display_name": "Allgemein",
|
||||
"General_icon": "<i class=\"fa fa-gears\"></i>",
|
||||
"HRS_TO_KEEP_NEWDEV_description": "Dies ist eine Wartungseinstellung. Geräte markiert als <b>Neues Gerät</b> werden gelöscht, wenn ihre <b>Erste Sitzung</b> länger her ist als die angegebenen Stunden in dieser Einstellung. <code>0</code> deaktiviert diese Funktion. Nutzen Sie diese Einstellung, um <b>Neue Geräte</b> automatisch nach <code>X</code> Stunden zu löschen.",
|
||||
"HRS_TO_KEEP_NEWDEV_description": "Dies ist eine Wartungseinstellung. Wenn aktiviert (<code>0</code> bedeutet deaktiviert), werden als <b>\"Neues Gerät\"</b> markierte Geräte gelöscht, wenn ihre <b>erste Sitzung</b> länger her ist als in dieser Einstellung angegeben. Verwenden Sie diese Einstellung, wenn Sie <b>Neue Geräte</b> nach <code>X</code> Stunden automatisch löschen wollen.",
|
||||
"HRS_TO_KEEP_NEWDEV_name": "Neue Geräte speichern für",
|
||||
"HelpFAQ_Cat_Detail": "Detailansicht",
|
||||
"HelpFAQ_Cat_Detail_300_head": "Was bedeutet ",
|
||||
"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_a": "meint ein Netzwerkgerät (ein Gerät vom Typ AP, Gateway, Firewall, Hypervisor, Powerline, Switch, WLAN, PLC, Router, USB-LAN-Adapter oder Internet). Benutzerdefinierte Typen können über die <code>NETWORK_DEVICE_TYPES</code> Einstellung hinzugefügt werden.",
|
||||
"HelpFAQ_Cat_Detail_300_text_b": "bezeichnet die Anschlussnummer/Portnummer, an der das gerade bearbeitete Gerät mit diesem Netzwerkgerät verbunden ist. Siehe <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/docs/NETWORK_TREE.md\">diese Dokumentation</a> für mehr informationen.",
|
||||
"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.",
|
||||
"HelpFAQ_Cat_Detail_301_text": "Den zeitlichen Abstand zwischen den Scans legt der \"Cronjob\" fest, welcher standardmäßig auf 5min eingestellt ist. Die Benennung \"1min\" bezieht sich auf die zu erwartende Dauer des Scans. Abhängig vor der Netzwerkkonfiguration kann diese Zeitangabe variieren. Um den Cronjob zu bearbeiten, kannst du im Terminal/der Konsole <span class=\"text-danger help_faq_code\">crontab -e</span> eingeben und den Intervall ändern.",
|
||||
"HelpFAQ_Cat_Detail_302_head_a": "Was bedeutet ",
|
||||
"HelpFAQ_Cat_Detail_302_head_b": " und warum kann ich das nicht auswählen?",
|
||||
"HelpFAQ_Cat_Detail_302_head_b": "und warum kann ich das nicht auswählen?",
|
||||
"HelpFAQ_Cat_Detail_302_text": "Einige moderne Geräte generieren aus Datenschutzgründen zufällige MAC-Adressen, die keinem Hersteller mehr zugeordnet werden können und welche sich mit jeder neuen Verbindung ändern. NetAlertX erkennt, ob es sich um eine solche zufällige MAC-Adresse handelt und aktiviert dieses \"Feld\" automatisch. Um das Verhalten abzustellen, musst du in deinem Endgerät schauen, wie du die MAC-Adressen-Generierung deaktivierst.",
|
||||
"HelpFAQ_Cat_Detail_303_head": "Was ist Nmap und wozu dient es?",
|
||||
"HelpFAQ_Cat_Detail_303_text": "Nmap ist ein Netzwerkscanner mit vielfältigen Möglichkeiten.<br> Wenn ein neues Gerät in deiner Liste auftaucht, hast du die Möglichkeit über den Nmap-Scan genauere Informationen über das Gerät zu erhalten.",
|
||||
@@ -393,11 +393,14 @@
|
||||
"Maintenance_Tool_ExportCSV": "CSV Export",
|
||||
"Maintenance_Tool_ExportCSV_noti": "CSV Export",
|
||||
"Maintenance_Tool_ExportCSV_noti_text": "Sind Sie sich sicher, dass Sie die CSV-Datei erstellen wollen?",
|
||||
"Maintenance_Tool_ExportCSV_text": "Generiere eine CSV-Datei (comma separated values) mit einer Liste aller Geräte und deren Beziehungen zwischen Netzwerkknoten und verbundenen Geräten. Dies kann auch durch das Besuchen dieser URL <code>your NetAlertX url/php/server/devices.php?action=ExportCSV</code> ausgelöst werden.",
|
||||
"Maintenance_Tool_ExportCSV_text": "Generiere eine CSV-Datei (comma separated values) mit einer Liste aller Geräte und deren Beziehungen zwischen Netzwerkknoten und verbundenen Geräten. Dies kann auch durch das Besuchen der URL <code>your NetAlertX url/php/server/devices.php?action=ExportCSV</code> oder durch Aktivieren des <a href=\"settings.php#CSVBCKP_header\">CSV-Backups</a> ausgelöst werden.",
|
||||
"Maintenance_Tool_ImportCSV": "CSV Import",
|
||||
"Maintenance_Tool_ImportCSV_noti": "CSV Import",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Sind Sie sich sicher, dass Sie die CSV-Datei importieren wollen? Dies wird alle Geräte in der Datenbank überschreiben.",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Sind Sie sich sicher, dass Sie die CSV-Datei importieren wollen? Dies wird <b>alle Geräte in der Datenbank überschreiben</b>.",
|
||||
"Maintenance_Tool_ImportCSV_text": "Machen Sie ein Backup, bevor Sie diese Funktion nutzen. Importiere eine CSV-Datei (comma separated values) mit einer Liste aller Geräte und deren Beziehungen zwischen Netzwerkknoten und verbundenen Geräten. Um dies zu tun platziere die <b>devices.csv</b> benannte CSV-Datei in deinen <b>/config</b> Ordner.",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "arp-Scan stoppen/starten",
|
||||
"Maintenance_Tool_arpscansw_noti": "arp-Scan stoppen/starten",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "Wenn der Scan aus ist, bleibt er so lange aus bis er wieder aktiviert wird.",
|
||||
@@ -733,7 +736,7 @@
|
||||
"Webhooks_display_name": "Webhooks",
|
||||
"Webhooks_icon": "<i class=\"fa fa-circle-nodes\"></i>",
|
||||
"devices_old": "Aktualisiert...",
|
||||
"general_event_description": " The event you have 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 not get the expected result. <br/> <br/> Status: ",
|
||||
"general_event_description": "Das Ereignis, das Sie ausgelöst haben, könnte eine Weile dauern, bis Hintergrundprozesse abgeschlossen sind. Die Ausführung endet, wenn die unten ausgeführte Warteschlangen abgearbeitet ist. (Siehe <a href='/maintenance.php#tab_Logging'>error log</a>, wenn Probleme auftreten.)<br/> <br/> Ausführungsschlange:",
|
||||
"general_event_title": "Executing an ad-hoc event",
|
||||
"report_guid": "",
|
||||
"report_guid_missing": "",
|
||||
@@ -768,4 +771,4 @@
|
||||
"settings_update_item_warning": "",
|
||||
"test_event_icon": "fa-vial-circle-check",
|
||||
"test_event_tooltip": "Save your changes at first before you test your settings."
|
||||
}
|
||||
}
|
||||
|
||||
9
front/php/templates/language/en_us.json
Executable file → Normal file
9
front/php/templates/language/en_us.json
Executable file → Normal file
@@ -370,8 +370,11 @@
|
||||
"Maintenance_Tool_ExportCSV_text": "Generate a CSV (comma separated value) file containing the list of Devices including the Network relationships between Network Nodes and connected devices. You can also trigger this by accessing this URL <code>your NetAlertX url/php/server/devices.php?action=ExportCSV</code> or by enabling the <a href=\"settings.php#CSVBCKP_header\">CSV Backup</a> plugin.",
|
||||
"Maintenance_Tool_ImportCSV": "CSV Import",
|
||||
"Maintenance_Tool_ImportCSV_noti": "CSV Import",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Are you sure you want to import the CSV file? This will completely overwrite the devices in your database.",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Are you sure you want to import the CSV file? This will completely <b>overwrite</b> the devices in your database.",
|
||||
"Maintenance_Tool_ImportCSV_text": "Before using this function, please make a backup. Import a CSV (comma separated value) file containing the list of Devices including the Network relationships between Network Nodes and connected devices. To do that place the CSV file named <b>devices.csv</b> into your <b>/config</b> folder.",
|
||||
"Maintenance_Tool_ImportPastedCSV": "CSV Import (Paste)",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "Are you sure you want to import the pasted CSV? This will completely <b>overwrite</b> the devices in your database.",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "Before using this function, please make a backup. Import a CSV (comma separated value) file containing the list of Devices including the Network relationships between Network Nodes and connected devices.",
|
||||
"Maintenance_Tool_arpscansw": "Toggle arp-Scan (on/off)",
|
||||
"Maintenance_Tool_arpscansw_noti": "Toggle arp-Scan on or off",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "When the scan has been switched off it remains off until it is activated again.",
|
||||
@@ -652,7 +655,7 @@
|
||||
"UI_REFRESH_description": "Enter number of seconds after which the UI reloads. Set to <code>0</code> to disable.",
|
||||
"UI_REFRESH_name": "Auto-refresh UI",
|
||||
"devices_old": "Refreshing...",
|
||||
"general_event_description": "The event you have triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the <a href='/maintenance.php#tab_Logging'>error log</a> if you encounter issues). <br/> <br/> Execution queue:",
|
||||
"general_event_description": "The event you have triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the <a href='/maintenance.php#tab_Logging'>error log</a> if you encounter issues). <br/> <br/> Execution queue:",
|
||||
"general_event_title": "Executing an ad-hoc event",
|
||||
"report_guid": "Notification guid:",
|
||||
"report_guid_missing": "Linked notification not found. There is a small delay between recently sent notifications and them being available. Referesh your page and cache after a few seconds. It's also possible the selected notification have been deleted during maintenance as specified in the <code>DBCLNP_NOTIFI_HIST</code> setting. <br/> <br/>The latest notification is displayed instead. The missing notification has the following GUID:",
|
||||
@@ -687,4 +690,4 @@
|
||||
"settings_update_item_warning": "Update the value below. Be careful to follow the previous format. <b>Validation is not performed.</b>",
|
||||
"test_event_icon": "fa-vial-circle-check",
|
||||
"test_event_tooltip": "Save your changes at first before you test your settings."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,6 +396,9 @@
|
||||
"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_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_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "Activar arp-scan (on/off)",
|
||||
"Maintenance_Tool_arpscansw_noti": "Activar arp-scan on or off",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "Cuando el escaneo se ha apagado, permanece apagado hasta que se active nuevamente.",
|
||||
@@ -744,7 +747,7 @@
|
||||
"settings_core_label": "Núcleo",
|
||||
"settings_device_scanners": "Los escáneres de los dispositivos se utilizan para descubrir dispositivos que escriben en la tabla de base de datos de CurrentScan.",
|
||||
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
|
||||
"settings_device_scanners_info": "",
|
||||
"settings_device_scanners_info": "Cargue aún más escáneres de dispositivos con el ajuste <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a>",
|
||||
"settings_device_scanners_label": "Escáneres de dispositivos",
|
||||
"settings_enabled": "Configuración activada",
|
||||
"settings_enabled_icon": "fa-solid fa-toggle-on",
|
||||
@@ -759,7 +762,7 @@
|
||||
"settings_other_scanners_label": "Otros escáneres",
|
||||
"settings_publishers": "Puertas de enlace para las notificación habilitadas: editores, que enviarán una notificación según su configuración.",
|
||||
"settings_publishers_icon": "fa-solid fa-paper-plane",
|
||||
"settings_publishers_info": "",
|
||||
"settings_publishers_info": "Cargue más editor@s con el ajuste <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a>",
|
||||
"settings_publishers_label": "Editores",
|
||||
"settings_saved": "<br/>Ajustes guardados. <br/><br/> Recargando... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
|
||||
"settings_system_icon": "fa-solid fa-gear",
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
{
|
||||
"API_CUSTOM_SQL_description": "",
|
||||
"API_CUSTOM_SQL_description": "Vous pouvez specifier votre propre requête SQL qui retournera un fichier JSON et l'exposer via <a href=\"/api/table_custom_endpoint.json\" target=\"_blank\"><code>table_custom_endpoint.json</code> file endpoint</a>.",
|
||||
"API_CUSTOM_SQL_name": "Point de terminaison personnalisé",
|
||||
"API_display_name": "API",
|
||||
"API_icon": "",
|
||||
"API_icon": "<i class=\"fa fa-arrow-down-up-across-line\"></i>",
|
||||
"About_Design": "Conçu pour :",
|
||||
"About_Exit": "Quitter",
|
||||
"About_Title": "Analyse de la sécurité du réseau et cadre de notification",
|
||||
"AppEvents_DateTimeCreated": "Journalisé",
|
||||
"AppEvents_Extra": "Extra",
|
||||
"AppEvents_GUID": "",
|
||||
"AppEvents_Helper1": "",
|
||||
"AppEvents_Helper2": "",
|
||||
"AppEvents_Helper3": "",
|
||||
"AppEvents_Helper1": "Helper 1",
|
||||
"AppEvents_Helper2": "Helper 2",
|
||||
"AppEvents_Helper3": "Helper 3",
|
||||
"AppEvents_ObjectForeignKey": "Clé étrangère",
|
||||
"AppEvents_ObjectIndex": "Index",
|
||||
"AppEvents_ObjectIsArchived": "Est archivé (au moment de l'enregistrement)",
|
||||
"AppEvents_ObjectIsNew": "",
|
||||
"AppEvents_ObjectIsNew": "nouveau (au moment de l'enregistrement dans le journal)",
|
||||
"AppEvents_ObjectPlugin": "Greffon lié",
|
||||
"AppEvents_ObjectPrimaryID": "",
|
||||
"AppEvents_ObjectSecondaryID": "",
|
||||
"AppEvents_ObjectStatus": "Statut (au moment de l'enregistrement)",
|
||||
"AppEvents_ObjectPrimaryID": "Identité primaire",
|
||||
"AppEvents_ObjectSecondaryID": "Indentité secondaire",
|
||||
"AppEvents_ObjectStatus": "Status (au moment de l'enregistrement)",
|
||||
"AppEvents_ObjectStatusColumn": "Colonne d'état",
|
||||
"AppEvents_ObjectType": "Type d'objet",
|
||||
"AppEvents_Plugin": "Greffon",
|
||||
"AppEvents_Type": "Type",
|
||||
"BackDevDetail_Actions_Ask_Run": "",
|
||||
"BackDevDetail_Actions_Not_Registered": "",
|
||||
"BackDevDetail_Actions_Title_Run": "",
|
||||
"BackDevDetail_Copy_Ask": "",
|
||||
"BackDevDetail_Actions_Ask_Run": "Voulez vous executer cette commande ?",
|
||||
"BackDevDetail_Actions_Not_Registered": "Action non enregistrée ",
|
||||
"BackDevDetail_Actions_Title_Run": "Execute Action",
|
||||
"BackDevDetail_Copy_Ask": "Copie les details des objets selectioné dans la liste (tout ce qui est sur cette page sura remplacé)?",
|
||||
"BackDevDetail_Copy_Title": "Copier les détails",
|
||||
"BackDevDetail_Tools_WOL_error": "",
|
||||
"BackDevDetail_Tools_WOL_okay": "",
|
||||
"BackDevices_Arpscan_disabled": "",
|
||||
"BackDevices_Arpscan_enabled": "",
|
||||
"BackDevices_Backup_CopError": "",
|
||||
"BackDevices_Backup_Failed": "",
|
||||
"BackDevDetail_Tools_WOL_error": "Cette commande N'A PAS été exécutée.",
|
||||
"BackDevDetail_Tools_WOL_okay": "Commande Exécutée.",
|
||||
"BackDevices_Arpscan_disabled": "Arp-Scan Suspendu",
|
||||
"BackDevices_Arpscan_enabled": "Apr-Scan Activé",
|
||||
"BackDevices_Backup_CopError": "La base de donnée initiale n'a pas pu être sauvegardée.",
|
||||
"BackDevices_Backup_Failed": "La sauvegarde a été partiellement complétée. L'archive n'a pas pu être crée ou est vide.",
|
||||
"BackDevices_Backup_okay": "",
|
||||
"BackDevices_DBTools_DelDevError_a": "Erreur lors de la suppression de l'appareil",
|
||||
"BackDevices_DBTools_DelDevError_b": "Erreur lors de la suppression des appareils",
|
||||
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "Importation CSV",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Êtes-vous sûr de vouloir importer le fichier CSV ? Cela écrasera complètement les appareils de votre base de données.",
|
||||
"Maintenance_Tool_ImportCSV_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "Basculer l'arp-Scan (activé/désactivé)",
|
||||
"Maintenance_Tool_arpscansw_noti": "Activer ou désactiver l'arp-Scan",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "Une fois le scan désactivé, il reste désactivé jusqu'à ce qu'il soit réactivé.",
|
||||
@@ -687,4 +690,4 @@
|
||||
"settings_update_item_warning": "",
|
||||
"test_event_icon": "",
|
||||
"test_event_tooltip": ""
|
||||
}
|
||||
}
|
||||
|
||||
3
front/php/templates/language/it_it.json
Executable file → Normal file
3
front/php/templates/language/it_it.json
Executable file → Normal file
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "Importa CSV",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Sei sicuro di voler importare il file CSV? Questa operazione sovrascriverà tutti i dispositivi presenti nel database.",
|
||||
"Maintenance_Tool_ImportCSV_text": "Prima di utilizzare questa funzione, esegui un backup. Importa un file CSV (comma separated value) contenente la lista dei dispositivi incluse le relazioni di rete tra i nodi di rete e i dispositivi connessi. Per far ciò posiziona il file CSV denominato <b>devices.csv</b> nella cartella <b>/config</b>.",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "Attiva/disattiva arp-Scan",
|
||||
"Maintenance_Tool_arpscansw_noti": "Attiva o disattiva arp-Scan",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "Una volta disattivata la scansione rimane disattivata finché non viene nuovamente attivata.",
|
||||
|
||||
@@ -103,7 +103,8 @@ function lang($key)
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
// HTML encode the result before returning
|
||||
return str_replace("'", ''', $result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
5
front/php/templates/language/nb_no.json
Executable file → Normal file
5
front/php/templates/language/nb_no.json
Executable file → Normal file
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "Importer CSV",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Er du sikker på at du vil importere CSV-filen? Dette vil fullstendig overskrive enhetene i databasen din.",
|
||||
"Maintenance_Tool_ImportCSV_text": "Før du bruker denne funksjonen, vennligst ta en sikkerhetskopi. Importer en CSV-fil (kommaseparert verdi) som inneholder listen over enheter, inkludert nettverksrelasjoner mellom nettverksnoder og tilkoblede enheter. For å gjøre det, plasser CSV-filen med navnet <b>devices.csv</b> i mappen <b>/config</b>.",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "Slå arp-Scan (på/av)",
|
||||
"Maintenance_Tool_arpscansw_noti": "Slå arp-Scan på eller av",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "Når skanningen er slått av, forblir den slått av til den aktiveres igjen.",
|
||||
@@ -687,4 +690,4 @@
|
||||
"settings_update_item_warning": "Oppdater verdien nedenfor. Pass på å følge forrige format. <b>Validering etterpå utføres ikke.</b>",
|
||||
"test_event_icon": "fa-vial-circle-check",
|
||||
"test_event_tooltip": "Lagre endringene først, før du tester innstillingene dine."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "Import CSV",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Jesteś pewien że chcesz zaimportować plik CSV? Nadpisze to wszystkie urządzenie w bazie danych.",
|
||||
"Maintenance_Tool_ImportCSV_text": "Przed użyciem tej funkcji, wykonaj proszę kopię zapasową. Zaimportuj plik CSV (wartości oddzielone przecinkami) zawierający listę Urządzeń, w tym Relacji Sieci między sieciowymi węzłami i podłączonymi urządzeniami. By to zrobić umieść plik CSV nazwany <b>devices.csv</b> do twojego folderu <b>/config</b>.",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "Przełącz Skan-arp (wł/wył)",
|
||||
"Maintenance_Tool_arpscansw_noti": "Przełącz Skan-arp na włączony lub wyłączony",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "Kiedy skan zostanie przełączony na wył zostaje wyłączony do czasu ponownej aktywacji.",
|
||||
|
||||
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportCSV_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "",
|
||||
"Maintenance_Tool_arpscansw_noti": "",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "",
|
||||
|
||||
15
front/php/templates/language/ru_ru.json
Executable file → Normal file
15
front/php/templates/language/ru_ru.json
Executable file → Normal file
@@ -358,9 +358,9 @@
|
||||
"Login_Toggle_Alert_headline": "Предупреждение о пароле!",
|
||||
"Login_Toggle_Info": "Информация о пароле",
|
||||
"Login_Toggle_Info_headline": "Информация о пароле",
|
||||
"Maint_PurgeLog": "",
|
||||
"Maint_RestartServer": "",
|
||||
"Maint_Restart_Server_noti_text": "",
|
||||
"Maint_PurgeLog": "Журнал очистки",
|
||||
"Maint_RestartServer": "Перезапустить сервер",
|
||||
"Maint_Restart_Server_noti_text": "Вы уверены, что хотите перезапустить внутренний сервер? Это может привести к несогласованности работы приложения. Сначала создайте резервную копию настроек. <br/> <br/> Примечание: Это может занять несколько минут.",
|
||||
"Maintenance_Running_Version": "Установленная версия",
|
||||
"Maintenance_Status": "Статус",
|
||||
"Maintenance_Title": "Инструменты обслуживания",
|
||||
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "CSV Импорт",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "Вы уверены, что хотите импортировать файл CSV? Это полностью перезапишет устройства в вашей базе данных.",
|
||||
"Maintenance_Tool_ImportCSV_text": "Прежде чем использовать эту функцию, сделайте резервную копию. Импортируйте файл CSV (значения, разделенные запятыми), содержащий список устройств, включая сетевые отношения между сетевыми узлами и подключенными устройствами. Для этого поместите файл CSV с именем <b>devices.csv</b> в папку <b>/config</b>.",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "Переключить arp-скан (ВКЛ./ВЫКЛ.)",
|
||||
"Maintenance_Tool_arpscansw_noti": "Включить или выключить arp-скан",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "Когда сканирование было выключено, оно остается выключенным до тех пор, пока не будет активировано снова.",
|
||||
@@ -664,7 +667,7 @@
|
||||
"settings_core_label": "Основные",
|
||||
"settings_device_scanners": "Сканеры устройств, используемые для обнаружения устройств, записывающих данные в таблицу базы данных CurrentScan.",
|
||||
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
|
||||
"settings_device_scanners_info": "",
|
||||
"settings_device_scanners_info": "Загрузите еще больше сканеров устройств с помощью параметра <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a>",
|
||||
"settings_device_scanners_label": "Сканеры устройств",
|
||||
"settings_enabled": "Вкл. настройки",
|
||||
"settings_enabled_icon": "fa-solid fa-toggle-on",
|
||||
@@ -679,7 +682,7 @@
|
||||
"settings_other_scanners_label": "Другие сканеры",
|
||||
"settings_publishers": "Включенные шлюзы уведомлений - сервисы, которые будут отправлять уведомления в зависимости от ваших настроек.",
|
||||
"settings_publishers_icon": "fa-solid fa-paper-plane",
|
||||
"settings_publishers_info": "",
|
||||
"settings_publishers_info": "Загрузите больше нотификаторов с помощью настройки <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a>",
|
||||
"settings_publishers_label": "Уведомления",
|
||||
"settings_saved": "<br/>Настройки сохранены. <br/> Перезагрузка... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
|
||||
"settings_system_icon": "fa-solid fa-gear",
|
||||
@@ -687,4 +690,4 @@
|
||||
"settings_update_item_warning": "Обновить значение ниже. Будьте осторожны, следуя предыдущему формату. <b>Проверка не выполняется.</b>",
|
||||
"test_event_icon": "fa-vial-circle-check",
|
||||
"test_event_tooltip": "Сначала сохраните изменения, прежде чем проверять настройки."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportCSV_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "",
|
||||
"Maintenance_Tool_arpscansw_noti": "",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "",
|
||||
|
||||
@@ -372,6 +372,9 @@
|
||||
"Maintenance_Tool_ImportCSV_noti": "",
|
||||
"Maintenance_Tool_ImportCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportCSV_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_noti_text": "",
|
||||
"Maintenance_Tool_ImportPastedCSV_text": "",
|
||||
"Maintenance_Tool_arpscansw": "",
|
||||
"Maintenance_Tool_arpscansw_noti": "",
|
||||
"Maintenance_Tool_arpscansw_noti_text": "",
|
||||
|
||||
@@ -40,3 +40,4 @@ $timestamp = $date->format('Y-m-d_H-i-s');
|
||||
// ###################################
|
||||
// ## TimeZone processing end
|
||||
// ###################################
|
||||
|
||||
|
||||
@@ -24,39 +24,41 @@ NetAlertX supports additional plugins to extend its functionality, each with its
|
||||
Device-detecting plugins insert values into the `CurrentScan` database table. The plugins that are not required are safe to ignore, however, it makes sense to have at least some device-detecting plugins enabled, such as `ARPSCAN` or `NMAPDEV`.
|
||||
|
||||
|
||||
| ID | Type | Description | Required | Data source | Detailed docs |
|
||||
|---------------|---------|---------------------------------------------|----------|--------------------|---------------------------------------------------------------|
|
||||
| `APPRISE` | ▶️ | Apprise notification proxy | | Script | [📚_publisher_apprise](/front/plugins/_publisher_apprise/) |
|
||||
| `ARPSCAN` | 🔍 | ARP-scan on current network | | Script | [📚arp_scan](/front/plugins/arp_scan/) |
|
||||
| `CSVBCKP` | ⚙ | CSV devices backup | | Script | [📚csv_backup](/front/plugins/csv_backup/) |
|
||||
| `DBCLNP` | ⚙ | Database cleanup | Yes* | Script | [📚db_cleanup](/front/plugins/db_cleanup/) |
|
||||
| `DDNS` | ⚙ | DDNS update | | Script | [📚ddns_update](/front/plugins/ddns_update/) |
|
||||
| `DHCPLSS` | 🔍/📥 | Import devices from DHCP leases | | Script | [📚dhcp_leases](/front/plugins/dhcp_leases/) |
|
||||
| `DHCPSRVS` | ♻ | DHCP servers | | Script | [📚dhcp_servers](/front/plugins/dhcp_servers/) |
|
||||
| `INTRNT` | 🔍 | Internet IP scanner | | Script | [📚internet_ip](/front/plugins/internet_ip/) |
|
||||
| `INTRSPD` | ♻ | Internet speed test | | Script | [📚internet_speedtest](/front/plugins/internet_speedtest/) |
|
||||
| `MAINT` | ⚙ | Maintenance of logs, etc. | | Script | [📚maintenance](/front/plugins/maintenance/) |
|
||||
| `MQTT` | ▶️ | MQTT for synching to Home Assistant | | Script | [📚_publisher_mqtt](/front/plugins/_publisher_mqtt/) |
|
||||
| `NEWDEV` | ⚙ | New device template | Yes | Template | [📚newdev_template](/front/plugins/newdev_template/) |
|
||||
| `NMAP` | ♻ | Nmap port scanning & discovery | | Script | [📚nmap_scan](/front/plugins/nmap_scan/) |
|
||||
| `NMAPDEV` | 🔍 | Nmap dev scan on current network | | Script | [📚nmap_dev_scan](/front/plugins/nmap_dev_scan/) |
|
||||
| `NSLOOKUP` | ♻ | NSLookup name resolution | | Script | [📚nslookup_scan](/front/plugins/nslookup_scan/) |
|
||||
| `NTFPRCS` | ⚙ | Notification processing | Yes | Template | [📚notification_processing](/front/plugins/notification_processing/)|
|
||||
| `NTFY` | ▶️ | NTFY notifications | | Script | [📚_publisher_ntfy](/front/plugins/_publisher_ntfy/) |
|
||||
| `PHOLUS` | ♻ | Pholus name resolution | | Script | [📚pholus_scan](/front/plugins/pholus_scan/) |
|
||||
| `PIHOLE` | 🔍/📥 | Pi-hole device import & sync | | SQLite DB | [📚pihole_scan](/front/plugins/pihole_scan/) |
|
||||
| `PUSHSAFER` | ▶️ | Pushsafer notifications | | Script | [📚_publisher_pushsafer](/front/plugins/_publisher_pushsafer/) |
|
||||
| `PUSHOVER` | ▶️ | Pushover notifications | | Script | [📚_publisher_pushover](/front/plugins/_publisher_pushover/) |
|
||||
| `SETPWD` | ⚙ | Set password | Yes | Template | [📚set_password](/front/plugins/set_password/) |
|
||||
| `SMTP` | ▶️ | Email notifications | | Script | [📚_publisher_email](/front/plugins/_publisher_email/) |
|
||||
| `SNMPDSC` | 🔍/📥 | SNMP device import & sync | | Script | [📚snmp_discovery](/front/plugins/snmp_discovery/) |
|
||||
| `SYNC` | 🔍/⚙/📥| Sync & import from other NetAlertX instances | | Script | [📚snmp_discovery](/front/plugins/snmp_discovery/) |
|
||||
| `UNDIS` | 🔍/📥 | Create dummy devices | | Script | [📚undiscoverables](/front/plugins/undiscoverables/) |
|
||||
| `UNFIMP` | 🔍/📥 | UniFi device import & sync | | Script | [📚unifi_import](/front/plugins/unifi_import/) |
|
||||
| `VNDRPDT` | ⚙ | Vendor database update | | Script | [📚vendor_update](/front/plugins/vendor_update/) |
|
||||
| `WEBHOOK` | ▶️ | Webhook notifications | | Script | [📚_publisher_webhook](/front/plugins/_publisher_webhook/) |
|
||||
| `WEBMON` | ♻ | Website down monitoring | | Script | [📚website_monitor](/front/plugins/website_monitor/)
|
||||
|
||||
| ID | Type | Description | Features | Required | Data source | Detailed docs |
|
||||
|---------------|---------|--------------------------------------------|----------|----------|--------------------|---------------------------------------------------------------|
|
||||
| `APPRISE` | ▶️ | Apprise notification proxy | | | Script | [_publisher_apprise](/front/plugins/_publisher_apprise/) |
|
||||
| `ARPSCAN` | 🔍 | ARP-scan on current network | | | Script | [arp_scan](/front/plugins/arp_scan/) |
|
||||
| `CSVBCKP` | ⚙ | CSV devices backup | | | Script | [csv_backup](/front/plugins/csv_backup/) |
|
||||
| `DBCLNP` | ⚙ | Database cleanup | | Yes* | Script | [db_cleanup](/front/plugins/db_cleanup/) |
|
||||
| `DDNS` | ⚙ | DDNS update | | | Script | [ddns_update](/front/plugins/ddns_update/) |
|
||||
| `DHCPLSS` | 🔍/📥 | Import devices from DHCP leases | | | Script | [dhcp_leases](/front/plugins/dhcp_leases/) |
|
||||
| `DHCPSRVS` | ♻ | DHCP servers | | | Script | [dhcp_servers](/front/plugins/dhcp_servers/) |
|
||||
| `INTRNT` | 🔍 | Internet IP scanner | | | Script | [internet_ip](/front/plugins/internet_ip/) |
|
||||
| `INTRSPD` | ♻ | Internet speed test | | | Script | [internet_speedtest](/front/plugins/internet_speedtest/) |
|
||||
| `MAINT` | ⚙ | Maintenance of logs, etc. | | | Script | [maintenance](/front/plugins/maintenance/) |
|
||||
| `MQTT` | ▶️ | MQTT for synching to Home Assistant | | | Script | [_publisher_mqtt](/front/plugins/_publisher_mqtt/) |
|
||||
| `NBTSCAN` | ♻ | Nbtscan (NetBIOS-based) name resolution | | | Script | [nbtscan_scan](/front/plugins/nbtscan_scan/) |
|
||||
| `NEWDEV` | ⚙ | New device template | | Yes | Template | [newdev_template](/front/plugins/newdev_template/) |
|
||||
| `NMAP` | ♻ | Nmap port scanning & discovery | | | Script | [nmap_scan](/front/plugins/nmap_scan/) |
|
||||
| `NMAPDEV` | 🔍 | Nmap dev scan on current network | | | Script | [nmap_dev_scan](/front/plugins/nmap_dev_scan/) |
|
||||
| `NSLOOKUP` | ♻ | NSLookup (DNS-based) name resolution | | | Script | [nslookup_scan](/front/plugins/nslookup_scan/) |
|
||||
| `NTFPRCS` | ⚙ | Notification processing | | Yes | Template | [notification_processing](/front/plugins/notification_processing/)|
|
||||
| `NTFY` | ▶️ | NTFY notifications | | | Script | [_publisher_ntfy](/front/plugins/_publisher_ntfy/) |
|
||||
| `OMDSDN` | 📥 | OMADA TP-Link import | 📊🔄 | | Script | [omada_sdn_imp](/front/plugins/omada_sdn_imp/) |
|
||||
| `PHOLUS` | ♻ | Pholus name resolution | | | Script | [pholus_scan](/front/plugins/pholus_scan/) |
|
||||
| `PIHOLE` | 🔍/📥 | Pi-hole device import & sync | | | SQLite DB | [pihole_scan](/front/plugins/pihole_scan/) |
|
||||
| `PUSHSAFER` | ▶️ | Pushsafer notifications | | | Script | [_publisher_pushsafer](/front/plugins/_publisher_pushsafer/) |
|
||||
| `PUSHOVER` | ▶️ | Pushover notifications | | | Script | [_publisher_pushover](/front/plugins/_publisher_pushover/) |
|
||||
| `SETPWD` | ⚙ | Set password | | Yes | Template | [set_password](/front/plugins/set_password/) |
|
||||
| `SMTP` | ▶️ | Email notifications | | | Script | [_publisher_email](/front/plugins/_publisher_email/) |
|
||||
| `SNMPDSC` | 🔍/📥 | SNMP device import & sync | | | Script | [snmp_discovery](/front/plugins/snmp_discovery/) |
|
||||
| `SYNC` | 🔍/⚙/📥| Sync & import from NetAlertX instances | 📊🔄 | | Script | [sync](/front/plugins/sync/) |
|
||||
| `UNDIS` | 🔍/📥 | Create dummy devices | | | Script | [undiscoverables](/front/plugins/undiscoverables/) |
|
||||
| `UNFIMP` | 🔍/📥 | UniFi device import & sync | | | Script | [unifi_import](/front/plugins/unifi_import/) |
|
||||
| `VNDRPDT` | ⚙ | Vendor database update | | | Script | [vendor_update](/front/plugins/vendor_update/) |
|
||||
| `WEBHOOK` | ▶️ | Webhook notifications | | | Script | [_publisher_webhook](/front/plugins/_publisher_webhook/) |
|
||||
| `WEBMON` | ♻ | Website down monitoring | | | Script | [website_monitor](/front/plugins/website_monitor/) |
|
||||
|
||||
|
||||
> \* The database cleanup plugin (`DBCLNP`) is not _required_ but the app will become unusable after a while if not executed.
|
||||
>
|
||||
@@ -75,11 +77,19 @@ Device-detecting plugins insert values into the `CurrentScan` database table. T
|
||||
| system | ⚙ | Providing core system functionality. | `schedule` / always on | ✖/✔ | Script / Template |
|
||||
| other | ♻ | Other scanners, e.g. for name resolution | misc | ✖ | Script / Template |
|
||||
|
||||
## Features
|
||||
|
||||
| Icon | Description |
|
||||
|------|---------------------------------------------------------------|
|
||||
| 📊 | Auto-imports the network topology diagram |
|
||||
| 🔄 | Has the option to sync some data back into the plugin source |
|
||||
|
||||
|
||||
## ✅Enabling plugins
|
||||
|
||||
Plugins can be enabled via Settings, and can be disabled as needed.
|
||||
|
||||
1. Research which plugin you'd like to use below and then load the required plugins in Settings via the `LOADED_PLUGINS` setting.
|
||||
1. Research which plugin you'd like to use and load the required plugins in Settings via the `LOADED_PLUGINS` setting.
|
||||
1. Save the changes and review the Settings of the newly loaded plugins.
|
||||
1. Change the `<prefix>_RUN` Setting to the recommended or custom value as per the documentation of the given setting
|
||||
- If using `schedule` on a `🔍 dev scanner` plugin, make sure the schedules are the same across all `🔍 dev scanner` plugins
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "__template",
|
||||
"unique_prefix": "TMP",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_0",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"mapped_to_table": "CurrentScan",
|
||||
@@ -39,7 +40,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
@@ -66,7 +72,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -85,7 +96,12 @@
|
||||
},
|
||||
{
|
||||
"function": "text_example",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -105,7 +121,16 @@
|
||||
},
|
||||
{
|
||||
"function": "boolean_example",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -124,7 +149,63 @@
|
||||
},
|
||||
{
|
||||
"function": "list_example",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["existing_entry_1", "existing_entry_2"],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -143,7 +224,12 @@
|
||||
},
|
||||
{
|
||||
"function": "multiselect_example_from_setting",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"element": "select",
|
||||
"elementOptions": ["multiple"],
|
||||
"transformers": []
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": [],
|
||||
"options": ["{value}"],
|
||||
@@ -170,7 +256,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"element": "input",
|
||||
"elementOptions": ["readonly"],
|
||||
"transformers": []
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/<plugin folder>/rename_me.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -189,7 +280,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
82
front/plugins/__test/test.py
Executable file
82
front/plugins/__test/test.py
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env python
|
||||
# Just a testing library plugin for development purposes
|
||||
import json
|
||||
import subprocess
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
from datetime import datetime
|
||||
import time
|
||||
import re
|
||||
import hashlib
|
||||
import sqlite3
|
||||
|
||||
|
||||
# Register NetAlertX directories
|
||||
INSTALL_PATH="/app"
|
||||
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
||||
|
||||
# NetAlertX modules
|
||||
import conf
|
||||
from const import apiPath, confFileName
|
||||
from plugin_utils import getPluginObject
|
||||
from plugin_helper import Plugin_Objects
|
||||
from logger import mylog, append_line_to_file
|
||||
from helper import timeNowTZ, get_setting_value, bytes_to_string, sanitize_string, cleanDeviceName
|
||||
from notification import Notification_obj
|
||||
from database import DB, get_device_stats
|
||||
|
||||
|
||||
CUR_PATH = str(pathlib.Path(__file__).parent.resolve())
|
||||
RESULT_FILE = os.path.join(CUR_PATH, 'last_result.log')
|
||||
|
||||
|
||||
# Initialize the Plugin obj output file
|
||||
plugin_objects = Plugin_Objects(RESULT_FILE)
|
||||
# Create an MD5 hash object
|
||||
md5_hash = hashlib.md5()
|
||||
|
||||
pluginName = 'TESTONLY'
|
||||
|
||||
# globals
|
||||
|
||||
|
||||
def main():
|
||||
# START
|
||||
mylog('verbose', [f'[{pluginName}] In script'])
|
||||
|
||||
# SPACE FOR TESTING 🔽
|
||||
|
||||
str = "ABC-MBP._another.localdomain."
|
||||
# cleanDeviceName(str, match_IP)
|
||||
# result = cleanDeviceName(str, True)
|
||||
|
||||
regexes = get_setting_value('NEWDEV_NAME_CLEANUP_REGEX')
|
||||
|
||||
print(regexes)
|
||||
subnets = get_setting_value('SCAN_SUBNETS')
|
||||
|
||||
print(subnets)
|
||||
|
||||
for rgx in regexes:
|
||||
mylog('trace', ["[cleanDeviceName] applying regex : " + rgx])
|
||||
mylog('trace', ["[cleanDeviceName] name before regex : " + str])
|
||||
|
||||
str = re.sub(rgx, "", str)
|
||||
mylog('trace', ["[cleanDeviceName] name after regex : " + str])
|
||||
|
||||
mylog('debug', ["[cleanDeviceName] output: " + str])
|
||||
|
||||
|
||||
# SPACE FOR TESTING 🔼
|
||||
|
||||
# END
|
||||
mylog('verbose', [f'[{pluginName}] result "{str}"'])
|
||||
|
||||
|
||||
|
||||
|
||||
# -------------INIT---------------------
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -288,7 +288,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["test"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "on_notification"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -315,7 +320,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/_publisher_apprise/apprise.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -342,7 +356,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -373,7 +396,12 @@
|
||||
},
|
||||
{
|
||||
"function": "HOST",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -400,7 +428,12 @@
|
||||
},
|
||||
{
|
||||
"function": "URL",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -427,7 +460,12 @@
|
||||
},
|
||||
{
|
||||
"function": "PAYLOAD",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "html",
|
||||
"options": ["html", "text"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -444,7 +482,7 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Select the payoad type sent to Apprise. For example <code>html</code> works well with emails, <code>text</code> with chat apps, such as Telegram."
|
||||
"string": "Select the payload type sent to Apprise. For example <code>html</code> works well with emails, <code>text</code> with chat apps, such as Telegram."
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
@@ -454,7 +492,16 @@
|
||||
},
|
||||
{
|
||||
"function": "SIZE",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1024,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -288,7 +288,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["test"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "on_notification"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -315,7 +320,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/_publisher_email/email_smtp.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -342,7 +356,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 20,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -373,7 +396,12 @@
|
||||
},
|
||||
{
|
||||
"function": "SERVER",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -400,7 +428,16 @@
|
||||
},
|
||||
{
|
||||
"function": "PORT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 587,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -427,7 +464,16 @@
|
||||
},
|
||||
{
|
||||
"function": "SKIP_LOGIN",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -454,7 +500,12 @@
|
||||
},
|
||||
{
|
||||
"function": "USER",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -481,7 +532,16 @@
|
||||
},
|
||||
{
|
||||
"function": "PASS",
|
||||
"type": "password",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "password" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -508,7 +568,16 @@
|
||||
},
|
||||
{
|
||||
"function": "SKIP_TLS",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -535,7 +604,16 @@
|
||||
},
|
||||
{
|
||||
"function": "FORCE_SSL",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -562,7 +640,12 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_TO",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "user@gmail.com",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -589,7 +672,12 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_FROM",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "NetAlertX <user@gmail.com>",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -56,6 +56,19 @@ def main():
|
||||
# Retrieve new notifications
|
||||
new_notifications = notifications.getNew()
|
||||
|
||||
# mylog('verbose', [f'[{pluginName}] new_notifications: ', new_notifications])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_SERVER: ', get_setting_value("SMTP_SERVER")])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_PORT: ', get_setting_value("SMTP_PORT")])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_SKIP_LOGIN: ', get_setting_value("SMTP_SKIP_LOGIN")])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_USER: ', get_setting_value("SMTP_USER")])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_PASS: ', get_setting_value("SMTP_PASS")])
|
||||
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_SKIP_TLS: ', get_setting_value("SMTP_SKIP_TLS")])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_FORCE_SSL: ', get_setting_value("SMTP_FORCE_SSL")])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_REPORT_TO: ', get_setting_value("SMTP_REPORT_TO")])
|
||||
# mylog('verbose', [f'[{pluginName}] SMTP_REPORT_FROM: ', get_setting_value("SMTP_REPORT_FROM")])
|
||||
|
||||
|
||||
# Process the new notifications (see the Notifications DB table for structure or check the /api/table_notifications.json endpoint)
|
||||
for notification in new_notifications:
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "A plugin to publish a notification via the Apprise gateway."
|
||||
"string": "A plugin to publish a notification via MQTT to Home Assistant."
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
@@ -278,7 +278,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["test"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -312,7 +317,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/_publisher_mqtt/mqtt.py devices={devices}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -339,7 +353,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * 3",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -374,7 +393,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 20,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -405,7 +433,12 @@
|
||||
},
|
||||
{
|
||||
"function": "BROKER",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -432,7 +465,16 @@
|
||||
},
|
||||
{
|
||||
"function": "PORT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1883,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -459,7 +501,12 @@
|
||||
},
|
||||
{
|
||||
"function": "USER",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -486,7 +533,16 @@
|
||||
},
|
||||
{
|
||||
"function": "PASSWORD",
|
||||
"type": "password",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "password" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -513,7 +569,16 @@
|
||||
},
|
||||
{
|
||||
"function": "SEND_STATS",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": true,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -532,7 +597,12 @@
|
||||
},
|
||||
{
|
||||
"function": "DEVICE_ID",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "netalertx",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -551,7 +621,12 @@
|
||||
},
|
||||
{
|
||||
"function": "DEVICE_NAME",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "NetAlertX",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -570,7 +645,16 @@
|
||||
},
|
||||
{
|
||||
"function": "SEND_DEVICES",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": true,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -587,9 +671,38 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "DEVICES_SQL",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "select rowid, * from Devices where dev_Name not in ({s-quote}null{s-quote}, {s-quote}(name not found){s-quote}, {s-quote}(unknown){s-quote})",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Devices SQL"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The SQL condition used to select which Devices are sent via MQTT. Please note that you need to use <code>{s-quote}</code> for single quotes replacement and double-quotes are not supported."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "QOS",
|
||||
"type": "integer.select",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [0, 1, 2],
|
||||
"localized": ["name", "description"],
|
||||
@@ -616,7 +729,12 @@
|
||||
},
|
||||
{
|
||||
"function": "VERSION",
|
||||
"type": "integer.select",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [1, 2],
|
||||
"localized": ["name", "description"],
|
||||
@@ -635,7 +753,16 @@
|
||||
},
|
||||
{
|
||||
"function": "DELAY_SEC",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 2,
|
||||
"options": [2, 3, 4, 5],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -13,6 +13,7 @@ import paho.mqtt.client as mqtt
|
||||
# from paho.mqtt import client as mqtt_client
|
||||
# from paho.mqtt import CallbackAPIVersion as mqtt_CallbackAPIVersion
|
||||
import hashlib
|
||||
import sqlite3
|
||||
|
||||
|
||||
# Register NetAlertX directories
|
||||
@@ -27,7 +28,7 @@ from plugin_helper import Plugin_Objects
|
||||
from logger import mylog, append_line_to_file
|
||||
from helper import timeNowTZ, get_setting_value, bytes_to_string, sanitize_string
|
||||
from notification import Notification_obj
|
||||
from database import DB, get_all_devices, get_device_stats
|
||||
from database import DB, get_device_stats
|
||||
|
||||
|
||||
CUR_PATH = str(pathlib.Path(__file__).parent.resolve())
|
||||
@@ -340,10 +341,10 @@ def mqtt_start(db):
|
||||
# Generate device-specific MQTT messages if enabled
|
||||
if get_setting_value('MQTT_SEND_DEVICES') == True:
|
||||
|
||||
# Specific devices
|
||||
# Specific devices processing
|
||||
|
||||
# Get all devices
|
||||
devices = get_all_devices(db)
|
||||
devices = db.read(get_setting_value('MQTT_DEVICES_SQL').replace('{s-quote}',"'"))
|
||||
|
||||
sec_delay = len(devices) * int(get_setting_value('MQTT_DELAY_SEC'))*5
|
||||
|
||||
|
||||
@@ -242,7 +242,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["test"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "on_notification"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -269,7 +274,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/_publisher_ntfy/ntfy.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -296,7 +310,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -327,7 +350,12 @@
|
||||
},
|
||||
{
|
||||
"function": "HOST",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "https://ntfy.sh",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -354,7 +382,12 @@
|
||||
},
|
||||
{
|
||||
"function": "TOPIC",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -381,7 +414,12 @@
|
||||
},
|
||||
{
|
||||
"function": "USER",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -408,7 +446,16 @@
|
||||
},
|
||||
{
|
||||
"function": "PASSWORD",
|
||||
"type": "password",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "password" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -435,7 +482,12 @@
|
||||
},
|
||||
{
|
||||
"function": "PRIORITY",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "urgent",
|
||||
"options": ["urgent", "high", "default", "low", "min"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -242,7 +242,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["test"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "on_notification"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -269,7 +274,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/_publisher_pushover/pushover.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -296,7 +310,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -323,7 +346,12 @@
|
||||
},
|
||||
{
|
||||
"function": "USER_KEY",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "USER_KEY",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -342,7 +370,12 @@
|
||||
},
|
||||
{
|
||||
"function": "APP_TOKEN",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "APP_TOKEN",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -361,7 +394,12 @@
|
||||
},
|
||||
{
|
||||
"function": "DEVICE_NAME",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "DEVICE_NAME",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -242,7 +242,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["test"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "on_notification"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -269,7 +274,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/_publisher_pushsafer/pushsafer.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -296,7 +310,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -327,7 +350,12 @@
|
||||
},
|
||||
{
|
||||
"function": "TOKEN",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "ApiKey",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -242,7 +242,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["test"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "on_notification"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -269,7 +274,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/_publisher_webhook/webhook.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -296,7 +310,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -327,7 +350,12 @@
|
||||
},
|
||||
{
|
||||
"function": "URL",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -354,7 +382,12 @@
|
||||
},
|
||||
{
|
||||
"function": "PAYLOAD",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "json",
|
||||
"options": ["json", "html", "text"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -381,7 +414,12 @@
|
||||
},
|
||||
{
|
||||
"function": "REQUEST_METHOD",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "GET",
|
||||
"options": ["GET", "POST", "PUT"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -408,7 +446,16 @@
|
||||
},
|
||||
{
|
||||
"function": "SIZE",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1024,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -435,7 +482,12 @@
|
||||
},
|
||||
{
|
||||
"function": "SECRET",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"code_name": "arp_scan",
|
||||
"unique_prefix": "ARPSCAN",
|
||||
"execution_order" : "Layer_2",
|
||||
"plugin_type": "device_scanner",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
@@ -69,8 +70,13 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "text.select",
|
||||
"default_value": "schedule",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
"once",
|
||||
@@ -111,7 +117,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/arp_scan/script.py userSubnets={subnets}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -146,7 +161,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 300,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -181,7 +205,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -216,7 +245,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1", "Watched_Value2"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -256,7 +294,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new"],
|
||||
"options": [
|
||||
"new",
|
||||
@@ -296,7 +343,12 @@
|
||||
},
|
||||
{
|
||||
"function": "ARGS",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "sudo arp-scan --ignoredups --retry=6",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -58,7 +58,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "schedule",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -99,7 +104,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/csv_backup/script.py overwrite={overwrite} location={location}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -134,7 +148,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * 3",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -169,7 +188,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -204,7 +232,16 @@
|
||||
},
|
||||
{
|
||||
"function": "overwrite",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -239,7 +276,12 @@
|
||||
},
|
||||
{
|
||||
"function": "location",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "/app/config",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -47,7 +47,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "schedule",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -74,7 +79,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/db_cleanup/script.py pluginskeephistory={pluginskeephistory} hourstokeepnewdevice={hourstokeepnewdevice} daystokeepevents={daystokeepevents} pholuskeepdays={pholuskeepdays}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -109,7 +123,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/30 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -144,7 +163,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -179,7 +207,16 @@
|
||||
},
|
||||
{
|
||||
"function": "NOTIFI_HIST",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 100,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -76,7 +76,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -107,7 +112,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/ddns_update/script.py prev_ip={prev_ip} DDNS_UPDATE_URL={DDNS_UPDATE_URL} DDNS_USER={DDNS_USER} DDNS_PASSWORD={DDNS_PASSWORD} DDNS_DOMAIN={DDNS_DOMAIN} ",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -142,7 +156,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -177,7 +196,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -212,7 +240,12 @@
|
||||
},
|
||||
{
|
||||
"function": "DOMAIN",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "your_domain.freeddns.org",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -247,7 +280,12 @@
|
||||
},
|
||||
{
|
||||
"function": "USER",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "dynu_user",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -282,7 +320,16 @@
|
||||
},
|
||||
{
|
||||
"function": "PASSWORD",
|
||||
"type": "password",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "password" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "A0000000B0000000C0000000D0000000",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -317,7 +364,12 @@
|
||||
},
|
||||
{
|
||||
"function": "UPDATE_URL",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "https://api.dynu.com/nic/update?",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -352,7 +404,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -388,7 +449,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": [
|
||||
"new",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "dhcp_leases",
|
||||
"unique_prefix": "DHCPLSS",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_3",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"data_filters": [
|
||||
@@ -414,7 +415,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -455,7 +461,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/dhcp_leases/script.py paths={paths}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -490,7 +501,63 @@
|
||||
},
|
||||
{
|
||||
"function": "paths_to_check",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["/mnt/dhcp1.leases", "/mnt/dhcp2.leases"],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -511,21 +578,18 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Add all dhcp.leases mapped paths to watch. Enter full path within the container, e.g. <code>/mnt/dhcp2.leases</code>. You must map these files accordingly in your <code>docker-compose.yml</code> file. (If you are mapping a PiHole dhcp.leases file the path in the container must contain <code>pihole</code>, e.g.: <code>:/etc/pihole/dhcp.leases</code>)"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Agregue todas las rutas asignadas de dhcp.leases para observar. Ingrese la ruta completa dentro del contenedor, p.e. <code>/mnt/dhcp2.leases</code>. Debe asignar estos archivos en consecuencia en su archivo <code>docker-compose.yml</code>. (Si está asignando un archivo PiHole dhcp.leases, la ruta en el contenedor debe contener <code>pihole</code>, por ejemplo: <code>:/etc/pihole/dhcp.leases</code>)"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Alle zu überwachenden dhcp.leases-Pfade hinzufügen. Den absoluten Pfad innerhalb des Containers angeben, z.B. <code>/mnt/dchp2.leases</code>. Diese Dateien müssen korrekt in der <code>docker-compose.yml</code> gemapped werden. Wird eine PiHole dhcp.leases-Datei in den Container gemapped, so muss der Pfad im Container <code>pihole</code> inkludieren, z.B. <code>:/etc/pihole/dhcp.leases</code>"
|
||||
"string": "Add all dhcp.leases mapped paths to watch. Enter full path within the container, e.g. <code>/mnt/dhcp2.leases</code>. You must map these files accordingly in your <code>docker-compose.yml</code> file. Supports pihole, dnsmasq, and generic formats. <br><br> For dnsmasq or pihole the path in the container must contain <code>pihole</code> or <code>dnsmasq</code>; e.g.: <code>:/etc/pihole/dhcp.leases</code>). See the above docs for details."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -560,7 +624,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 5,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -595,7 +668,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1", "Watched_Value4"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -635,7 +717,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": [
|
||||
"new",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "dhcp_servers",
|
||||
"unique_prefix": "DHCPSRVS",
|
||||
"plugin_type": "other",
|
||||
"execution_order" : "Layer_3",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"show_ui": true,
|
||||
@@ -307,7 +308,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -340,7 +346,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/dhcp_servers/script.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -367,7 +378,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -394,7 +410,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -425,7 +450,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -457,7 +491,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": ["new", "watched-changed", "watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -153,7 +153,16 @@
|
||||
"string": "Device ID Parameter"
|
||||
}
|
||||
],
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "1",
|
||||
"localized": ["name"]
|
||||
},
|
||||
@@ -164,7 +173,16 @@
|
||||
"string": "Event Type Parameter"
|
||||
}
|
||||
],
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "device_down",
|
||||
"localized": ["name"]
|
||||
},
|
||||
@@ -175,7 +193,16 @@
|
||||
"string": "Repetition Count Parameter"
|
||||
}
|
||||
],
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 3,
|
||||
"localized": ["name"]
|
||||
}
|
||||
@@ -216,7 +243,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "UPDATE Devices SET dev_AlertDeviceDown = {KNWN_dev_AlertDeviceDown}, dev_AlertEvents = {KNWN_dev_AlertEvents} WHERE dev_MAC in ({target_macs})",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -235,7 +267,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Name",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "(unknown)",
|
||||
"options": [],
|
||||
@@ -255,7 +296,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Owner",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 30,
|
||||
"default_value": "House",
|
||||
"override_value": {
|
||||
@@ -278,7 +324,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_DeviceType",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 30,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -298,7 +349,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Vendor",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -318,7 +378,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Favorite",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"override_value": {
|
||||
"override": false
|
||||
@@ -340,7 +409,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Group",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 10,
|
||||
"default_value": "",
|
||||
"override_value": {
|
||||
@@ -363,7 +437,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Comments",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -382,7 +461,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_FirstConnection",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -402,7 +490,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastConnection",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -422,7 +519,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastIP",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -442,7 +548,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_StaticIP",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"override_value": {
|
||||
"override": true
|
||||
@@ -464,7 +579,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_ScanCycle",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"override_value": {
|
||||
"override": true
|
||||
@@ -486,7 +610,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LogEvents",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"override_value": {
|
||||
"override": false
|
||||
@@ -508,7 +641,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertEvents",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"override_value": {
|
||||
"override": true
|
||||
@@ -530,7 +672,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertDeviceDown",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -549,7 +700,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_SkipRepeated",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -568,7 +728,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastNotification",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -588,7 +757,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_PresentLastScan",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -607,7 +785,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_NewDevice",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": true,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -626,7 +813,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Location",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -646,7 +838,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Archived",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -665,7 +866,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_MAC_ADDR",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -684,7 +890,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_port",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -703,7 +918,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Icon",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "internet_ip",
|
||||
"unique_prefix": "INTRNT",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_3",
|
||||
"enabled": true,
|
||||
"mapped_to_table": "CurrentScan",
|
||||
"data_filters": [
|
||||
@@ -63,8 +64,13 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"default_value": "schedule",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
@@ -94,7 +100,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/internet_ip/script.py prev_ip={prev_ip} INTRNT_DIG_GET_IP_ARG={INTRNT_DIG_GET_IP_ARG}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -129,7 +144,12 @@
|
||||
},
|
||||
{
|
||||
"function": "DIG_GET_IP_ARG",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "-4 myip.opendns.com @resolver1.opendns.com",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -164,7 +184,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -199,7 +224,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -234,7 +268,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RETRIES",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 3,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -253,7 +296,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -279,7 +331,7 @@
|
||||
"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 Previous IP (not recommended)</li><li><code>Watched_Value2</code> unused</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>"
|
||||
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Previous IP (not recommended)</li><li><code>Watched_Value2</code> unused</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> type </li></ul>"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
@@ -289,7 +341,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": [
|
||||
"new",
|
||||
@@ -426,6 +487,22 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value4",
|
||||
"mapped_to_column": "cur_Type",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Type"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"column": "Dummy",
|
||||
"mapped_to_column": "cur_ScanMethod",
|
||||
|
||||
@@ -71,7 +71,7 @@ def main():
|
||||
watched1 = f'Previous IP: {PREV_IP}',
|
||||
watched2 = cmd_output.replace('\n',''),
|
||||
watched3 = retries_needed,
|
||||
watched4 = '',
|
||||
watched4 = 'Gateway',
|
||||
extra = f'Previous IP: {PREV_IP}',
|
||||
foreignKey = 'Internet')
|
||||
|
||||
|
||||
@@ -377,7 +377,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -408,7 +413,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/internet_speedtest/script.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -443,7 +457,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/30 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -478,7 +497,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 60,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -513,7 +541,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -549,7 +586,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [
|
||||
"new",
|
||||
|
||||
@@ -159,7 +159,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "UPDATE Devices SET dev_AlertDeviceDown = {KNWN_dev_AlertDeviceDown}, dev_AlertEvents = {KNWN_dev_AlertEvents} WHERE dev_MAC in ({target_macs})",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -178,7 +183,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Name",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "(unknown)",
|
||||
"options": [],
|
||||
@@ -198,7 +212,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Owner",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 30,
|
||||
"default_value": "House",
|
||||
"override_value": {
|
||||
@@ -221,7 +240,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_DeviceType",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 30,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -241,7 +265,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Vendor",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -261,7 +294,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Favorite",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"override_value": {
|
||||
"override": false
|
||||
@@ -283,7 +325,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Group",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 10,
|
||||
"default_value": "",
|
||||
"override_value": {
|
||||
@@ -306,7 +353,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Comments",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -325,7 +377,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_FirstConnection",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -345,7 +406,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastConnection",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -365,7 +435,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastIP",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -385,7 +464,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_StaticIP",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"override_value": {
|
||||
"override": true
|
||||
@@ -407,7 +495,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_ScanCycle",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"override_value": {
|
||||
"override": true
|
||||
@@ -429,7 +526,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LogEvents",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"override_value": {
|
||||
"override": false
|
||||
@@ -451,7 +557,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertEvents",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"override_value": {
|
||||
"override": true
|
||||
@@ -473,7 +588,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertDeviceDown",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -492,7 +616,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_SkipRepeated",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -511,7 +644,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastNotification",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -531,7 +673,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_PresentLastScan",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -550,7 +701,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_NewDevice",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": true,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -569,7 +729,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Location",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -589,7 +754,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Archived",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -608,7 +782,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_MAC_ADDR",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -627,7 +806,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_port",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -646,7 +834,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Icon",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -29,7 +29,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "schedule",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -62,7 +67,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/maintenance/maintenance.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -97,7 +111,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -132,7 +151,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -167,7 +195,16 @@
|
||||
},
|
||||
{
|
||||
"function": "LOG_LENGTH",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 250000,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
7
front/plugins/nbtscan_scan/README.md
Executable file
7
front/plugins/nbtscan_scan/README.md
Executable file
@@ -0,0 +1,7 @@
|
||||
## Overview
|
||||
|
||||
Plugin for device name discovery via the [nbtscan](https://linuxcommandlibrary.com/man/nbtscan) network utility supporting NetBIOS.
|
||||
|
||||
### Usage
|
||||
|
||||
- Check the Settings page for details.
|
||||
338
front/plugins/nbtscan_scan/config.json
Executable file
338
front/plugins/nbtscan_scan/config.json
Executable file
@@ -0,0 +1,338 @@
|
||||
{
|
||||
"code_name": "nbtscan_scan",
|
||||
"unique_prefix": "NBTSCAN",
|
||||
"plugin_type": "other",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"execution_order" : "Layer_3",
|
||||
"show_ui": true,
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"display_name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "NBTSCAN (Name discovery)"
|
||||
}
|
||||
],
|
||||
"icon": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "<i class=\"fa-solid fa-search\"></i>"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "A plugin to discover device names via NetBIOS."
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"name": "ips",
|
||||
"type": "sql",
|
||||
"value": "SELECT dev_LastIP from DEVICES order by dev_MAC",
|
||||
"timeoutMultiplier": true
|
||||
}
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
"before_name_updates",
|
||||
"on_new_device",
|
||||
"once",
|
||||
"schedule",
|
||||
"always_after_scan"
|
||||
],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "When to run"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Cuándo ejecutar"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Wann laufen"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "When the plugin should be executed. If enabled this will execute the scan until there are no <code>(unknown)</code> or <code>(name not found)</code> devices. Setting this to <code>on_new_device</code> or a daily <code>schedule</code> is recommended.<br/><br/> Depends on the <a onclick=\"toggleAllSettings()\" href=\"#SCAN_SUBNETS\"><code>SCAN_SUBNETS</code> setting</a>."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/nbtscan_scan/nbtscan.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Command"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Comando"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Befehl"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Command to run. This can not be changed"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Comando a ejecutar. Esto no se puede cambiar"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Befehl zum Ausführen. Dies kann nicht geändert werden"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/30 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Schedule"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Schedule"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Schedule"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#NBTSCAN_RUN\"><code>NBTSCAN_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."
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#NBTSCAN_RUN\"><code>NBTSCAN_RUN</code></a>. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide 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 a.m. en el <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ código> que configuró arriba</a>. Se ejecutará la PRÓXIMA vez que pase el tiempo."
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Nur aktiviert, wenn Sie <code>schedule</code> in der <a href=\"#NBTSCAN_RUN\"><code>NBTSCAN_RUN</code>-Einstellung</a> auswählen. Stellen Sie sicher, dass Sie den Zeitplan im richtigen Cron-ähnlichen Format eingeben (z. B. validieren unter <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Wenn Sie beispielsweise <code>0 4 * * *</code> eingeben, wird der Scan nach 4 Uhr morgens in der <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ ausgeführt. Code> den Sie oben festgelegt haben</a>. Wird das NÄCHSTE Mal ausgeführt, wenn die Zeit vergeht."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Run timeout"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Tiempo límite de ejecución"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Zeitüberschreitung"
|
||||
}
|
||||
],
|
||||
"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."
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Tiempo máximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela."
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen."
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"database_column_definitions": [
|
||||
{
|
||||
"column": "Object_PrimaryID",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "device_name_mac",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "MAC"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "MAC"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"column": "Object_SecondaryID",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "IP"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "IP"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value1",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Server"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value2",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Name"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Changed"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"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>"
|
||||
},
|
||||
{
|
||||
"equals": "missing-in-last-scan",
|
||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
|
||||
}
|
||||
],
|
||||
"localized": ["name"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Status"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
139
front/plugins/nbtscan_scan/nbtscan.py
Executable file
139
front/plugins/nbtscan_scan/nbtscan.py
Executable file
@@ -0,0 +1,139 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import json
|
||||
import sqlite3
|
||||
import subprocess
|
||||
|
||||
# Define the installation path and extend the system path for plugin imports
|
||||
INSTALL_PATH = "/app"
|
||||
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
||||
|
||||
from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
|
||||
from plugin_utils import get_plugins_configs
|
||||
from logger import mylog
|
||||
from const import pluginsPath, fullDbPath
|
||||
from helper import timeNowTZ, get_setting_value
|
||||
from notification import write_notification
|
||||
from database import DB
|
||||
from device import Device_obj
|
||||
|
||||
# Define the current path and log file paths
|
||||
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')
|
||||
|
||||
# Initialize the Plugin obj output file
|
||||
plugin_objects = Plugin_Objects(RESULT_FILE)
|
||||
|
||||
pluginName = 'NBTSCAN'
|
||||
|
||||
def main():
|
||||
mylog('verbose', [f'[{pluginName}] In script'])
|
||||
|
||||
# timeout = get_setting_value('NBLOOKUP_RUN_TIMEOUT')
|
||||
timeout = 20
|
||||
|
||||
# Create a database connection
|
||||
db = DB() # instance of class DB
|
||||
db.open()
|
||||
|
||||
# Initialize the Plugin obj output file
|
||||
plugin_objects = Plugin_Objects(RESULT_FILE)
|
||||
|
||||
# Create a Device_obj instance
|
||||
device_handler = Device_obj(db)
|
||||
|
||||
# Retrieve devices
|
||||
unknown_devices = device_handler.getUnknown()
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] Unknown devices count: {len(unknown_devices)}'])
|
||||
|
||||
# TEST
|
||||
# execute_name_lookup('192.168.1.121', timeout)
|
||||
|
||||
for device in unknown_devices:
|
||||
domain_name, dns_server = execute_name_lookup(device['dev_LastIP'], timeout)
|
||||
|
||||
if domain_name != '':
|
||||
plugin_objects.add_object(
|
||||
# "MAC", "IP", "Server", "Name"
|
||||
primaryId = device['dev_MAC'],
|
||||
secondaryId = device['dev_LastIP'],
|
||||
watched1 = dns_server,
|
||||
watched2 = domain_name,
|
||||
watched3 = '',
|
||||
watched4 = '',
|
||||
extra = '',
|
||||
foreignKey = device['dev_MAC'])
|
||||
|
||||
plugin_objects.write_result_file()
|
||||
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] Script finished'])
|
||||
|
||||
return 0
|
||||
|
||||
#===============================================================================
|
||||
# Execute scan
|
||||
#===============================================================================
|
||||
def execute_name_lookup (ip, timeout):
|
||||
"""
|
||||
Execute the NBLOOKUP command on IP.
|
||||
"""
|
||||
|
||||
args = ['nbtscan', ip]
|
||||
|
||||
# Execute command
|
||||
output = ""
|
||||
|
||||
try:
|
||||
# try runnning a subprocess with a forced (timeout) in case the subprocess hangs
|
||||
output = subprocess.check_output (args, universal_newlines=True, stderr=subprocess.STDOUT, timeout=(timeout), text=True)
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
|
||||
|
||||
domain_name = ''
|
||||
dns_server = ''
|
||||
|
||||
# Split the output into lines
|
||||
lines = output.splitlines()
|
||||
|
||||
# Look for the first line containing a valid NetBIOS name entry
|
||||
index = 0
|
||||
for line in lines:
|
||||
if 'Doing NBT name scan' not in line and ip in line:
|
||||
# Split the line and extract the primary NetBIOS name
|
||||
parts = line.split()
|
||||
if parts:
|
||||
domain_name = parts[1]
|
||||
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] Domain Name: {domain_name}'])
|
||||
|
||||
return domain_name, dns_server
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
# An error occurred, handle it
|
||||
# if "NXDOMAIN" in e.output:
|
||||
# mylog('verbose', [f'[{pluginName}]', f"No PTR record found for IP: {ip}"])
|
||||
# else:
|
||||
mylog('verbose', [f'[{pluginName}]', e.output])
|
||||
# Handle other errors here
|
||||
# mylog('verbose', [f'[{pluginName}] ⚠ ERROR - check logs'])
|
||||
|
||||
except subprocess.TimeoutExpired as timeErr:
|
||||
mylog('verbose', [f'[{pluginName}] TIMEOUT - the process forcefully terminated as timeout reached'])
|
||||
|
||||
if output == "": # check if the subprocess failed
|
||||
mylog('verbose', [f'[{pluginName}] Scan: FAIL - check logs'])
|
||||
else:
|
||||
mylog('verbose', [f'[{pluginName}] Scan: SUCCESS'])
|
||||
|
||||
return '', ''
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -28,7 +28,63 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "ignored_MACs",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -47,7 +103,63 @@
|
||||
},
|
||||
{
|
||||
"function": "ignored_IPs",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -64,9 +176,104 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "NAME_CLEANUP_REGEX",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-sm-3" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-sm-3" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-sm-2" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": ["base64"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [
|
||||
"XC5fYWlycGxheQ==",
|
||||
"XC5fdGNw",
|
||||
"XC5sb2NhbGRvbWFpbg==",
|
||||
"XC5sb2NhbA==",
|
||||
"XC5fZXNwaG9tZWxpYg==",
|
||||
"XC5fZ29vZ2xlY2FzdA==",
|
||||
"XC5sYW4=",
|
||||
"XC5ob21l",
|
||||
"LVthLWZBLUYwLTldezMyfQ==",
|
||||
"Iy4q"
|
||||
],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Name Cleanup REGEX"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "All the newly discovered device names are clened up by applying the following REGEX expression in this order. All the below are replaced by a blank string."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "dev_MAC",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -86,7 +293,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Name",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "(unknown)",
|
||||
"options": [],
|
||||
@@ -106,7 +322,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Owner",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 30,
|
||||
"default_value": "",
|
||||
"options": ["{value}"],
|
||||
@@ -133,7 +354,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_DeviceType",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 30,
|
||||
"default_value": "",
|
||||
"options": ["{value}"],
|
||||
@@ -165,7 +391,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Vendor",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -185,7 +420,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Favorite",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -204,7 +448,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Group",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 10,
|
||||
"default_value": "",
|
||||
"options": ["{value}"],
|
||||
@@ -231,7 +480,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Comments",
|
||||
"type": "string",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -250,7 +504,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_FirstConnection",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -270,7 +533,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastConnection",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -290,7 +562,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastIP",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -310,7 +591,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_StaticIP",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -329,7 +619,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_ScanCycle",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -348,7 +647,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LogEvents",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -367,7 +675,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertEvents",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -386,7 +703,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_AlertDeviceDown",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -405,7 +731,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_SkipRepeated",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": ["{value}"],
|
||||
"options_params": [
|
||||
@@ -431,7 +762,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_LastNotification",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": "date-time",
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -451,7 +791,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_PresentLastScan",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -470,7 +819,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_NewDevice",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 1,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -489,7 +847,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Location",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 250,
|
||||
"default_value": "",
|
||||
"options": ["{value}"],
|
||||
@@ -516,7 +879,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Archived",
|
||||
"type": "integer.checkbox",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -535,7 +907,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_MAC_ADDR",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": ["{value}"],
|
||||
"options_params": [
|
||||
@@ -566,7 +943,16 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Network_Node_port",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -585,7 +971,12 @@
|
||||
},
|
||||
{
|
||||
"function": "dev_Icon",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": ["{value}"],
|
||||
"options_params": [
|
||||
@@ -608,25 +999,6 @@
|
||||
"string": "The icon associated with the device. Check the <a href=\"https://github.com/jokob-sk/NetAlertX/blob/main/docs/ICONS.md\" target=\"_blank\">documentation on icons</a> for more details."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "LESS_NAME_CLEANUP",
|
||||
"type": "integer.checkbox",
|
||||
"default_value": 0,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Less Name Cleanup"
|
||||
}
|
||||
],
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Check to start using the new code for cleaning device names. Removes all labels starting with underscore and removes network domain and search list."
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"required": [
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "nmap_dev_scan",
|
||||
"unique_prefix": "NMAPDEV",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_3",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"mapped_to_table": "CurrentScan",
|
||||
@@ -45,7 +46,12 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -87,7 +93,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/nmap_dev_scan/nmap_dev.py ",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -122,7 +137,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 300,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -157,7 +181,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -192,7 +221,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -232,7 +270,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new"],
|
||||
"options": [
|
||||
"new",
|
||||
@@ -272,7 +319,12 @@
|
||||
},
|
||||
{
|
||||
"function": "ARGS",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "sudo nmap -sn -PR -oX - ",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -84,7 +84,7 @@ def execute_scan(subnets_list, timeout):
|
||||
for interface in subnets_list:
|
||||
nmap_output = execute_scan_on_interface(interface, timeout)
|
||||
|
||||
mylog('verbose', [f"[{pluginName}] nmap_output: ", nmap_output])
|
||||
# mylog('verbose', [f"[{pluginName}] nmap_output XML: ", nmap_output])
|
||||
|
||||
if nmap_output: # Proceed only if nmap output is not empty
|
||||
# Parse the XML output using python-nmap
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "nmap_scan",
|
||||
"unique_prefix": "NMAP",
|
||||
"plugin_type": "other",
|
||||
"execution_order" : "Layer_4",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"data_filters": [
|
||||
@@ -354,7 +355,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -387,7 +393,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/nmap_scan/script.py ips={ips} macs={macs} timeout={timeout} args={args}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -414,7 +425,12 @@
|
||||
},
|
||||
{
|
||||
"function": "ARGS",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "-p -10000",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -441,7 +457,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -468,7 +489,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -495,7 +525,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -527,7 +566,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": ["new", "watched-changed", "watched-not-changed"],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -29,7 +29,16 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "INCLUDED_SECTIONS",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new_devices", "down_devices", "events"],
|
||||
"options": [
|
||||
"new_devices",
|
||||
@@ -70,7 +79,16 @@
|
||||
},
|
||||
{
|
||||
"function": "alert_down_time",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 5,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -89,7 +107,12 @@
|
||||
},
|
||||
{
|
||||
"function": "new_dev_condition",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -108,7 +131,12 @@
|
||||
},
|
||||
{
|
||||
"function": "event_condition",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "nslookup_scan",
|
||||
"unique_prefix": "NSLOOKUP",
|
||||
"plugin_type": "other",
|
||||
"execution_order" : "Layer_4",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"show_ui": true,
|
||||
@@ -36,8 +37,13 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"default_value": "before_name_updates",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
"before_name_updates",
|
||||
@@ -70,7 +76,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/nslookup_scan/nslookup.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -105,7 +120,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/30 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -140,7 +160,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -1,18 +1,33 @@
|
||||
## Overview
|
||||
|
||||
PLugin functionality overview and links to external resources if relevant. Include use cases if available.
|
||||
The OMADA SDN plugin aims at synchronizing data between NetAlertX and a TPLINK OMADA SND controler by leveraging a tplink omada python library.
|
||||
#### features:
|
||||
1. extract list of OMADA Clients from OMADA and sync them up with NetAlertX
|
||||
2. extract list of OAMDA Devices (switches and access points) and sync them up with NetAlertX
|
||||
|
||||
> [!TIP]
|
||||
> Some tip.
|
||||
> some omada devices are apparently not fully compatible with the API which might lead to partial results.
|
||||
|
||||
### Quick setup guide
|
||||
|
||||
To set up the plugin correctly, make sure...
|
||||
1. You SHOULD (ie: strongly recommend) set up an account in your OMADA SDN console dedicated to NetAlertX OMADA_SDN plugin.
|
||||
- you should set USER TYPE = Local USer
|
||||
- you should set USER ROLE = Administrator (if you use a read-only role you won't be able to sync names from NetAlerX to OMADA SDN)
|
||||
- you can set Site Privileges = All Sites (or limit it to specific sites )
|
||||
|
||||
2. populate the variables in NetAlertX as instructed in the config plugin page.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Required Settings
|
||||
|
||||
- When to run `PREF_RUN`
|
||||
-
|
||||
- OMDSDN_url
|
||||
- OMDSDN_sites
|
||||
- OMDSDN_username
|
||||
- OMDSDN_password
|
||||
- OMDSDN_force_overwrite
|
||||
|
||||
|
||||
### Usage
|
||||
|
||||
@@ -20,4 +35,37 @@ To set up the plugin correctly, make sure...
|
||||
|
||||
### Notes
|
||||
|
||||
- Additional notes, limitations, Author info.
|
||||
#### features not implemented yet:
|
||||
3. extract list of OAMDA router Devices (er605...) and sync them up with NetAlertX
|
||||
(I need to setup my own er605 however due to its limitations I have no use for it, and due to limitations of opensense dhcp servers, I can't deploy it yet without breaking dhcp self registration into opnsense unbound - see below)
|
||||
|
||||
#### know limitations:
|
||||
OMADA SDN limitation fixed by the plugin:
|
||||
0. OMADA SDN can't use DNS for names and keep using MAC ref: https://community.tp-link.com/en/business/forum/topic/503782
|
||||
- when you use an OMADA user Role = Administrator, the plugin will attempt to fix OMADA's shortcoming and populat the NAME field from NetAlertX (from DNS/DHCP/...)
|
||||

|
||||
-
|
||||
|
||||
can not fix some of tplinks OMADA SDN own limitations/bugs:
|
||||
1. OMADA SDN switches uplinks/downlinks is broken if the default router is not an OMADA native device
|
||||
- (I try to circumvent that through a tree parsing heuristic but your mileage might vary...)
|
||||
- ref: https://community.tp-link.com/en/business/forum/topic/673628
|
||||
2. OMADA SDN clients are sometimes mapped to the wrong switch/port... for instance:
|
||||
- client -> access_switch1/port1 -> core_switch2/port2 sometimes shows as client -> core_switch2/port2
|
||||
- it is unclear if this issue is realted to (1)
|
||||
3. OMADA er605 routers do not self register DHCP names with a remote unbound DNS (nor embded DNS):
|
||||
- ref: https://community.tp-link.com/en/business/forum/topic/542472
|
||||
- it looks like some release candidate firmware might provide this feature... I will test when opnsesne Kea self registration get fixed as well(4)and I can get it dhcp proxy to work.
|
||||
4. Opnsense dhcp doesn't support relay and self-registration at the same time...
|
||||
- opnsense legacy ISC dhcp server doesn't support dhcp proxies: ref: https://forum.opnsense.org/index.php?topic=34254.0
|
||||
- opnsense new kea dhcp server doesn't support dns self registration (yet) ref: https://github.com/opnsense/core/pull/7362
|
||||
5. incompatible devices:
|
||||
- OMADA EAP245 - to be fair to tp-link, this access point works inside OMADA SDN, so it might be an issue with our omada python library but we can't extract data from it.
|
||||
|
||||
|
||||
|
||||
|
||||
### Other infos
|
||||
|
||||
- Author : Flying Toto
|
||||
- Date : 04-Jul-2024 - version 1.0
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "omada_sdn_imp",
|
||||
"unique_prefix": "OMDSDN",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_0",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"mapped_to_table": "CurrentScan",
|
||||
@@ -39,15 +40,15 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
"once",
|
||||
"schedule",
|
||||
"always_after_scan"
|
||||
],
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
{
|
||||
@@ -72,7 +73,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
@@ -100,7 +106,12 @@
|
||||
},
|
||||
{
|
||||
"function": "url",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -114,13 +125,69 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Enter full URL with protocol <code>https://CHANGEME_omada.mylocaldomain</code>."
|
||||
"string": "Enter full URL with protocol <code>https://CHANGEME_omada.mylocaldomain:PORT</code>."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "sites",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -133,13 +200,18 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Omada SDN site IDs. You can get it by..."
|
||||
"string": "Omada SDN site IDs. For now, we only process the first site listed since NetAlertX's other probes won't traverse across NAT and routers. But if needed please submit an issue in github with your specific use case for consideration: <code>https://github.com/jokob-sk/NetAlertX/issues </code> "
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "username",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -159,7 +231,16 @@
|
||||
},
|
||||
{
|
||||
"function": "password",
|
||||
"type": "password",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "password" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -173,13 +254,22 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Omada SDN instance password"
|
||||
"string": "Omada SDN instance password."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "force_overwrite",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -192,13 +282,22 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "The plugin synchronizes names from NetAlertX to OMADA. By default NetAlertX will only populate missing names in OMADASDN devices (i.e.: where the name is defaulting to the device MAC address); with this setting toggled, it will overwrite existing values regardless."
|
||||
"string": "The plugin synchronizes names from NetAlertX to OMADA Clients. By default NetAlertX will only populate missing names in OMADASDN devices (i.e.: where the name is defaulting to the device MAC address); with this setting toggled, it will overwrite existing values regardless."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/omada_sdn_imp/omada_sdn.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -233,7 +332,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -292,7 +400,16 @@
|
||||
"Watched_Value3",
|
||||
"Watched_Value4"
|
||||
],
|
||||
"type": "text.multiselect"
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": ["new", "watched-changed"],
|
||||
@@ -316,7 +433,16 @@
|
||||
"watched-not-changed",
|
||||
"missing-in-last-scan"
|
||||
],
|
||||
"type": "text.multiselect"
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"database_column_definitions": [
|
||||
@@ -434,7 +560,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Extra",
|
||||
"mapped_to_column": "cur_NetworkSite",
|
||||
"mapped_to_column": "cur_Type",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
|
||||
BIN
front/plugins/omada_sdn_imp/omada_account_sample.png
Executable file
BIN
front/plugins/omada_sdn_imp/omada_account_sample.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
@@ -1,12 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
__author__ = "ffsb"
|
||||
__version__ = "0.1" #initial
|
||||
__version__ = "0.2" # added logic to retry omada api call once as it seems to sometimes fail for some reasons, and error handling logic...
|
||||
__version__ = "0.3" # split devices API calls to allow multithreading but had to stop due to concurency issues.
|
||||
__version__ = "0.6" # found issue with multithreading - my omada calls redirect stdout which gets clubbered by normal stdout... not sure how to fix for now...
|
||||
# query OMADA SDN to populate NetAlertX witch omada switches, access points, clients.
|
||||
# try to identify and populate their connections by switch/accesspoints and ports/SSID
|
||||
# try to differentiate root bridges from accessory
|
||||
|
||||
|
||||
#
|
||||
# sample code to update unbound on opnsense - for reference...
|
||||
# curl -X POST -d '{"host":{"enabled":"1","hostname":"test","domain":"testdomain.com","rr":"A","mxprio":"","mx":"","server":"10.0.1.1","description":""}}' -H "Content-Type: application/json" -k -u $OPNS_KEY:$OPNS_SECRET https://$IPFW/api/unbound/settings/AddHostOverride
|
||||
#
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import json
|
||||
import sqlite3
|
||||
import tplink_omada_client
|
||||
import importlib.util
|
||||
import time
|
||||
import io
|
||||
import re
|
||||
import concurrent.futures
|
||||
|
||||
|
||||
#import netifaces
|
||||
|
||||
# Define the installation path and extend the system path for plugin imports
|
||||
INSTALL_PATH = "/app"
|
||||
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
||||
@@ -22,26 +43,168 @@ from notification import write_notification
|
||||
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')
|
||||
OMADA_API_RETURN_FILE = os.path.join(CUR_PATH, 'omada_api_return')
|
||||
|
||||
# Initialize the Plugin obj output file
|
||||
plugin_objects = Plugin_Objects(RESULT_FILE)
|
||||
#
|
||||
# sample target output:
|
||||
# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID, 5 TYPE
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', '17', '40-AE-30-A5-A7-50, 'Switch']"
|
||||
|
||||
# Constants for array indices
|
||||
MAC, IP, NAME, SWITCH_AP, PORT_SSID, TYPE = range(6)
|
||||
|
||||
# sample omada devices input format:
|
||||
#
|
||||
# 0.MAC 1.IP 2.type 3.status 4.name 5.model
|
||||
#40-AE-30-A5-A7-50 192.168.0.11 ap CONNECTED office_Access_point EAP773(US) v1.0
|
||||
#B0-95-75-46-0C-39 192.168.0.4 switch CONNECTED pantry12 T1600G-52PS v4.0
|
||||
dMAC, dIP, dTYPE, dSTATUS, dNAME, dMODEL = range(6)
|
||||
|
||||
# sample omada clients input format:
|
||||
# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID,
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', 'myssid_name2', '(office_Access_point)']"
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-01', '192.168.0.153', 'frontyard_ESP_29E753', 'pantry12', '(48)']"
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-02', '192.168.0.1', 'bastion', 'office24', '(23)']"
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-03', '192.168.0.226', 'brick', 'myssid_name3', '(office_Access_point)']"
|
||||
cMAC, cIP, cNAME, cSWITCH_AP, cPORT_SSID = range(5)
|
||||
|
||||
OMDLOGLEVEL = 'debug'
|
||||
pluginName = 'OMDSDN'
|
||||
#
|
||||
# translate MAC address from standard ieee model to ietf draft
|
||||
# AA-BB-CC-DD-EE-FF to aa:bb:cc:dd:ee:ff
|
||||
# tplink adheres to ieee, Nax adheres to ietf
|
||||
def ieee2ietf_mac_formater(inputmac):
|
||||
return(inputmac.lower().replace('-',':'))
|
||||
|
||||
def ietf2ieee_mac_formater(inputmac):
|
||||
return(inputmac.upper().replace(':','-'))
|
||||
|
||||
def get_mac_from_IP(target_IP):
|
||||
from scapy.all import ARP, Ether, srp
|
||||
try:
|
||||
arp_request = ARP(pdst=target_IP)
|
||||
ether = Ether(dst="ff:ff:ff:ff:ff:ff")
|
||||
packet = ether/arp_request
|
||||
result = srp(packet, timeout=3, verbose=0)[0]
|
||||
if result:
|
||||
return result[0][1].hwsrc
|
||||
else:
|
||||
return None
|
||||
except Exception as e:
|
||||
mylog('minimal', [f'[{pluginName}] get_mac_from_IP ERROR:{e}'])
|
||||
return None
|
||||
|
||||
|
||||
|
||||
#
|
||||
# wrapper to call the omada python library's own wrapper
|
||||
# it returns the output as a multiline python string
|
||||
#
|
||||
def callomada(myargs):
|
||||
arguments=" ".join(myargs)
|
||||
mylog('verbose', [f'[{pluginName}] callomada:{arguments}'])
|
||||
from tplink_omada_client.cli import main as omada
|
||||
from contextlib import redirect_stdout
|
||||
omada_output = ''
|
||||
retries = 2
|
||||
while omada_output == '' and retries > 1:
|
||||
retries = retries - 1
|
||||
try:
|
||||
mf = io.StringIO()
|
||||
with redirect_stdout(mf):
|
||||
bar = omada(myargs)
|
||||
omada_output = mf.getvalue()
|
||||
except Exception as e:
|
||||
mylog('minimal', [f'[{pluginName}] ERROR WHILE CALLING callomada:{arguments}\n {mf}'])
|
||||
omada_output= ''
|
||||
return(omada_output)
|
||||
|
||||
#
|
||||
# extract all the mac addresses from a multilines text...
|
||||
# return a list of MAC as 'string'
|
||||
#
|
||||
def extract_mac_addresses(text):
|
||||
mac_pattern = r"([0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2})"
|
||||
mac_addresses = re.findall(mac_pattern, text)
|
||||
return ["".join(parts) for parts in mac_addresses]
|
||||
|
||||
def find_default_gateway_ip ():
|
||||
#import netifaces
|
||||
#gw = netifaces.gateways()
|
||||
#return(gw['default'][netifaces.AF_INET][0])
|
||||
from scapy.all import conf, Route, sr1, IP, ICMP
|
||||
default_route = conf.route.route("0.0.0.0")
|
||||
return default_route[2] if default_route[2] else None
|
||||
|
||||
|
||||
#return('192.168.0.1')
|
||||
|
||||
|
||||
def add_uplink (uplink_mac, switch_mac, device_data_bymac, sadevices_linksbymac,port_byswitchmac_byclientmac):
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}] trying to add uplink="{uplink_mac}" to switch="{switch_mac}"'])
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}] before adding:"{device_data_bymac[switch_mac]}"'])
|
||||
if device_data_bymac[switch_mac][SWITCH_AP] == 'null':
|
||||
device_data_bymac[switch_mac][SWITCH_AP] = uplink_mac
|
||||
if device_data_bymac[switch_mac][TYPE] == 'Switch' and device_data_bymac[uplink_mac][TYPE] == 'Switch':
|
||||
port_to_uplink = port_byswitchmac_byclientmac[switch_mac][uplink_mac]
|
||||
#find_port_of_uplink_switch(switch_mac, uplink_mac)
|
||||
else:
|
||||
port_to_uplink=device_data_bymac[uplink_mac][PORT_SSID]
|
||||
device_data_bymac[switch_mac][PORT_SSID] = port_to_uplink
|
||||
# mylog(OMDLOGLEVEL, [f'[{pluginName}] after adding:"{device_data_bymac[switch_mac]}"'])
|
||||
for link in sadevices_linksbymac[switch_mac]:
|
||||
if device_data_bymac[link][SWITCH_AP] == 'null' and device_data_bymac[switch_mac][TYPE] == 'Switch':
|
||||
add_uplink(switch_mac, link, device_data_bymac, sadevices_linksbymac,port_byswitchmac_byclientmac)
|
||||
|
||||
|
||||
pluginName = '<unique_prefix>'
|
||||
|
||||
# ----------------------------------------------
|
||||
# Main initialization
|
||||
def main():
|
||||
mylog('verbose', [f'[{pluginName}] In script'])
|
||||
|
||||
start_time = time.time()
|
||||
mylog('verbose', [f'[{pluginName}] starting execution'])
|
||||
from database import DB
|
||||
from device import Device_obj
|
||||
db = DB() # instance of class DB
|
||||
db.open()
|
||||
# Create a Device_obj instance
|
||||
device_handler = Device_obj(db)
|
||||
# Retrieve configuration settings
|
||||
some_setting = get_setting_value('OMDSDN_url')
|
||||
# these should be self-explanatory
|
||||
omada_sites = []
|
||||
omada_username = get_setting_value('OMDSDN_username')
|
||||
omada_password = get_setting_value('OMDSDN_password')
|
||||
omada_sites = get_setting_value('OMDSDN_sites')
|
||||
omada_site = omada_sites[0]
|
||||
omada_url = get_setting_value('OMDSDN_url')
|
||||
|
||||
omada_login = callomada(['-t','myomada','target','--url',omada_url,'--user',omada_username,
|
||||
'--password',omada_password,'--site',omada_site,'--set-default'])
|
||||
mylog('verbose', [f'[{pluginName}] login to omada result is: {omada_login}'])
|
||||
|
||||
clients_list = callomada(['-t','myomada','clients'])
|
||||
mylog('verbose', [f'[{pluginName}] clients found:"{clients_list.count("\n")}"\n{clients_list}'])
|
||||
|
||||
switches_and_aps = callomada(['-t','myomada','devices'])
|
||||
mylog('verbose', [f'[{pluginName}] omada devices (switches, access points) found:"{switches_and_aps.count("\n")}" \n {switches_and_aps}'])
|
||||
|
||||
|
||||
#some_setting = get_setting_value('OMDSDN_url')
|
||||
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}] some_setting value {some_setting}'])
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] ffsb'])
|
||||
|
||||
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] some_setting calue {some_setting}'])
|
||||
|
||||
# retrieve data
|
||||
device_data = get_device_data(some_setting)
|
||||
device_data = get_device_data(clients_list, switches_and_aps, device_handler)
|
||||
|
||||
# Process the data into native application tables
|
||||
mylog('verbose', [f'[{pluginName}] New entries to create: "{len(device_data)}"'])
|
||||
if len(device_data) > 0:
|
||||
|
||||
# insert devices into the lats_result.log
|
||||
@@ -50,36 +213,238 @@ def main():
|
||||
# {
|
||||
# "column": "Object_PrimaryID", <--------- the value I save into primaryId
|
||||
# "mapped_to_column": "cur_MAC", <--------- gets unserted into the CurrentScan DB table column cur_MAC
|
||||
#
|
||||
for device in device_data:
|
||||
plugin_objects.add_object(
|
||||
primaryId = device['some_id'], # MAC
|
||||
secondaryId = device['some_id'], # IP
|
||||
watched1 = device['some_id'], # NAME/HOSTNAME
|
||||
watched2 = device['some_id'], # PARENT NETWORK NODE MAC
|
||||
watched3 = device['some_id'], # PORT
|
||||
watched4 = device['some_id'], # SSID
|
||||
extra = device['some_id'], # SITENAME (cur_NetworkSite) or VENDOR (cur_Vendor) (PICK one and adjust config.json -> "column": "Extra")
|
||||
foreignKey = device['some_id']) # usually MAC
|
||||
# watched1 = 'null' ,
|
||||
# figure a way to run my udpate script delayed
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] New entries: "{len(new_devices)}"'])
|
||||
for device in device_data:
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] main parsing device: "{device}"'])
|
||||
myport = device[PORT_SSID] if device[PORT_SSID].isdigit() else ''
|
||||
myssid = device[PORT_SSID] if not device[PORT_SSID].isdigit() else ''
|
||||
ParentNetworkNode = ieee2ietf_mac_formater(device[SWITCH_AP]) if device[SWITCH_AP] != 'Internet' else 'Internet'
|
||||
mymac = ieee2ietf_mac_formater(device[MAC])
|
||||
plugin_objects.add_object(
|
||||
primaryId = mymac, # MAC
|
||||
secondaryId = device[IP], # IP
|
||||
watched1 = device[NAME], # NAME/HOSTNAME
|
||||
watched2 = ParentNetworkNode, # PARENT NETWORK NODE MAC
|
||||
watched3 = myport, # PORT
|
||||
watched4 = myssid, # SSID
|
||||
extra = device[TYPE],
|
||||
#omada_site, # SITENAME (cur_NetworkSite) or VENDOR (cur_Vendor) (PICK one and adjust config.json -> "column": "Extra")
|
||||
foreignKey = device[MAC].lower().replace('-',':')) # usually MAC
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] New entries: "{mymac:<18}, {device[IP]:<16}, {device[NAME]:<63}, {ParentNetworkNode:<18}, {myport:<4}, {myssid:<32}, {device[TYPE]}"'])
|
||||
mylog('verbose', [f'[{pluginName}] New entries: "{len(device_data)}"'])
|
||||
|
||||
# log result
|
||||
plugin_objects.write_result_file()
|
||||
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}] TEST name from MAC: {device_handler.getValueWithMac('dev_Name','00:e2:59:00:a0:8e')}'])
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}] TEST MAC from IP: {get_mac_from_IP('192.168.0.1')} also {ietf2ieee_mac_formater(get_mac_from_IP('192.168.0.1'))}'])
|
||||
end_time = time.time()
|
||||
mylog('verbose', [f'[{pluginName}] execution completed in {end_time - start_time:.2f} seconds'])
|
||||
|
||||
|
||||
return 0
|
||||
|
||||
def get_omada_devices_details(msadevice_data):
|
||||
mthisswitch = msadevice_data[dMAC]
|
||||
mtype = msadevice_data[dTYPE]
|
||||
mswitch_detail = ''
|
||||
mswitch_dump = ''
|
||||
if mtype == 'ap':
|
||||
mswitch_detail = callomada(['access-point', mthisswitch])
|
||||
elif mtype == 'switch':
|
||||
mswitch_detail = callomada(['switch', mthisswitch])
|
||||
mswitch_dump = callomada(['-t','myomada','switch','-d',mthisswitch])
|
||||
else:
|
||||
mswitch_detail = ''
|
||||
nswitch_dump = ''
|
||||
return mswitch_detail, mswitch_dump
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------
|
||||
# retrieve data
|
||||
def get_device_data(some_setting):
|
||||
def get_device_data(omada_clients_output,switches_and_aps,device_handler):
|
||||
|
||||
device_data = []
|
||||
|
||||
# sample omada devices input format:
|
||||
# 0.MAC 1.IP 2.type 3.status 4.name 5.model
|
||||
#40-AE-30-A5-A7-50 192.168.0.11 ap CONNECTED office_Access_point EAP773(US) v1.0
|
||||
#B0-95-75-46-0C-39 192.168.0.4 switch CONNECTED pantry12 T1600G-52PS v4.0
|
||||
#
|
||||
# sample target output:
|
||||
# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID, 5 TYPE
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', '17', '40-AE-30-A5-A7-50, 'Switch']"
|
||||
#constants
|
||||
sadevices_macbyname = {}
|
||||
sadevices_macbymac = {}
|
||||
sadevices_linksbymac = {}
|
||||
port_byswitchmac_byclientmac = {}
|
||||
device_data_bymac = {}
|
||||
device_data_mac_byip = {}
|
||||
omada_force_overwrite = get_setting_value('OMDSDN_force_overwrite')
|
||||
switch_details = {}
|
||||
switch_dumps = {}
|
||||
|
||||
sadevices = switches_and_aps.splitlines()
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] switches_and_aps rows: "{len(sadevices)}"'])
|
||||
|
||||
for sadevice in sadevices:
|
||||
sadevice_data = sadevice.split()
|
||||
thisswitch = sadevice_data[dMAC]
|
||||
thistype = sadevice_data[dTYPE]
|
||||
switch_details[thisswitch], switch_dumps[thisswitch] = get_omada_devices_details(sadevice_data)
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] switches details collected "{len(switch_details)}"'])
|
||||
mylog('verbose', [f'[{pluginName}] dump details collected "{len(switch_details)}"'])
|
||||
# Using ThreadPoolExecutor for parallel execution
|
||||
|
||||
for sadevice in sadevices:
|
||||
sadevice_data = sadevice.split()
|
||||
thisswitch = sadevice_data[dMAC]
|
||||
sadevices_macbyname[sadevice_data[4]] = thisswitch
|
||||
if sadevice_data[dTYPE] == 'ap':
|
||||
sadevice_type = 'AP'
|
||||
#sadevice_details = callomada(['access-point', thisswitch])
|
||||
sadevice_details = switch_details[thisswitch]
|
||||
if sadevice_details == '':
|
||||
sadevice_links = [thisswitch]
|
||||
else:
|
||||
sadevice_links = extract_mac_addresses(sadevice_details)
|
||||
sadevices_linksbymac[thisswitch] = sadevice_links[1:]
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch details: "{sadevice_details}"'])
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}]links are: "{sadevice_links}"'])
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}]linksbymac are: "{sadevices_linksbymac[thisswitch]}"'])
|
||||
elif sadevice_data[dTYPE] == 'switch':
|
||||
sadevice_type = 'Switch'
|
||||
#sadevice_details=callomada(['switch', thisswitch])
|
||||
sadevice_details = switch_details[thisswitch]
|
||||
if sadevice_details == '':
|
||||
sadevice_links = [thisswitch]
|
||||
else:
|
||||
sadevice_links=extract_mac_addresses(sadevice_details)
|
||||
sadevices_linksbymac[thisswitch] = sadevice_links[1:]
|
||||
# recovering the list of switches connected to sadevice switch and on which port...
|
||||
#switchdump = callomada(['-t','myomada','switch','-d',thisswitch])
|
||||
switchdump = switch_dumps[thisswitch]
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] switchdump: {switchdump}'])
|
||||
port_byswitchmac_byclientmac[thisswitch] = {}
|
||||
for link in sadevices_linksbymac[thisswitch]:
|
||||
port_pattern = r"(?:{[^}]*\"port\"\: )([0-9]+)(?=[^}]*"+re.escape(link)+r")"
|
||||
myport = re.findall(port_pattern, switchdump,re.DOTALL)
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}] switchdump: link={link} myport:{myport}'])
|
||||
port_byswitchmac_byclientmac[thisswitch][link] = myport[0] if myport else ''
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}]links are: "{sadevice_links}"'])
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}]linksbymac are: "{sadevices_linksbymac[thisswitch]}"'])
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}]ports of each links are: "{port_byswitchmac_byclientmac[thisswitch]}"'])
|
||||
#mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch details: "{sadevice_details}"'])
|
||||
else:
|
||||
sadevice_type = 'null'
|
||||
sadevice_details='null'
|
||||
device_data_bymac[thisswitch] = [thisswitch, sadevice_data[dIP], sadevice_data[dNAME], 'null', 'null',sadevice_type]
|
||||
device_data_mac_byip[sadevice_data[dIP]] = thisswitch
|
||||
foo=[thisswitch, sadevice_data[1], sadevice_data[4], 'null', 'null']
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}]adding switch: "{foo}"'])
|
||||
|
||||
|
||||
|
||||
|
||||
# sadevices_macbymac[thisswitch] = thisswitch
|
||||
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] switch_macbyname: "{sadevices_macbyname}"'])
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] switches: "{device_data_bymac}"'])
|
||||
|
||||
|
||||
# do some processing, call exteranl APIs, and return a device list
|
||||
# ...
|
||||
#
|
||||
# sample omada clients input format:
|
||||
# 0 MAC, 1 IP, 2 Name, 3 switch/AP, 4 port/SSID,
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', '1A-2B-3C-4D-5E-6F', 'myssid_name2', '(office_Access_point)']"
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-01', '192.168.0.153', 'frontyard_ESP_29E753', 'pantry12', '(48)']"
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-02', '192.168.0.1', 'bastion', 'office24', '(23)']"
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-03', '192.168.0.226', 'brick', 'myssid_name3', '(office_Access_point)']"
|
||||
|
||||
# sample target output:
|
||||
# 0 MAC, 1 IP, 2 Name, 3 MAC of switch/AP, 4 port/SSID, 5 TYPE
|
||||
#17:27:10 [<unique_prefix>] token: "['1A-2B-3C-4D-5E-6F', '192.168.0.217', 'brick', 'office_Access_point','myssid_name2', , 'Switch']"
|
||||
|
||||
return device_data
|
||||
odevices = omada_clients_output.splitlines()
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] omada_clients_outputs rows: "{len(odevices)}"'])
|
||||
for odevice in odevices:
|
||||
odevice_data = odevice.split()
|
||||
odevice_data_reordered = [ MAC, IP, NAME, SWITCH_AP, PORT_SSID, TYPE]
|
||||
odevice_data_reordered[MAC]=odevice_data[cMAC]
|
||||
odevice_data_reordered[IP]=odevice_data[cIP]
|
||||
real_naxname = device_handler.getValueWithMac('dev_Name',ieee2ietf_mac_formater(odevice_data[cMAC]))
|
||||
|
||||
#
|
||||
# if the name stored in Nax for a device is empty or the MAC addres or has some parenthhesis or is the same as in omada
|
||||
# don't bother updating omada's name at all.
|
||||
#
|
||||
|
||||
naxname = real_naxname
|
||||
if real_naxname != None:
|
||||
if '(' in real_naxname:
|
||||
# removing parenthesis and domains from the name
|
||||
naxname = real_naxname.split('(')[0]
|
||||
if naxname != None and '.' in naxname:
|
||||
naxname = naxname.split('.')[0]
|
||||
if naxname in ( None, 'null', '' ):
|
||||
naxname = odevice_data[cNAME] if odevice_data[cNAME] != '' else odevice_data[cMAC]
|
||||
naxname = naxname.strip()
|
||||
mylog('debug', [f'[{pluginName}] TEST name from MAC: {naxname}'])
|
||||
if odevice_data[cNAME] in (odevice_data[cMAC], 'null', ''):
|
||||
mylog('verbose', [f'[{pluginName}] updating omada server because odevice_data is: {odevice_data[cNAME]} and naxname is: "{naxname}"'])
|
||||
callomada(['set-client-name', odevice_data[cMAC], naxname])
|
||||
odevice_data_reordered[NAME] = naxname
|
||||
else:
|
||||
if omada_force_overwrite and naxname != odevice_data[cNAME] :
|
||||
mylog('verbose', [f'[{pluginName}] updating omada server because odevice_data is: "{odevice_data[cNAME]} and naxname is: "{naxname}"'])
|
||||
callomada(['set-client-name', odevice_data[cMAC], naxname])
|
||||
odevice_data_reordered[NAME] = naxname
|
||||
mightbeport = odevice_data[cPORT_SSID].lstrip('(')
|
||||
mightbeport = mightbeport.rstrip(')')
|
||||
if mightbeport.isdigit():
|
||||
odevice_data_reordered[SWITCH_AP] = odevice_data[cSWITCH_AP]
|
||||
odevice_data_reordered[PORT_SSID] = mightbeport
|
||||
else:
|
||||
odevice_data_reordered[SWITCH_AP] = mightbeport
|
||||
odevice_data_reordered[PORT_SSID] = odevice_data[cSWITCH_AP]
|
||||
|
||||
# replacing the switch name with its MAC...
|
||||
try:
|
||||
mightbemac = sadevices_macbyname[odevice_data_reordered[SWITCH_AP]]
|
||||
odevice_data_reordered[SWITCH_AP] = mightbemac
|
||||
except KeyError:
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] could not find the mac adddress for: "{odevice_data_reordered[SWITCH_AP]}"'])
|
||||
# adding the type
|
||||
odevice_data_reordered[TYPE] = 'null'
|
||||
device_data_bymac[odevice_data_reordered[MAC]] = odevice_data_reordered
|
||||
device_data_mac_byip[odevice_data_reordered[IP]] = odevice_data_reordered[MAC]
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] tokens: "{odevice_data}"'])
|
||||
mylog(OMDLOGLEVEL, [f'[{pluginName}] tokens_reordered: "{odevice_data_reordered}"'])
|
||||
# populating the uplinks nodes of the omada switches and access points manually
|
||||
# since OMADA SDN makes is unreliable if the gateway is not their own tplink hardware...
|
||||
|
||||
|
||||
# step1 let's find the the default router
|
||||
#
|
||||
default_router_ip = find_default_gateway_ip()
|
||||
default_router_mac = ietf2ieee_mac_formater(get_mac_from_IP(default_router_ip))
|
||||
device_data_bymac[default_router_mac][TYPE] = 'Firewall'
|
||||
# step2 let's find the first switch and set the default router parent to internet
|
||||
first_switch=device_data_bymac[default_router_mac][SWITCH_AP]
|
||||
device_data_bymac[default_router_mac][SWITCH_AP] = 'Internet'
|
||||
# step3 let's set the switch connected to the default gateway uplink to the default gateway and hardcode port to 1 for now:
|
||||
#device_data_bymac[first_switch][SWITCH_AP]=default_router_mac
|
||||
#device_data_bymac[first_switch][SWITCH_AP][PORT_SSID] = '1'
|
||||
# step4, let's go recursively through switches other links to mark update their uplinks
|
||||
# and pray it ends one day...
|
||||
#
|
||||
add_uplink(default_router_mac,first_switch, device_data_bymac,sadevices_linksbymac,port_byswitchmac_byclientmac)
|
||||
return device_data_bymac.values()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -62,8 +62,13 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "RUN",
|
||||
"type": "text.select",
|
||||
"default_value": "on_new_device",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
"once",
|
||||
@@ -96,7 +101,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/pholus_scan/script.py userSubnets={subnets} timeoutSec={timeout}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -123,7 +137,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 300,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -150,7 +173,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "30 3 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -177,7 +205,16 @@
|
||||
},
|
||||
{
|
||||
"function": "DAYS_DATA",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -204,7 +241,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1", "Watched_Value2"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -236,7 +282,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new"],
|
||||
"options": [
|
||||
"new",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "pihole_scan",
|
||||
"unique_prefix": "PIHOLE",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_2",
|
||||
"enabled": true,
|
||||
"data_source": "sqlite-db-query",
|
||||
"mapped_to_table": "CurrentScan",
|
||||
@@ -60,7 +61,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -93,7 +99,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "SELECT n.hwaddr AS Object_PrimaryID, {s-quote}null{s-quote} AS Object_SecondaryID, datetime() AS DateTime, na.ip AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, {s-quote}null{s-quote} AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr is not {s-quote}00:00:00:00:00:00{s-quote} AND na.ip is not null",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -120,7 +131,12 @@
|
||||
},
|
||||
{
|
||||
"function": "DB_PATH",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "/etc/pihole/pihole-FTL.db",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -147,7 +163,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/30 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -164,17 +185,26 @@
|
||||
"description": [
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#ARPSCAN_RUN\"><code>ARPSCAN_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>*/30 * * * *</code> will run the scan every 30 minutes. Will be run NEXT time the time passes. <br/> It's recommended to use the same schedule interval for all plugins responsible for discovering new devices."
|
||||
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#PIHOLE_RUN\"><code>PIHOLE_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>*/30 * * * *</code> will run the scan every 30 minutes. Will be run NEXT time the time passes. <br/> It's recommended to use the same schedule interval for all plugins responsible for discovering new devices."
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#ARPSCAN_RUN\"><code>ARPSCAN_RUN</code></a>. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingresar <code>*/30 * * * *</code> ejecutará el escaneo cada 30 minutos. Se ejecutará la PRÓXIMA vez que pase el tiempo. <br/> Se recomienda utilizar el mismo intervalo de programación para todos los complementos que analizan su red."
|
||||
"string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#PIHOLE_RUN\"><code>PIHOLE_RUN</code></a>. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingresar <code>*/30 * * * *</code> ejecutará el escaneo cada 30 minutos. Se ejecutará la PRÓXIMA vez que pase el tiempo. <br/> Se recomienda utilizar el mismo intervalo de programación para todos los complementos que analizan su red."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1", "Watched_Value2"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -206,7 +236,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new"],
|
||||
"options": [
|
||||
"new",
|
||||
|
||||
@@ -79,6 +79,22 @@ def decodeBase64(inputParamBase64):
|
||||
|
||||
return result
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
def normalize_mac(mac):
|
||||
# Split the MAC address by colon (:) or hyphen (-) and convert each part to uppercase
|
||||
parts = mac.upper().split(':')
|
||||
|
||||
# If the MAC address is split by hyphen instead of colon
|
||||
if len(parts) == 1:
|
||||
parts = mac.upper().split('-')
|
||||
|
||||
# Normalize each part to have exactly two hexadecimal digits
|
||||
normalized_parts = [part.zfill(2) for part in parts]
|
||||
|
||||
# Join the parts with colon (:)
|
||||
normalized_mac = ':'.join(normalized_parts)
|
||||
|
||||
return normalized_mac
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
class Plugin_Object:
|
||||
|
||||
@@ -47,7 +47,16 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "enable_password",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -66,7 +75,16 @@
|
||||
},
|
||||
{
|
||||
"function": "password",
|
||||
"type": "password.SHA256",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "password" }],
|
||||
"transformers": ["sha256"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "123456",
|
||||
"options": [],
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
## 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.
|
||||
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 NetAlertX:
|
||||
|
||||
- `SNMPDSC_routers` - A list of `snmpwalk` commands to execute against IP addresses of roputers/switches with SNMP turned on. For example:
|
||||
- `SNMPDSC_routers` - A list of `snmpwalk` commands to execute against IP addresses of routers/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`)
|
||||
|
||||
|
||||
If unsure, please check [snmpwalk examples](https://www.comparitech.com/net-admin/snmpwalk-examples-windows-linux/).
|
||||
|
||||
### Setup Cisco IOS
|
||||
|
||||
Enable IOS SNMP service and restrict to selected (internal) IP/Subnet.
|
||||
@@ -35,5 +37,24 @@ 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 "`.
|
||||
- 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 formats:
|
||||
|
||||
- `iso.3.6.1.2.1.3.1.1.2.3.1.192.168.1.2 "6C 6C 6C 6C 6C 6C "`.
|
||||
- `ipNetToMediaPhysAddress[3][192.168.1.9] 6C:6C:6C:6C:6C:b6C1`.
|
||||
|
||||
|
||||
### Finding your OID
|
||||
|
||||
- Ssh into the router (in this example the IP of the router is `192.168.1.1`)
|
||||
- On the router execute `snmptranslate -On -IR ipNetToMediaPhysAddress` (This is a UniFi router example, and the `object_id` is `ipNetToMediaPhysAddress`. This might vary between vendors, google your router manufacturer examples.)
|
||||
|
||||
```bash
|
||||
jokob@SecurityGateway-USG:~$ snmptranslate -On -IR ipNetToMediaPhysAddress
|
||||
.1.3.6.1.2.1.4.22.1.2
|
||||
```
|
||||
|
||||
- Use the `snmpwalk -v 2c -OXsq -c public 192.168.1.1 .1.3.6.1.2.1.4.22.1.2` command in NetAlertX
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"code_name": "snmp_discovery",
|
||||
"unique_prefix": "SNMPDSC",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_1",
|
||||
"enabled": true,
|
||||
"data_source": "script",
|
||||
"data_filters": [
|
||||
@@ -339,7 +340,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -372,7 +378,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/snmp_discovery/script.py routers={s-quote}{routers}{s-quote}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -399,7 +410,63 @@
|
||||
},
|
||||
{
|
||||
"function": "routers",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [
|
||||
"snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2"
|
||||
],
|
||||
@@ -428,7 +495,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -455,7 +527,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 5,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -486,7 +567,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -518,7 +608,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": [
|
||||
"new",
|
||||
|
||||
@@ -11,7 +11,7 @@ import sys
|
||||
INSTALL_PATH="/app"
|
||||
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
||||
|
||||
from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64, handleEmpty
|
||||
from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64, handleEmpty, normalize_mac
|
||||
from logger import mylog
|
||||
from helper import timeNowTZ
|
||||
from const import logPath, applicationPath
|
||||
@@ -25,7 +25,7 @@ def main():
|
||||
mylog('verbose', ['[SNMPDSC] In script '])
|
||||
|
||||
# init global variables
|
||||
global ROUTERS
|
||||
global snmpWalkCmds
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='This plugin is used to discover devices via the arp table(s) of a RFC1213 compliant router or switch.')
|
||||
@@ -35,18 +35,20 @@ def main():
|
||||
plugin_objects = Plugin_Objects(RESULT_FILE)
|
||||
|
||||
if values.routers:
|
||||
ROUTERS = values.routers.split('=')[1].replace('\'','')
|
||||
snmpWalkCmds = values.routers.split('=')[1].replace('\'','')
|
||||
|
||||
|
||||
if ',' in ROUTERS:
|
||||
routers = ROUTERS.split(',')
|
||||
if ',' in snmpWalkCmds:
|
||||
commands = snmpWalkCmds.split(',')
|
||||
else:
|
||||
routers = [ROUTERS]
|
||||
commands = [snmpWalkCmds]
|
||||
|
||||
for router in routers:
|
||||
mylog('verbose', ['[SNMPDSC] Router snmpwalk command: ', router])
|
||||
for cmd in commands:
|
||||
mylog('verbose', ['[SNMPDSC] Router snmpwalk command: ', cmd])
|
||||
timeoutSec = 10
|
||||
snmpwalkArgs = router.split(' ')
|
||||
# split the string, remove white spaces around each item, and exclude any empty strings
|
||||
snmpwalkArgs = [arg.strip() for arg in cmd.split(' ') if arg.strip()]
|
||||
|
||||
|
||||
# Execute N probes and insert in list
|
||||
probes = 1 # N probes
|
||||
@@ -60,11 +62,9 @@ def main():
|
||||
|
||||
for line in lines:
|
||||
|
||||
tmpSplt = line.split('"')
|
||||
|
||||
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
|
||||
@@ -86,6 +86,26 @@ def main():
|
||||
else:
|
||||
mylog('verbose', [f'[SNMPDSC] ipStr does not seem to contain a valid IP:', ipStr])
|
||||
|
||||
|
||||
elif line.startswith('ipNetToMediaPhysAddress'):
|
||||
# Format: snmpwalk -OXsq output
|
||||
parts = line.split()
|
||||
if len(parts) == 2:
|
||||
|
||||
ipAddress = parts[0].split('[')[-1][:-1]
|
||||
macAddress = normalize_mac(parts[1])
|
||||
|
||||
mylog('verbose', [f'[SNMPDSC] IP: {ipAddress} MAC: {macAddress}'])
|
||||
|
||||
plugin_objects.add_object(
|
||||
primaryId = handleEmpty(macAddress),
|
||||
secondaryId = handleEmpty(ipAddress.strip()),
|
||||
watched1 = '(unknown)',
|
||||
watched2 = handleEmpty(snmpwalkArgs[6]),
|
||||
extra = handleEmpty(line),
|
||||
foreignKey = handleEmpty(macAddress)
|
||||
)
|
||||
|
||||
mylog('verbose', ['[SNMPDSC] Entries found: ', len(plugin_objects)])
|
||||
|
||||
plugin_objects.write_result_file()
|
||||
|
||||
@@ -39,7 +39,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
@@ -74,7 +79,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
@@ -102,7 +112,12 @@
|
||||
},
|
||||
{
|
||||
"function": "api_token",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -122,7 +137,12 @@
|
||||
},
|
||||
{
|
||||
"function": "encryption_key",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -142,7 +162,12 @@
|
||||
},
|
||||
{
|
||||
"function": "hub_url",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
@@ -163,7 +188,12 @@
|
||||
},
|
||||
{
|
||||
"function": "node_name",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": "",
|
||||
"options": [],
|
||||
@@ -183,7 +213,16 @@
|
||||
},
|
||||
{
|
||||
"function": "devices",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -202,7 +241,16 @@
|
||||
},
|
||||
{
|
||||
"function": "plugins",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": [],
|
||||
"options": ["{value}"],
|
||||
@@ -229,7 +277,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/sync/sync.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -264,7 +321,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 30,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -376,14 +442,6 @@
|
||||
{
|
||||
"language_code": "en_us",
|
||||
"string": "Vendor"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string": "Proveedor"
|
||||
},
|
||||
{
|
||||
"language_code": "de_de",
|
||||
"string": "Hersteller"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -28,7 +28,16 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "shown_cards",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxLength": 50,
|
||||
"default_value": [
|
||||
"my_devices",
|
||||
@@ -64,7 +73,16 @@
|
||||
},
|
||||
{
|
||||
"function": "hide_empty",
|
||||
"type": "boolean",
|
||||
"type": {
|
||||
"dataType": "boolean",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "checkbox" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": false,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -25,3 +25,6 @@ Allowing Un-Discoverable devices like hubs, switches or APs to be added to the n
|
||||
### Known Limitations
|
||||
- Un-Discoverable Devices always show as offline. That is expected as they can not be discovered by NetAlertX.
|
||||
- All IPs are set to 0.0.0.0 therefore the "Random MAC" icon might show up.
|
||||
|
||||
Made with ❤ by [@Data-Monkey](https://github.com/Data-Monkey) 🙏
|
||||
|
||||
|
||||
@@ -60,7 +60,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -95,7 +100,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/undiscoverables/script.py devices={devices}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -130,7 +140,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -165,7 +184,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -200,7 +228,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": [],
|
||||
"options": [
|
||||
"new",
|
||||
@@ -240,7 +277,63 @@
|
||||
},
|
||||
{
|
||||
"function": "devices_to_import",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["dummy_router"],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -275,7 +368,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "*/5 * * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"show_ui": true,
|
||||
"unique_prefix": "UNFIMP",
|
||||
"plugin_type": "device_scanner",
|
||||
"execution_order" : "Layer_1",
|
||||
"data_source": "script",
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"display_name": [
|
||||
@@ -483,7 +484,12 @@
|
||||
"always_after_scan",
|
||||
"on_new_device"
|
||||
],
|
||||
"type": "text.select"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "python3 /app/front/plugins/unifi_import/script.py username={username} password={password} host={host} sites={sites} port={port} verifyssl={verifyssl} version={version} fullimport={fullimport}",
|
||||
@@ -518,7 +524,12 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "text"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "",
|
||||
@@ -545,7 +556,12 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "text"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "",
|
||||
@@ -572,7 +588,16 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "password"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "password" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "192.168.1.1",
|
||||
@@ -599,7 +624,12 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "text"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "8443",
|
||||
@@ -626,7 +656,12 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "text"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "false",
|
||||
@@ -653,11 +688,21 @@
|
||||
}
|
||||
],
|
||||
"options": ["true", "false"],
|
||||
"type": "text.select"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": "version",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "v4",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -707,7 +752,63 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "list"
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "0 2 * * *",
|
||||
@@ -734,7 +835,12 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "text"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": 5,
|
||||
@@ -769,7 +875,16 @@
|
||||
}
|
||||
],
|
||||
"options": [],
|
||||
"type": "integer"
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": ["Watched_Value1", "Watched_Value4"],
|
||||
@@ -801,7 +916,16 @@
|
||||
"Watched_Value3",
|
||||
"Watched_Value4"
|
||||
],
|
||||
"type": "text.multiselect"
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": ["new", "watched-changed"],
|
||||
@@ -833,7 +957,16 @@
|
||||
"watched-not-changed",
|
||||
"missing-in-last-scan"
|
||||
],
|
||||
"type": "text.multiselect"
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"default_value": "disabled",
|
||||
@@ -868,7 +1001,12 @@
|
||||
}
|
||||
],
|
||||
"options": ["disabled", "once", "always"],
|
||||
"type": "text.select"
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -41,7 +41,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "schedule",
|
||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
||||
"localized": ["name", "description"],
|
||||
@@ -72,7 +77,16 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/vendor_update/script.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -107,7 +121,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 4 * * 3",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -142,7 +161,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 600,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -177,7 +205,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -213,7 +250,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": [
|
||||
"new",
|
||||
|
||||
@@ -344,7 +344,12 @@
|
||||
{
|
||||
"function": "RUN",
|
||||
"events": ["run"],
|
||||
"type": "text.select",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "select", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "disabled",
|
||||
"options": [
|
||||
"disabled",
|
||||
@@ -377,7 +382,12 @@
|
||||
},
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "python3 /app/front/plugins/website_monitor/script.py urls={urls}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -404,7 +414,12 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_SCHD",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "0 2 * * *",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -431,7 +446,12 @@
|
||||
},
|
||||
{
|
||||
"function": "API_SQL",
|
||||
"type": "text",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{ "elementType": "input", "elementOptions": [], "transformers": [] }
|
||||
]
|
||||
},
|
||||
"default_value": "SELECT * FROM plugin_website_monitor",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -458,7 +478,16 @@
|
||||
},
|
||||
{
|
||||
"function": "RUN_TIMEOUT",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 5,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -489,7 +518,16 @@
|
||||
},
|
||||
{
|
||||
"function": "WATCH",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["Watched_Value1"],
|
||||
"options": [
|
||||
"Watched_Value1",
|
||||
@@ -521,7 +559,16 @@
|
||||
},
|
||||
{
|
||||
"function": "REPORT_ON",
|
||||
"type": "text.multiselect",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [{ "multiple": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["new", "watched-changed"],
|
||||
"options": [
|
||||
"new",
|
||||
@@ -553,7 +600,63 @@
|
||||
},
|
||||
{
|
||||
"function": "urls_to_check",
|
||||
"type": "list",
|
||||
"type": {
|
||||
"dataType": "array",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [
|
||||
{ "placeholder": "Enter value" },
|
||||
{ "suffix": "_in" },
|
||||
{ "cssClasses": "col-sm-10" },
|
||||
{ "prefillValue": "null" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": ["_in"] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-12" },
|
||||
{ "onClick": "addList(this, false)" },
|
||||
{ "getStringKey": "Gen_Add" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeAllOptions(this)" },
|
||||
{ "getStringKey": "Gen_Remove_All" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "button",
|
||||
"elementOptions": [
|
||||
{ "sourceSuffixes": [] },
|
||||
{ "separator": "" },
|
||||
{ "cssClasses": "col-xs-6" },
|
||||
{ "onClick": "removeFromList(this)" },
|
||||
{ "getStringKey": "Gen_Remove_Last" }
|
||||
],
|
||||
"transformers": []
|
||||
},
|
||||
{
|
||||
"elementType": "select",
|
||||
"elementOptions": [
|
||||
{ "multiple": "true" },
|
||||
{ "readonly": "true" },
|
||||
{ "editable": "true" }
|
||||
],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": ["https://google.com", "https://duck.com"],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
@@ -580,7 +683,16 @@
|
||||
},
|
||||
{
|
||||
"function": "SQL_internet_ip",
|
||||
"type": "readonly",
|
||||
"type": {
|
||||
"dataType": "string",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "readonly": "true" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": "SELECT dev_LastIP FROM Devices WHERE dev_MAC = 'Internet'",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -30,7 +30,16 @@
|
||||
"settings": [
|
||||
{
|
||||
"function": "AppEvents_hist",
|
||||
"type": "integer",
|
||||
"type": {
|
||||
"dataType": "integer",
|
||||
"elements": [
|
||||
{
|
||||
"elementType": "input",
|
||||
"elementOptions": [{ "type": "number" }],
|
||||
"transformers": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 5000,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
|
||||
@@ -26,12 +26,9 @@ $settingsJson = json_decode($data);
|
||||
// get settings from the DB
|
||||
|
||||
global $db;
|
||||
global $settingKeyOfLists;
|
||||
|
||||
$result = $db->query("SELECT * FROM Settings");
|
||||
|
||||
// array
|
||||
$settingKeyOfLists = array();
|
||||
|
||||
$settings = array();
|
||||
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
||||
@@ -52,9 +49,8 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
|
||||
?>
|
||||
<!-- Page ------------------------------------------------------------------ -->
|
||||
<!-- Page ------------------------------------------------------------------ -->
|
||||
|
||||
<script src="js/settings_utils.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
|
||||
|
||||
<script src="lib/crypto/crypto-js.min.js"></script>
|
||||
|
||||
@@ -118,21 +114,21 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
<div class =" col-sm-12" id="system_content"></div>
|
||||
</div>
|
||||
|
||||
<div class ="bg-grey-dark color-palette panel panel-default col-sm-12 box-default box-info" id="device_scanner_content_header" >
|
||||
<div class ="bg-grey-dark color-palette panel panel-default col-sm-12 box-default box-info" id="device_scanners_content_header" >
|
||||
<div class ="settings-group col-sm-12">
|
||||
<i class="<?= lang("settings_device_scanners_icon");?>"></i> <?= lang("settings_device_scanners_label");?>
|
||||
</div>
|
||||
<div class =" col-sm-12" id="device_scanner_content"> <?= lang("settings_device_scanners_info");?> </div>
|
||||
</div>
|
||||
|
||||
<div class ="bg-grey-dark color-palette panel panel-default col-sm-12 box-default box-info" id="other_content_header">
|
||||
<div class ="bg-grey-dark color-palette panel panel-default col-sm-12 box-default box-info" id="other_scanners_content_header">
|
||||
<div class ="settings-group col-sm-12">
|
||||
<i class="<?= lang("settings_other_scanners_icon");?>"></i> <?= lang("settings_other_scanners_label");?>
|
||||
</div>
|
||||
<div class =" col-sm-12" id="other_content"></div>
|
||||
</div>
|
||||
|
||||
<div class ="bg-grey-dark color-palette panel panel-default col-sm-12 box-default box-info" id="publisher_content_header" >
|
||||
<div class ="bg-grey-dark color-palette panel panel-default col-sm-12 box-default box-info" id="publishers_content_header" >
|
||||
<div class ="settings-group col-sm-12">
|
||||
<i class="<?= lang("settings_publishers_icon");?>"></i> <?= lang("settings_publishers_label");?>
|
||||
</div>
|
||||
@@ -241,7 +237,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
// only proceed if everything was loaded correctly
|
||||
if(!exception_occurred)
|
||||
{
|
||||
initSettingsPage(settingsData, pluginsData, generateDropdownOptions);
|
||||
initSettingsPage(settingsData, pluginsData);
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -253,7 +249,6 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
function initSettingsPage(settingsData, pluginsData){
|
||||
|
||||
const settingPluginPrefixes = [];
|
||||
const settingKeyOfLists = [];
|
||||
|
||||
const enabledDeviceScanners = getPluginsByType(pluginsData, "device_scanner", true);
|
||||
const enabledOthers = getPluginsByType(pluginsData, "other", true);
|
||||
@@ -290,12 +285,14 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
|
||||
overviewSections_html += `<div class="overview-section col-sm-12" id="${section}">
|
||||
<div class="col-sm-12 " title="${getString("settings_"+section)}">
|
||||
<div class="overview-group col-sm-12 col-xs-12">
|
||||
|
||||
<i title="${section}" class="${getString("settings_"+section+"_icon")}"></i>
|
||||
|
||||
${getString("settings_"+section+"_label")}
|
||||
</div>
|
||||
<a href="#${section}_content_header">
|
||||
<div class="overview-group col-sm-12 col-xs-12">
|
||||
|
||||
<i title="${section}" class="${getString("settings_"+section+"_icon")}"></i>
|
||||
|
||||
${getString("settings_"+section+"_label")}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
${overviewSectionsHtml[index]}
|
||||
@@ -338,7 +335,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
|
||||
// Start constructing the main settings HTML
|
||||
let pluginHtml = `
|
||||
<div class="row table_row">
|
||||
<div class="row table_row docs">
|
||||
<div class="table_cell bold">
|
||||
<i class="fa-regular fa-book fa-sm"></i>
|
||||
${getString(prefix+'_description')}
|
||||
@@ -379,16 +376,17 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
// go thru all settings and collect settings per settings prefix
|
||||
settingsData.forEach((set) => {
|
||||
|
||||
let val = set['Value'];
|
||||
const valIn = set['Value'];
|
||||
const codeName = set['Code_Name'];
|
||||
const setType = set['Type'].toLowerCase();
|
||||
const setType = set['Type'];
|
||||
const isMetadata = codeName.includes('__metadata');
|
||||
// is this isn't a metadata entry, get corresponding metadata object from the dummy setting
|
||||
const setObj = isMetadata ? {} : JSON.parse(getSetting(`${codeName}__metadata`));
|
||||
|
||||
// not initialized properly, reload
|
||||
if(isMetadata && val == "" )
|
||||
if(isMetadata && valIn == "" )
|
||||
{
|
||||
console.warn(`Metadata setting value is empty: ${codeName}`);
|
||||
clearCache();
|
||||
}
|
||||
|
||||
@@ -418,7 +416,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
<div class="table_cell setting_description">
|
||||
${getString(codeName + '_description', set['Description'])}
|
||||
</div>
|
||||
<div class="table_cell setting_input input-group">
|
||||
<div class="table_cell setting_input input-group col-sm-12">
|
||||
`;
|
||||
|
||||
// OVERRIDE
|
||||
@@ -456,146 +454,103 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
<div class="override-text col-xs-11" title="${getString("Setting_Override_Description")}">
|
||||
${getString("Setting_Override")}
|
||||
</div>
|
||||
</div>`;
|
||||
</div>`;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// INPUT
|
||||
// pre-processing done, render setting based on type
|
||||
|
||||
let inputHtml = "";
|
||||
if (setType.startsWith('text') || setType.startsWith('string') || setType.startsWith('date-time') ) {
|
||||
// --- process text ---
|
||||
if(setType.includes(".select"))
|
||||
{
|
||||
inputHtml = generateInputOptions(pluginsData, set, inputHtml, isMultiSelect = false)
|
||||
|
||||
} else if(setType.includes(".multiselect"))
|
||||
{
|
||||
inputHtml = generateInputOptions(pluginsData, set, inputHtml, isMultiSelect = true)
|
||||
} else{
|
||||
|
||||
// if it's overridable set readonly accordingly
|
||||
if(overridable)
|
||||
{
|
||||
override ? readonly = "" : readonly = " readonly" ;
|
||||
}
|
||||
|
||||
inputHtml = `<input class="form-control" onChange="settingsChanged()" my-data-type="${setType}" id="${codeName}" value="${val}" ${readonly}/>`;
|
||||
}
|
||||
} else if (setType === 'integer') {
|
||||
// --- process integer ---
|
||||
inputHtml = `<input onChange="settingsChanged()" my-data-type="${setType}" class="form-control" id="${codeName}" type="number" value="${val}"/>`;
|
||||
} else if (setType.startsWith('password')) {
|
||||
// --- process password ---
|
||||
inputHtml = `<input onChange="settingsChanged()" my-data-type="${setType}" class="form-control input" id="${codeName}" type="password" value="${val}"/>`;
|
||||
} else if (setType === 'readonly') {
|
||||
// --- process readonly ---
|
||||
inputHtml = `<input class="form-control input" my-data-type="${setType}" id="${codeName}" value="${val}" readonly/>`;
|
||||
} else if (setType === 'boolean' || setType === 'integer.checkbox') {
|
||||
// --- process boolean ---
|
||||
let checked = val === 'True' || val === '1' ? 'checked' : '';
|
||||
|
||||
// if it's overridable set readonly accordingly
|
||||
if(overridable)
|
||||
{
|
||||
override ? disabled = "" : disabled = " disabled" ;
|
||||
}
|
||||
|
||||
inputHtml = `<input onChange="settingsChanged()" my-data-type="${setType}" class="checkbox" id="${codeName}" type="checkbox" value="${val}" ${checked} ${disabled}/>`;
|
||||
} else if (setType === 'integer.select') {
|
||||
|
||||
inputHtml = generateInputOptions(pluginsData, set, inputHtml)
|
||||
|
||||
} else if (setType === 'subnets') {
|
||||
// --- process subnets ---
|
||||
inputHtml = `
|
||||
<div class="row form-group">
|
||||
<div class="col-xs-5">
|
||||
<input class="form-control" id="ipMask" type="text" placeholder="192.168.1.0/24"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<input class="form-control" id="ipInterface" type="text" placeholder="eth0" />
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<button class="btn btn-primary" onclick="addInterface();initListInteractionOptions('${codeName}')">${getString("Gen_Add")}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select class="form-control" my-data-type="${setType}" name="${codeName}" id="${codeName}" onchange="initListInteractionOptions(${codeName})" multiple readonly>`;
|
||||
// Parse the setType JSON string into an object
|
||||
let inputHtml = '';
|
||||
const setTypeObject = JSON.parse(setType.replace(/'/g, '"'));
|
||||
|
||||
const dataType = setTypeObject.dataType;
|
||||
const elements = setTypeObject.elements || [];
|
||||
|
||||
saved_values = createArray(val);
|
||||
// Iterate through each element in elements array
|
||||
elements.forEach(elementObj => {
|
||||
const { elementType, elementOptions = [], transformers = [] } = elementObj;
|
||||
const {
|
||||
inputType,
|
||||
readOnly,
|
||||
isMultiSelect,
|
||||
cssClasses,
|
||||
placeholder,
|
||||
suffix,
|
||||
sourceIds,
|
||||
separator,
|
||||
editable,
|
||||
valRes,
|
||||
getStringKey,
|
||||
onClick
|
||||
} = handleElementOptions(codeName, elementOptions, transformers, valIn);
|
||||
|
||||
saved_values.forEach(saved_val => {
|
||||
inputHtml += `<option value="${saved_val}" >${saved_val}</option>`;
|
||||
});
|
||||
// override
|
||||
val = valRes;
|
||||
|
||||
inputHtml += `</select>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<button class="btn btn-primary" my-input="${codeName}" onclick="removeFromList(this)">
|
||||
${getString("Gen_Remove_Last")}
|
||||
</button>
|
||||
<button class="btn btn-primary" my-input="${codeName}" onclick="removeAllOptions(this)">
|
||||
${getString("Gen_Remove_All")}
|
||||
</button>
|
||||
</div>`;
|
||||
} else if (setType === 'list' || setType === 'list.select' || setType === 'list.readonly') {
|
||||
// --- process list ---
|
||||
// Generate HTML based on dataType and elementType
|
||||
switch (elementType) {
|
||||
case 'select':
|
||||
let multi = isMultiSelect ? "multiple" : "";
|
||||
|
||||
settingKeyOfLists.push(codeName);
|
||||
inputHtml += `<select onChange="settingsChanged()" my-data-type="${dataType}" my-editable="${editable}" class="form-control" name="${codeName}" id="${codeName}" ${multi}>
|
||||
<option value="" id="${codeName + "_temp_"}"></option>
|
||||
</select>`;
|
||||
|
||||
inputHtml += `
|
||||
<div class="row form-group">
|
||||
<div class="col-xs-9">`
|
||||
generateOptionsOrSetOptions(codeName, createArray(val), `${codeName}_temp_`, generateOptions, targetField = null, transformers);
|
||||
|
||||
if(setType.includes(".select")) // not tested
|
||||
{
|
||||
inputHtml += generateInputOptions(pluginsData, set, inputHtml, isMultiSelect = false)
|
||||
break;
|
||||
|
||||
case 'input':
|
||||
let checked = val === 'True' || val === '1' ? 'checked' : '';
|
||||
inputType === 'checkbox' ? inputClass = 'checkbox' : inputClass = 'form-control';
|
||||
|
||||
inputHtml += `
|
||||
<input
|
||||
class="${inputClass} ${cssClasses}"
|
||||
onChange="settingsChanged()"
|
||||
my-data-type="${dataType}"
|
||||
id="${codeName}${suffix}"
|
||||
type="${inputType}"
|
||||
value="${val}"
|
||||
${readOnly}
|
||||
${checked}
|
||||
placeholder="${placeholder}"
|
||||
/>`;
|
||||
break;
|
||||
|
||||
case 'button':
|
||||
|
||||
inputHtml += `
|
||||
<button
|
||||
class="btn btn-primary ${cssClasses}"
|
||||
my-input-from="${sourceIds}"
|
||||
my-input-to="${codeName}"
|
||||
onclick="${onClick}">
|
||||
${getString(getStringKey)}
|
||||
</button>`;
|
||||
break;
|
||||
case 'textarea':
|
||||
inputHtml += `
|
||||
<textarea
|
||||
class="form-control input"
|
||||
my-data-type="${dataType}"
|
||||
id="${codeName}"
|
||||
${readOnly}>
|
||||
${val}
|
||||
</textarea>`;
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn(`🟥Unknown element type: ${elementType}`);
|
||||
}
|
||||
else
|
||||
{
|
||||
inputHtml += `
|
||||
<input class="form-control" type="text" id="${codeName}_input" placeholder="Enter value"/>
|
||||
`;
|
||||
}
|
||||
|
||||
inputHtml += `</div>
|
||||
<div class="col-xs-3">
|
||||
<button class="btn btn-primary" my-input-from="${codeName}_input" my-input-to="${codeName}" onclick="addList(this);initListInteractionOptions('${codeName}')">${getString("Gen_Add")}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select class="form-control" my-data-type="${setType}" name="${codeName}" id="${codeName}" multiple readonly>`;
|
||||
|
||||
let saved_values = createArray(val);
|
||||
|
||||
saved_values.forEach(saved_val => {
|
||||
|
||||
inputHtml += `<option value="${saved_val}" >${saved_val}</option>`;
|
||||
});
|
||||
|
||||
inputHtml += '</select></div>' +
|
||||
`<div>
|
||||
<button class="btn btn-primary" my-input="${codeName}" onclick="removeFromList(this)">
|
||||
${getString("Gen_Remove_Last")}
|
||||
</button>
|
||||
<button class="btn btn-primary" my-input="${codeName}" onclick="removeAllOptions(this)">
|
||||
${getString("Gen_Remove_All")}
|
||||
</button>
|
||||
</div>`;
|
||||
} else if (setType === 'json') {
|
||||
// --- process json ---
|
||||
inputHtml = `<textarea class="form-control input" my-data-type="${setType}" id="${codeName}" readonly>${JSON.stringify(val, null, 2)}</textarea>`;
|
||||
}
|
||||
});
|
||||
|
||||
// EVENTS
|
||||
// process events (e.g. run ascan, or test a notification) if associated with the setting
|
||||
let eventsHtml = "";
|
||||
|
||||
const eventsList = createArray(set['Events']);
|
||||
const eventsList = createArray(set['Events']);
|
||||
|
||||
if (eventsList.length > 0) {
|
||||
// console.log(eventsList)
|
||||
@@ -604,7 +559,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
data-myparam="${codeName}"
|
||||
data-myparam-plugin="${prefix}"
|
||||
data-myevent="${event}"
|
||||
onclick="addToExecutionQueue(this)"
|
||||
onclick="addToExecutionQueue_settingEvent(this)"
|
||||
>
|
||||
<i title="${getString(event + "_event_tooltip")}" class="fa ${getString(event + "_event_icon")}">
|
||||
</i>
|
||||
@@ -619,28 +574,22 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
`
|
||||
|
||||
// generate settings in the correct prefix (group) section
|
||||
$(`#${prefix} .panel-body`).append(setHtml);
|
||||
|
||||
// init remove and edit listitem click gestures
|
||||
if(['subnets', 'list' ].includes(setType))
|
||||
{
|
||||
initListInteractionOptions(codeName)
|
||||
}
|
||||
|
||||
$(`#${prefix} .panel-body`).append(setHtml);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// init finished
|
||||
setTimeout(() => {
|
||||
initListInteractionOptions() // init remove and edit listitem click gestures
|
||||
}, 50);
|
||||
|
||||
setupSmoothScrolling()
|
||||
hideSpinner()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// display the name of the first person
|
||||
// echo $settingsJson[0]->name;
|
||||
var settingsNumberDB = <?php echo count($settings)?>;
|
||||
@@ -670,52 +619,91 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
|
||||
var settingsArray = [];
|
||||
|
||||
// collect values for each of the different input form controls
|
||||
const noConversion = ['text', 'integer', 'string', 'password', 'readonly', 'text.select', 'list.select', 'integer.select', 'text.multiselect'];
|
||||
|
||||
// get settings to determine setting type to store values appropriately
|
||||
$.get('api/table_settings.json?nocache=' + Date.now(), function(res) {
|
||||
|
||||
settingsJSON = res;
|
||||
// loop through the settings definitions from the json
|
||||
res["data"].forEach(set => {
|
||||
|
||||
prefix = set["Group"]
|
||||
setType = set["Type"]
|
||||
setCodeName = set["Code_Name"]
|
||||
|
||||
const setTypeObject = JSON.parse(setType.replace(/'/g, '"'));
|
||||
// console.log(setTypeObject);
|
||||
|
||||
const dataType = setTypeObject.dataType;
|
||||
const lastElementObj = setTypeObject.elements[setTypeObject.elements.length - 1];
|
||||
const { elementType, elementOptions = [], transformers = [] } = lastElementObj;
|
||||
const {
|
||||
inputType,
|
||||
readOnly,
|
||||
isMultiSelect,
|
||||
cssClasses,
|
||||
placeholder,
|
||||
suffix,
|
||||
sourceIds,
|
||||
separator,
|
||||
editable,
|
||||
valRes,
|
||||
getStringKey,
|
||||
onClick
|
||||
} = handleElementOptions('none', elementOptions, transformers, val = "");
|
||||
|
||||
let value;
|
||||
|
||||
if (dataType === "string" ||
|
||||
(dataType === "integer" && (inputType === "number" || inputType === "text"))) {
|
||||
|
||||
data = settingsJSON["data"];
|
||||
value = $('#' + setCodeName).val();
|
||||
value = applyTransformers(value, transformers);
|
||||
settingsArray.push([prefix, setCodeName, dataType, value]);
|
||||
|
||||
data.forEach(set => {
|
||||
if (noConversion.includes(set['Type'])) {
|
||||
|
||||
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], $('#'+set["Code_Name"]).val()]);
|
||||
|
||||
} else if (set['Type'] === 'boolean' || set['Type'] === 'integer.checkbox') {
|
||||
} else if (inputType === 'checkbox') {
|
||||
|
||||
const temp = $(`#${set["Code_Name"]}`).is(':checked') ? 1 : 0;
|
||||
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], temp]);
|
||||
|
||||
} else if (set['Type'] === 'list' || set['Type'] === 'subnets') {
|
||||
value = $(`#${setCodeName}`).is(':checked') ? 1 : 0;
|
||||
value = applyTransformers(value, transformers);
|
||||
settingsArray.push([prefix, setCodeName, dataType, value]);
|
||||
|
||||
} else if (dataType === "array" ) {
|
||||
|
||||
// make sure to collect all if set as "editable" or selected only otherwise
|
||||
$(`#${setCodeName}`).attr("my-editable") == "true" ? additionalSelector = "" : additionalSelector = ":selected"
|
||||
|
||||
const temps = [];
|
||||
$(`#${set["Code_Name"]} option`).each(function (i, selected) {
|
||||
const vl = $(selected).val();
|
||||
$(`#${setCodeName} option${additionalSelector}`).each(function() {
|
||||
const vl = $(this).val();
|
||||
if (vl !== '') {
|
||||
temps.push(vl);
|
||||
temps.push(applyTransformers(vl, transformers));
|
||||
}
|
||||
});
|
||||
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], JSON.stringify(temps)]);
|
||||
} else if (set['Type'] === 'json') {
|
||||
const temps = $('#'+set["Code_Name"]).val();
|
||||
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], temps]);
|
||||
} else if (set['Type'] === 'password.SHA256') {
|
||||
// save value as SHA256 if value isn't SHA256 already
|
||||
var temps = $('#'+set["Code_Name"]).val();
|
||||
});
|
||||
|
||||
value = JSON.stringify(temps);
|
||||
settingsArray.push([prefix, setCodeName, dataType, value]);
|
||||
|
||||
} else if (dataType === "json") {
|
||||
|
||||
if(temps != "" && !isSHA256(temps))
|
||||
{
|
||||
temps = CryptoJS.SHA256(temps).toString(CryptoJS.enc.Hex);
|
||||
}
|
||||
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], temps]);
|
||||
value = $('#' + setCodeName).val();
|
||||
value = applyTransformers(value, transformers);
|
||||
value = JSON.stringify(value, null, 2)
|
||||
settingsArray.push([prefix, setCodeName, dataType, value]);
|
||||
|
||||
} else {
|
||||
|
||||
console.error(`[saveSettings] Couldn't determnine how to handle (setCodeName|dataType|inputType):(${setCodeName}|${dataType}|${inputType})`);
|
||||
|
||||
value = $('#' + setCodeName).val();
|
||||
value = applyTransformers(value, transformers);
|
||||
settingsArray.push([prefix, setCodeName, dataType, value]);
|
||||
}
|
||||
});
|
||||
|
||||
// sanity check to make sure settings were loaded & collected correctly
|
||||
if(settingsCollectedCorrectly(settingsArray, settingsJSON_DB))
|
||||
{
|
||||
|
||||
console.log(settingsArray);
|
||||
console.log( JSON.stringify(settingsArray));
|
||||
// return;
|
||||
// trigger a save settings event in the backend
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
|
||||
@@ -16,7 +16,7 @@ fi
|
||||
apt-get install -y \
|
||||
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 php-openssl sqlite3 dnsutils net-tools \
|
||||
python3 python3-dev iproute2 nmap python3-pip zip systemctl usbutils traceroute
|
||||
python3 python3-dev iproute2 nmap python3-pip zip systemctl usbutils traceroute nbtscan
|
||||
|
||||
# alternate dependencies
|
||||
sudo apt-get install nginx nginx-core mtr php-fpm php8.2-fpm php-cli php8.2 php8.2-sqlite3 -y
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import sqlite3
|
||||
import base64
|
||||
import json
|
||||
|
||||
# Register NetAlertX modules
|
||||
from const import fullDbPath, sql_devices_stats, sql_devices_all, sql_generateGuid
|
||||
@@ -473,6 +474,7 @@ class DB():
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# indicates, if CurrentScan table is available
|
||||
# 🐛 CurrentScan DEBUG: comment out below when debugging to keep the CurrentScan table after restarts/scan finishes
|
||||
self.sql.execute("DROP TABLE IF EXISTS CurrentScan;")
|
||||
self.sql.execute(""" CREATE TABLE IF NOT EXISTS CurrentScan (
|
||||
cur_MAC STRING(50) NOT NULL COLLATE NOCASE,
|
||||
@@ -555,6 +557,7 @@ class DB():
|
||||
result["data"].append(tmp)
|
||||
|
||||
# mylog('debug',[ '[Database] - get_table_as_json - returning ', len(rows), " rows with columns: ", columnNames])
|
||||
# mylog('debug',[ '[Database] - get_table_as_json - returning json ', json.dumps(result) ])
|
||||
return json_obj(result, columnNames)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
179
server/device.py
179
server/device.py
@@ -4,7 +4,7 @@ import subprocess
|
||||
import conf
|
||||
import os
|
||||
import re
|
||||
from helper import timeNowTZ, get_setting, get_setting_value, list_to_where, resolve_device_name_dig, resolve_device_name_pholus, get_device_name_nslookup, check_IP_format
|
||||
from helper import timeNowTZ, get_setting, get_setting_value, list_to_where, resolve_device_name_dig, resolve_device_name_pholus, get_device_name_nbtlookup, get_device_name_nslookup, check_IP_format
|
||||
from logger import mylog, print_log
|
||||
from const import vendorsPath, vendorsPathNewest, sql_generateGuid
|
||||
|
||||
@@ -29,6 +29,17 @@ class Device_obj:
|
||||
""")
|
||||
return self.db.sql.fetchall()
|
||||
|
||||
# Get specific column value based on dev_MAC
|
||||
def getValueWithMac(self, column_name, dev_MAC):
|
||||
|
||||
query = f"SELECT {column_name} FROM Devices WHERE dev_MAC = ?"
|
||||
|
||||
self.db.sql.execute(query, (dev_MAC,))
|
||||
|
||||
result = self.db.sql.fetchone()
|
||||
|
||||
return result[column_name] if result else None
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def save_scanned_devices (db):
|
||||
@@ -84,34 +95,34 @@ def print_scan_stats(db):
|
||||
mylog('verbose', f'[Scan Stats] Disconnections.........: {stats[0]["disconnections"]}')
|
||||
mylog('verbose', f'[Scan Stats] IP Changes.............: {stats[0]["ip_changes"]}')
|
||||
|
||||
if str(stats[0]["new_devices"]) != '0':
|
||||
mylog('debug', f' ================ DEVICES table content ================')
|
||||
sql.execute('select * from Devices')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('debug', f' {row_dict}')
|
||||
|
||||
mylog('debug', f' ================ CurrentScan table content ================')
|
||||
sql.execute('select * from CurrentScan')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('debug', f' {row_dict}')
|
||||
|
||||
mylog('debug', f' ================ Events table content where eve_PendingAlertEmail = 1 ================')
|
||||
sql.execute('select * from Events where eve_PendingAlertEmail = 1')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('debug', f' {row_dict}')
|
||||
# if str(stats[0]["new_devices"]) != '0':
|
||||
mylog('trace', f' ================ DEVICES table content ================')
|
||||
sql.execute('select * from Devices')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('trace', f' {row_dict}')
|
||||
|
||||
mylog('trace', f' ================ CurrentScan table content ================')
|
||||
sql.execute('select * from CurrentScan')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('trace', f' {row_dict}')
|
||||
|
||||
mylog('trace', f' ================ Events table content where eve_PendingAlertEmail = 1 ================')
|
||||
sql.execute('select * from Events where eve_PendingAlertEmail = 1')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('trace', f' {row_dict}')
|
||||
|
||||
mylog('debug', f' ================ Events table COUNT ================')
|
||||
sql.execute('select count(*) from Events')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('debug', f' {row_dict}')
|
||||
mylog('trace', f' ================ Events table COUNT ================')
|
||||
sql.execute('select count(*) from Events')
|
||||
rows = sql.fetchall()
|
||||
for row in rows:
|
||||
row_dict = dict(row)
|
||||
mylog('trace', f' {row_dict}')
|
||||
|
||||
|
||||
mylog('verbose', '[Scan Stats] Scan Method Statistics:')
|
||||
@@ -212,18 +223,32 @@ def create_new_devices (db):
|
||||
)
|
||||
SELECT
|
||||
cur_MAC,
|
||||
CASE WHEN LENGTH(TRIM(cur_Name)) > 0 THEN cur_Name ELSE '(unknown)' END,
|
||||
CASE
|
||||
WHEN LENGTH(TRIM(cur_Name)) > 0 THEN cur_Name ELSE '(unknown)'
|
||||
END,
|
||||
cur_Vendor,
|
||||
cur_IP,
|
||||
?,
|
||||
?,
|
||||
cur_SyncHubNodeName,
|
||||
{sql_generateGuid},
|
||||
CASE WHEN LENGTH(TRIM(cur_NetworkNodeMAC)) > 0 THEN cur_NetworkNodeMAC ELSE '{get_setting_value('NEWDEV_dev_Network_Node_MAC_ADDR')}' END,
|
||||
CASE
|
||||
WHEN LENGTH(TRIM(cur_NetworkNodeMAC)) > 0
|
||||
AND cur_MAC != 'Internet'
|
||||
THEN cur_NetworkNodeMAC
|
||||
ELSE
|
||||
CASE
|
||||
WHEN cur_MAC = 'Internet'
|
||||
THEN 'null'
|
||||
ELSE '{get_setting_value('NEWDEV_dev_Network_Node_MAC_ADDR')}'
|
||||
END
|
||||
END,
|
||||
cur_PORT,
|
||||
cur_NetworkSite,
|
||||
cur_SSID,
|
||||
CASE WHEN LENGTH(TRIM(cur_Type)) > 0 THEN cur_Type ELSE '{get_setting_value('NEWDEV_dev_DeviceType')}' END,
|
||||
CASE
|
||||
WHEN LENGTH(TRIM(cur_Type)) > 0 THEN cur_Type ELSE '{get_setting_value('NEWDEV_dev_DeviceType')}'
|
||||
END,
|
||||
{newDevDefaults}
|
||||
FROM CurrentScan
|
||||
WHERE 1=1
|
||||
@@ -259,7 +284,7 @@ def update_devices_data_from_scan (db):
|
||||
WHERE dev_MAC = cur_MAC) """)
|
||||
|
||||
# Update IP
|
||||
mylog('debug', '[Update Devices] - 3 LastIP ')
|
||||
mylog('debug', '[Update Devices] - cur_IP -> dev_LastIP (always updated)')
|
||||
sql.execute("""UPDATE Devices
|
||||
SET dev_LastIP = (SELECT cur_IP FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC)
|
||||
@@ -267,103 +292,104 @@ def update_devices_data_from_scan (db):
|
||||
WHERE dev_MAC = cur_MAC) """)
|
||||
|
||||
# Update only devices with empty or NULL vendors
|
||||
mylog('debug', '[Update Devices] - 3 cur_Vendor -> dev_Vendor')
|
||||
mylog('debug', '[Update Devices] - cur_Vendor -> (if empty) dev_Vendor')
|
||||
sql.execute("""UPDATE Devices
|
||||
SET dev_Vendor = (
|
||||
SELECT cur_Vendor
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
)
|
||||
WHERE
|
||||
(dev_Vendor IS NULL OR dev_Vendor IN ("", "null"))
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
)""")
|
||||
|
||||
# Update only devices with empty or NULL dev_Network_Node_port
|
||||
mylog('debug', '[Update Devices] - 3 cur_Port -> dev_Network_Node_port')
|
||||
mylog('debug', '[Update Devices] - (if not empty) cur_Port -> dev_Network_Node_port')
|
||||
sql.execute("""UPDATE Devices
|
||||
SET dev_Network_Node_port = (
|
||||
SELECT cur_Port
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
)
|
||||
WHERE
|
||||
(dev_Network_Node_port IS NULL OR dev_Network_Node_port IN ("", "null"))
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
)""")
|
||||
SELECT cur_Port
|
||||
FROM CurrentScan
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
)
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
AND CurrentScan.cur_Port IS NOT NULL AND CurrentScan.cur_Port NOT IN ("", "null")
|
||||
)""")
|
||||
|
||||
# Update only devices with empty or NULL dev_Network_Node_MAC_ADDR
|
||||
mylog('debug', '[Update Devices] - 3 cur_NetworkNodeMAC -> dev_Network_Node_MAC_ADDR')
|
||||
mylog('debug', '[Update Devices] - (if not empty) cur_NetworkNodeMAC -> dev_Network_Node_MAC_ADDR')
|
||||
sql.execute("""UPDATE Devices
|
||||
SET dev_Network_Node_MAC_ADDR = (
|
||||
SELECT cur_NetworkNodeMAC
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
)
|
||||
WHERE
|
||||
(dev_Network_Node_MAC_ADDR IS NULL OR dev_Network_Node_MAC_ADDR IN ("", "null"))
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
)""")
|
||||
SELECT cur_NetworkNodeMAC
|
||||
FROM CurrentScan
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
)
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
AND CurrentScan.cur_NetworkNodeMAC IS NOT NULL AND CurrentScan.cur_NetworkNodeMAC NOT IN ("", "null")
|
||||
)""")
|
||||
|
||||
# Update only devices with empty or NULL dev_NetworkSite
|
||||
mylog('debug', '[Update Devices] - 3 cur_NetworkSite -> dev_NetworkSite')
|
||||
mylog('debug', '[Update Devices] - (if not empty) cur_NetworkSite -> (if empty) dev_NetworkSite')
|
||||
sql.execute("""UPDATE Devices
|
||||
SET dev_NetworkSite = (
|
||||
SELECT cur_NetworkSite
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
)
|
||||
WHERE
|
||||
(dev_NetworkSite IS NULL OR dev_NetworkSite IN ("", "null"))
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
)""")
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
AND CurrentScan.cur_NetworkSite IS NOT NULL AND CurrentScan.cur_NetworkSite NOT IN ("", "null")
|
||||
)""")
|
||||
|
||||
# Update only devices with empty or NULL dev_SSID
|
||||
mylog('debug', '[Update Devices] - 3 cur_SSID -> dev_SSID')
|
||||
mylog('debug', '[Update Devices] - (if not empty) cur_SSID -> (if empty) dev_SSID')
|
||||
sql.execute("""UPDATE Devices
|
||||
SET dev_SSID = (
|
||||
SELECT cur_SSID
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
)
|
||||
WHERE
|
||||
(dev_SSID IS NULL OR dev_SSID IN ("", "null"))
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
AND CurrentScan.cur_SSID IS NOT NULL AND CurrentScan.cur_SSID NOT IN ("", "null")
|
||||
)""")
|
||||
|
||||
# Update only devices with empty or NULL dev_DeviceType
|
||||
mylog('debug', '[Update Devices] - 3 cur_Type -> dev_DeviceType')
|
||||
mylog('debug', '[Update Devices] - (if not empty) cur_Type -> (if empty) dev_DeviceType')
|
||||
sql.execute("""UPDATE Devices
|
||||
SET dev_DeviceType = (
|
||||
SELECT cur_Type
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
)
|
||||
WHERE
|
||||
(dev_DeviceType IS NULL OR dev_DeviceType IN ("", "null"))
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CurrentScan
|
||||
WHERE dev_MAC = cur_MAC
|
||||
WHERE Devices.dev_MAC = CurrentScan.cur_MAC
|
||||
AND CurrentScan.cur_Type IS NOT NULL AND CurrentScan.cur_Type NOT IN ("", "null")
|
||||
)""")
|
||||
|
||||
# Update (unknown) or (name not found) Names if available
|
||||
mylog('debug','[Update Devices] - 4 Unknown Name')
|
||||
mylog('debug','[Update Devices] - (if not empty) cur_Name -> (if empty) dev_NAME')
|
||||
sql.execute (""" UPDATE Devices
|
||||
SET dev_NAME = COALESCE((
|
||||
SELECT cur_Name
|
||||
@@ -414,6 +440,7 @@ def update_devices_names (db):
|
||||
|
||||
foundDig = 0
|
||||
foundNsLookup = 0
|
||||
foundNbtLookup = 0
|
||||
foundPholus = 0
|
||||
|
||||
# Gen unknown devices
|
||||
@@ -453,6 +480,14 @@ def update_devices_names (db):
|
||||
|
||||
if newName != nameNotFound:
|
||||
foundNsLookup += 1
|
||||
|
||||
# Resolve device name with NSLOOKUP plugin data
|
||||
if newName == nameNotFound:
|
||||
newName = get_device_name_nbtlookup(db, device['dev_MAC'], device['dev_LastIP'])
|
||||
|
||||
if newName != nameNotFound:
|
||||
foundNbtLookup += 1
|
||||
|
||||
|
||||
# Resolve with Pholus
|
||||
if newName == nameNotFound:
|
||||
@@ -481,7 +516,7 @@ def update_devices_names (db):
|
||||
recordsToUpdate.append ([newName, device['dev_MAC']])
|
||||
|
||||
# Print log
|
||||
mylog('verbose', ['[Update Device Name] Names Found (DiG/NSLOOKUP/Pholus): ', len(recordsToUpdate), " (",foundDig,"/",foundNsLookup,"/",foundPholus ,")"] )
|
||||
mylog('verbose', ['[Update Device Name] Names Found (DiG/NSLOOKUP/NBTSCAN/Pholus): ', len(recordsToUpdate), " (",foundDig,"/",foundNsLookup,"/",foundNbtLookup,"/", foundPholus ,")"] )
|
||||
mylog('verbose', ['[Update Device Name] Names Not Found : ', notFound] )
|
||||
|
||||
# update not found devices with (name not found)
|
||||
@@ -494,7 +529,7 @@ def update_devices_names (db):
|
||||
# Check if the variable contains a valid MAC address or "Internet"
|
||||
def check_mac_or_internet(input_str):
|
||||
# Regular expression pattern for matching a MAC address
|
||||
mac_pattern = r'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
|
||||
mac_pattern = r'([0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2})'
|
||||
|
||||
if input_str.lower() == 'internet':
|
||||
return True
|
||||
|
||||
296
server/helper.py
296
server/helper.py
@@ -58,6 +58,7 @@ class app_state_class:
|
||||
def __init__(self, currentState, settingsSaved=None, settingsImported=None, showSpinner=False):
|
||||
# json file containing the state to communicate with the frontend
|
||||
stateFile = apiPath + '/app_state.json'
|
||||
previousState = ""
|
||||
|
||||
# if currentState == 'Initializing':
|
||||
# checkNewVersion(False)
|
||||
@@ -65,16 +66,22 @@ class app_state_class:
|
||||
# Update self
|
||||
self.currentState = currentState
|
||||
self.lastUpdated = str(timeNowTZ())
|
||||
|
||||
if os.path.exists(stateFile):
|
||||
try:
|
||||
with open(stateFile, 'r') as json_file:
|
||||
previousState = json.load(json_file)
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
mylog('none', [f'[app_state_class] Failed to handle app_state.json: {e}'])
|
||||
|
||||
|
||||
# Check if the file exists and init values
|
||||
if os.path.exists(stateFile):
|
||||
with open(stateFile, 'r') as json_file:
|
||||
previousState = json.load(json_file)
|
||||
self.settingsSaved = previousState.get("settingsSaved", 0)
|
||||
self.settingsImported = previousState.get("settingsImported", 0)
|
||||
self.showSpinner = previousState.get("showSpinner", False)
|
||||
self.isNewVersion = previousState.get("isNewVersion", False)
|
||||
self.isNewVersionChecked = previousState.get("isNewVersionChecked", 0)
|
||||
if previousState != "":
|
||||
self.settingsSaved = previousState.get("settingsSaved", 0)
|
||||
self.settingsImported = previousState.get("settingsImported", 0)
|
||||
self.showSpinner = previousState.get("showSpinner", False)
|
||||
self.isNewVersion = previousState.get("isNewVersion", False)
|
||||
self.isNewVersionChecked = previousState.get("isNewVersionChecked", 0)
|
||||
else:
|
||||
self.settingsSaved = 0
|
||||
self.settingsImported = 0
|
||||
@@ -96,8 +103,17 @@ class app_state_class:
|
||||
self.isNewVersionChecked = int(timeNow().timestamp())
|
||||
|
||||
# Update .json file
|
||||
with open(stateFile, 'w') as json_file:
|
||||
json.dump(self, json_file, cls=AppStateEncoder, indent=4)
|
||||
# with open(stateFile, 'w') as json_file:
|
||||
# json.dump(self, json_file, cls=AppStateEncoder, indent=4)
|
||||
|
||||
# Sanity check before saving the .json file
|
||||
try:
|
||||
json_data = json.dumps(self, cls=AppStateEncoder, indent=4)
|
||||
with open(stateFile, 'w') as json_file:
|
||||
json_file.write(json_data)
|
||||
except (TypeError, ValueError) as e:
|
||||
mylog('none', [f'[app_state_class] Failed to serialize object to JSON: {e}'])
|
||||
|
||||
|
||||
|
||||
def isSet(self):
|
||||
@@ -146,7 +162,7 @@ def checkPermissionsOK():
|
||||
dbW_access = (os.access(fullDbPath, os.W_OK))
|
||||
|
||||
mylog('none', ['\n'])
|
||||
mylog('none', ['The container restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips.'])
|
||||
mylog('none', ['The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips.'])
|
||||
mylog('none', ['\n'])
|
||||
mylog('none', ['Permissions check (All should be True)'])
|
||||
mylog('none', ['------------------------------------------------'])
|
||||
@@ -312,45 +328,118 @@ def get_setting_value(key):
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Convert the setting value to the corresponding python type
|
||||
import json
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
import json
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
def setting_value_to_python_type(set_type, set_value):
|
||||
value = '----not processed----'
|
||||
|
||||
value = ''
|
||||
# "type": {"dataType":"array", "elements": [{"elementType" : "select", "elementOptions" : [{"multiple":"true"}] ,"transformers": []}]}
|
||||
|
||||
setTypJSN = json.loads(str(set_type).replace('"','\"').replace("'",'"'))
|
||||
|
||||
# Handle different types of settings
|
||||
if set_type in ['text', 'string', 'password', 'password.SHA256', 'readonly', 'text.select']:
|
||||
value = str(set_value)
|
||||
elif set_type in ['boolean', 'integer.checkbox']:
|
||||
|
||||
value = False
|
||||
# Handle different types of settings based on set_type dictionary
|
||||
dataType = setTypJSN.get('dataType', '')
|
||||
elements = setTypJSN.get('elements', [])
|
||||
|
||||
# Ensure there's at least one element in the elements list
|
||||
if not elements:
|
||||
mylog('none', [f'[HELPER] No elements provided in set_type: {set_type} '])
|
||||
return value
|
||||
|
||||
# Use the last element in the list
|
||||
last_element = elements[len(elements)-1]
|
||||
elementType = last_element.get('elementType', '')
|
||||
elementOptions = last_element.get('elementOptions', [])
|
||||
transformers = last_element.get('transformers', [])
|
||||
|
||||
# Convert value based on dataType and elementType
|
||||
if dataType == 'string' and elementType in ['input', 'select']:
|
||||
value = reverseTransformers(str(set_value), transformers)
|
||||
|
||||
elif dataType == 'integer' and (elementType == 'input' or elementType == 'select'):
|
||||
# handle storing/retrieving boolean values as 1/0
|
||||
if set_value.lower() not in ['true', 'false'] and isinstance(set_value, str):
|
||||
value = int(set_value)
|
||||
|
||||
if isinstance(set_value, str) and set_value.lower() in ['true', '1']:
|
||||
value = True
|
||||
elif isinstance(set_value, int) and set_value == 1:
|
||||
value = True
|
||||
elif isinstance(set_value, bool):
|
||||
value = set_value
|
||||
|
||||
elif set_type in ['integer.select', 'integer']:
|
||||
value = int(set_value)
|
||||
elif set_type in ['text.multiselect', 'list', 'subnets', 'list.select']:
|
||||
# Handle string
|
||||
value = 1 if set_value else 0
|
||||
|
||||
mylog('debug', [f'[SETTINGS] Handling set_type: "{set_type}", set_value: "{set_value}"'])
|
||||
elif isinstance(set_value, str):
|
||||
value = 1 if set_value.lower() == 'true' else 0
|
||||
|
||||
else:
|
||||
value = int(set_value)
|
||||
|
||||
# boolean handling
|
||||
elif dataType == 'boolean' and elementType == 'input':
|
||||
value = set_value.lower() in ['true', '1']
|
||||
|
||||
# array handling
|
||||
elif dataType == 'array' and elementType == 'select':
|
||||
if isinstance(set_value, str):
|
||||
value = json.loads(set_value.replace("'", "\""))
|
||||
# Assuming set_value is a list in this case
|
||||
try:
|
||||
value = json.loads(set_value.replace("'", "\""))
|
||||
|
||||
# reverse transformations to all entries
|
||||
value = reverseTransformers(value, transformers)
|
||||
|
||||
except json.JSONDecodeError as e:
|
||||
mylog('none', [f'[setting_value_to_python_type] Error decoding JSON object: {e}'])
|
||||
mylog('none', [set_value])
|
||||
value = []
|
||||
|
||||
elif isinstance(set_value, list):
|
||||
value = set_value
|
||||
elif set_type == '.template':
|
||||
# Assuming set_value is a JSON object in this case
|
||||
value = json.loads(set_value)
|
||||
else:
|
||||
mylog('none', [f'[SETTINGS] ⚠ ERROR - set_type not handled:{set_type}'])
|
||||
mylog('none', [f'[SETTINGS] ⚠ ERROR - setting json:{json.dumps(setting)}'])
|
||||
|
||||
elif dataType == 'object' and elementType == 'input':
|
||||
if isinstance(set_value, str):
|
||||
try:
|
||||
value = reverseTransformers(json.loads(set_value), transformers)
|
||||
except json.JSONDecodeError as e:
|
||||
mylog('none', [f'[setting_value_to_python_type] Error decoding JSON object: {e}'])
|
||||
mylog('none', [{set_value}])
|
||||
value = {}
|
||||
|
||||
elif isinstance(set_value, dict):
|
||||
value = set_value
|
||||
|
||||
elif dataType == 'string' and elementType == 'input' and any(opt.get('readonly') == "true" for opt in elementOptions):
|
||||
value = reverseTransformers(str(set_value), transformers)
|
||||
|
||||
elif dataType == 'string' and elementType == 'input' and any(opt.get('type') == "password" for opt in elementOptions) and 'sha256' in transformers:
|
||||
value = hashlib.sha256(set_value.encode()).hexdigest()
|
||||
|
||||
|
||||
if value == '----not processed----':
|
||||
mylog('none', [f'[HELPER] ⚠ ERROR not processed set_type: {set_type} '])
|
||||
mylog('none', [f'[HELPER] ⚠ ERROR not processed set_value: {set_value} '])
|
||||
|
||||
return value
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Reverse transformed values if needed
|
||||
def reverseTransformers(val, transformers):
|
||||
# Function to apply transformers to a single value
|
||||
def reverse_transformers(value, transformers):
|
||||
for transformer in transformers:
|
||||
if transformer == 'base64':
|
||||
if isinstance(value, str):
|
||||
value = base64.b64decode(value).decode('utf-8')
|
||||
elif transformer == 'sha256':
|
||||
mylog('none', [f'[reverseTransformers] sha256 is irreversible'])
|
||||
return value
|
||||
|
||||
# Check if the value is a list
|
||||
if isinstance(val, list):
|
||||
return [reverse_transformers(item, transformers) for item in val]
|
||||
else:
|
||||
return reverse_transformers(val, transformers)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Generate a WHERE condition for SQLite based on a list of values.
|
||||
@@ -436,11 +525,11 @@ def get_device_name_nslookup(db, pMAC, pIP):
|
||||
Object_PrimaryID = '{pMAC}'
|
||||
"""
|
||||
)
|
||||
nslookupEntry = sql.fetchall()
|
||||
nameEntry = sql.fetchall()
|
||||
db.commitDB()
|
||||
|
||||
if len(nslookupEntry) != 0:
|
||||
name = cleanDeviceName(nslookupEntry[0][0], False)
|
||||
if len(nameEntry) != 0:
|
||||
name = cleanDeviceName(nameEntry[0][0], False)
|
||||
|
||||
return name
|
||||
|
||||
@@ -453,11 +542,56 @@ def get_device_name_nslookup(db, pMAC, pIP):
|
||||
Object_SecondaryID = '{pIP}'
|
||||
"""
|
||||
)
|
||||
nslookupEntry = sql.fetchall()
|
||||
nameEntry = sql.fetchall()
|
||||
db.commitDB()
|
||||
|
||||
if len(nslookupEntry) != 0:
|
||||
name = cleanDeviceName(nslookupEntry[0][0], True)
|
||||
if len(nameEntry) != 0:
|
||||
name = cleanDeviceName(nameEntry[0][0], True)
|
||||
|
||||
return name
|
||||
|
||||
return name
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def get_device_name_nbtlookup(db, pMAC, pIP):
|
||||
|
||||
nameNotFound = "(name not found)"
|
||||
|
||||
sql = db.sql
|
||||
|
||||
name = nameNotFound
|
||||
|
||||
# get names from the NBTSCAN plugin entries vased on MAC
|
||||
sql.execute(
|
||||
f"""
|
||||
SELECT Watched_Value2 FROM Plugins_Objects
|
||||
WHERE
|
||||
Plugin = 'NBTSCAN' AND
|
||||
Object_PrimaryID = '{pMAC}'
|
||||
"""
|
||||
)
|
||||
nameEntry = sql.fetchall()
|
||||
db.commitDB()
|
||||
|
||||
if len(nameEntry) != 0:
|
||||
name = cleanDeviceName(nameEntry[0][0], False)
|
||||
|
||||
return name
|
||||
|
||||
# get names from the NSLOOKUP plugin entries based on IP
|
||||
sql.execute(
|
||||
f"""
|
||||
SELECT Watched_Value2 FROM Plugins_Objects
|
||||
WHERE
|
||||
Plugin = 'NBTSCAN' AND
|
||||
Object_SecondaryID = '{pIP}'
|
||||
"""
|
||||
)
|
||||
nameEntry = sql.fetchall()
|
||||
db.commitDB()
|
||||
|
||||
if len(nameEntry) != 0:
|
||||
name = cleanDeviceName(nameEntry[0][0], True)
|
||||
|
||||
return name
|
||||
|
||||
@@ -588,65 +722,29 @@ import dns.resolver
|
||||
|
||||
def cleanDeviceName(str, match_IP):
|
||||
|
||||
if get_setting_value('NEWDEV_LESS_NAME_CLEANUP'):
|
||||
mylog('debug', ["[Name cleanup] Using new cleanDeviceName(" + str + ")"])
|
||||
|
||||
# replace all labels starting with underscore
|
||||
str = re.sub(r'^_[^\.]*\.', '', str) # leading label
|
||||
str = re.sub(r'\._[^\.]*\.', '.', str) # nested label
|
||||
|
||||
# get a stub resolver for access to resolv.conf configuration
|
||||
resolv = dns.resolver.Resolver()
|
||||
|
||||
# replace the local domain name
|
||||
str = re.sub(r'\.' + resolv.domain.to_text() + r'$', '', str)
|
||||
|
||||
# replace dns search list
|
||||
for name in resolv.search:
|
||||
str = re.sub(r'\.' + name.to_text() + r'$', '', str)
|
||||
|
||||
# removing last part of e.g. Nest-Audio-ff77ff77ff77ff77ff77ff77ff77ff77
|
||||
str = re.sub(r'-[a-fA-F0-9]{32}', '', str)
|
||||
|
||||
# Remove everything after '#' including the '#'
|
||||
str = re.sub(r'#.*', '', str)
|
||||
|
||||
# remove trailing dot
|
||||
if str.endswith('.'):
|
||||
str = str[:-1]
|
||||
|
||||
# add matching info
|
||||
if match_IP:
|
||||
str = str + " (IP match)"
|
||||
|
||||
# done
|
||||
mylog('debug', ["[Name cleanup] cleanDeviceName = " + str])
|
||||
return str
|
||||
|
||||
################################
|
||||
#
|
||||
# OLD cleanDeviceName
|
||||
mylog('debug', ["[Name cleanup] Using old cleanDeviceName(" + str + ")"])
|
||||
|
||||
# alternative str.split('.')[0]
|
||||
str = str.replace("._airplay", "")
|
||||
str = str.replace("._tcp", "")
|
||||
str = str.replace(".localdomain", "")
|
||||
str = str.replace(".local", "")
|
||||
str = str.replace("._esphomelib", "")
|
||||
str = str.replace("._googlecast", "")
|
||||
str = str.replace(".lan", "")
|
||||
str = str.replace(".home", "")
|
||||
str = re.sub(r'-[a-fA-F0-9]{32}', '', str) # removing last part of e.g. Nest-Audio-ff77ff77ff77ff77ff77ff77ff77ff77
|
||||
str = re.sub(r'#.*', '', str) # Remove everything after '#' including the '#'
|
||||
# remove trailing dots
|
||||
if str.endswith('.'):
|
||||
str = str[:-1]
|
||||
mylog('debug', ["[cleanDeviceName] input: " + str])
|
||||
|
||||
# add matching info
|
||||
if match_IP:
|
||||
str = str + " (IP match)"
|
||||
|
||||
mylog('debug', ["cleanDeviceName = " + str])
|
||||
# Applying cleanup REGEXEs
|
||||
mylog('debug', ["[Name cleanup] Using old cleanDeviceName(" + str + ")"])
|
||||
|
||||
regexes = get_setting_value('NEWDEV_NAME_CLEANUP_REGEX')
|
||||
|
||||
for rgx in regexes:
|
||||
mylog('trace', ["[cleanDeviceName] applying regex : " + rgx])
|
||||
mylog('trace', ["[cleanDeviceName] name before regex : " + str])
|
||||
str = re.sub(rgx, "", str)
|
||||
mylog('trace', ["[cleanDeviceName] name after regex : " + str])
|
||||
|
||||
str = re.sub(r'\.\b', '', str) # trailing dot after words
|
||||
str = re.sub(r'\.$', '', str) # trailing dot at the end of the string
|
||||
str = str.replace(". (IP match)", " (IP match)") # Remove dot if (IP match) is added
|
||||
|
||||
mylog('debug', ["[cleanDeviceName] output: " + str])
|
||||
|
||||
return str
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -726,7 +824,7 @@ def extract_between_strings(text, start, end):
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def extract_mac_addresses(text):
|
||||
mac_pattern = r"([0-9A-Fa-f]{2}(?:[:-][0-9A-Fa-f]{2}){5})"
|
||||
mac_pattern = r"([0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2}[:-][0-9A-Fa-f]{2})"
|
||||
mac_addresses = re.findall(mac_pattern, text)
|
||||
return mac_addresses
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ def ccd(key, default, config_dir, name, inputtype, options, group, events=None,
|
||||
result = result.replace('\'', "{s-quote}")
|
||||
|
||||
# Create the tuples
|
||||
sql_safe_tuple = (key, name, desc, inputtype, options, regex, str(result), group, str(events))
|
||||
sql_safe_tuple = (key, name, desc, str(inputtype), options, regex, str(result), group, str(events))
|
||||
settings_tuple = (key, name, desc, inputtype, options, regex, result, group, str(events))
|
||||
|
||||
# Update or append the tuples in the lists
|
||||
@@ -57,7 +57,7 @@ def ccd(key, default, config_dir, name, inputtype, options, group, events=None,
|
||||
|
||||
# Save metadata in dummy setting if not a metadata key
|
||||
if '__metadata' not in key:
|
||||
metadata_tuple = (f'{key}__metadata', "metadata name", "metadata desc", 'json', "", "", json.dumps(setJsonMetadata), group, '[]')
|
||||
metadata_tuple = (f'{key}__metadata', "metadata name", "metadata desc", '{"dataType":"json", "elements": [{"elementType" : "textarea", "elementOptions" : [{"readonly": "true"}] ,"transformers": []}]}', '[]', "", json.dumps(setJsonMetadata), group, '[]')
|
||||
conf.mySettingsSQLsafe = update_or_append(conf.mySettingsSQLsafe, metadata_tuple, f'{key}__metadata')
|
||||
conf.mySettings = update_or_append(conf.mySettings, metadata_tuple, f'{key}__metadata')
|
||||
|
||||
@@ -131,25 +131,25 @@ def importConfigs (db, all_plugins):
|
||||
# ----------------------------------------
|
||||
# ccd(key, default, config_dir, name, inputtype, options, group, events=[], desc = "", regex = "", setJsonMetadata = {}, overrideTemplate = {})
|
||||
|
||||
conf.LOADED_PLUGINS = ccd('LOADED_PLUGINS', [] , c_d, 'Loaded plugins', 'text.multiselect', '', 'General')
|
||||
conf.SCAN_SUBNETS = ccd('SCAN_SUBNETS', ['192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0'] , c_d, 'Subnets to scan', 'subnets', '', 'General')
|
||||
conf.LOG_LEVEL = ccd('LOG_LEVEL', 'verbose' , c_d, 'Log verboseness', 'text.select', "['none', 'minimal', 'verbose', 'debug']", 'General')
|
||||
conf.TIMEZONE = ccd('TIMEZONE', 'Europe/Berlin' , c_d, 'Time zone', 'text', '', 'General')
|
||||
conf.PLUGINS_KEEP_HIST = ccd('PLUGINS_KEEP_HIST', 250 , c_d, 'Keep history entries', 'integer', '', 'General')
|
||||
conf.REPORT_DASHBOARD_URL = ccd('REPORT_DASHBOARD_URL', 'http://netalertx/' , c_d, 'NetAlertX URL', 'text', '', 'General')
|
||||
conf.DAYS_TO_KEEP_EVENTS = ccd('DAYS_TO_KEEP_EVENTS', 90 , c_d, 'Delete events days', 'integer', '', 'General')
|
||||
conf.HRS_TO_KEEP_NEWDEV = ccd('HRS_TO_KEEP_NEWDEV', 0 , c_d, 'Keep new devices for', 'integer', "0", 'General')
|
||||
conf.API_CUSTOM_SQL = ccd('API_CUSTOM_SQL', 'SELECT * FROM Devices WHERE dev_PresentLastScan = 0' , c_d, 'Custom endpoint', 'text', '', 'General')
|
||||
conf.NETWORK_DEVICE_TYPES = ccd('NETWORK_DEVICE_TYPES', ['AP', 'Gateway', 'Firewall', 'Hypervisor', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet'] , c_d, 'Network device types', 'list', '', 'General')
|
||||
conf.LOADED_PLUGINS = ccd('LOADED_PLUGINS', [] , c_d, 'Loaded plugins', '{"dataType":"array", "elements": [{"elementType" : "select", "elementOptions" : [{"multiple":"true"}] ,"transformers": []}]}', '[]', 'General')
|
||||
conf.SCAN_SUBNETS = ccd('SCAN_SUBNETS', ['192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0'] , c_d, 'Subnets to scan', '{"dataType": "array","elements": [ {"elementType": "input","elementOptions": [{ "placeholder": "192.168.1.0/24 --interface=eth1" },{ "suffix": "_in" },{ "cssClasses": "col-sm-10" },{ "prefillValue": "null" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": ["_in"] },{ "separator": "" },{ "cssClasses": "col-xs-12" },{ "onClick": "addList(this, false)" },{ "getStringKey": "Gen_Add" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeAllOptions(this)" },{ "getStringKey": "Gen_Remove_All" }],"transformers": []},{"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeFromList(this)" },{ "getStringKey": "Gen_Remove_Last" }],"transformers": []}, {"elementType": "select","elementOptions": [{ "multiple": "true" },{ "readonly": "true" },{ "editable": "true" }],"transformers": [] }]}', '[]', 'General')
|
||||
conf.LOG_LEVEL = ccd('LOG_LEVEL', 'verbose' , c_d, 'Log verboseness', '{"dataType":"string", "elements": [{"elementType" : "select", "elementOptions" : [] ,"transformers": []}]}', "['none', 'minimal', 'verbose', 'debug', 'trace']", 'General')
|
||||
conf.TIMEZONE = ccd('TIMEZONE', 'Europe/Berlin' , c_d, 'Time zone', '{"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [] ,"transformers": []}]}', '[]', 'General')
|
||||
conf.PLUGINS_KEEP_HIST = ccd('PLUGINS_KEEP_HIST', 250 , c_d, 'Keep history entries', '{"dataType":"integer", "elements": [{"elementType" : "input", "elementOptions" : [{"type": "number"}] ,"transformers": []}]}', '[]', 'General')
|
||||
conf.REPORT_DASHBOARD_URL = ccd('REPORT_DASHBOARD_URL', 'http://netalertx/' , c_d, 'NetAlertX URL', '{"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [] ,"transformers": []}]}', '[]', 'General')
|
||||
conf.DAYS_TO_KEEP_EVENTS = ccd('DAYS_TO_KEEP_EVENTS', 90 , c_d, 'Delete events days', '{"dataType":"integer", "elements": [{"elementType" : "input", "elementOptions" : [{"type": "number"}] ,"transformers": []}]}', '[]', 'General')
|
||||
conf.HRS_TO_KEEP_NEWDEV = ccd('HRS_TO_KEEP_NEWDEV', 0 , c_d, 'Keep new devices for', '{"dataType":"integer", "elements": [{"elementType" : "input", "elementOptions" : [{"type": "number"}] ,"transformers": []}]}', "[]", 'General')
|
||||
conf.API_CUSTOM_SQL = ccd('API_CUSTOM_SQL', 'SELECT * FROM Devices WHERE dev_PresentLastScan = 0' , c_d, 'Custom endpoint', '{"dataType":"string", "elements": [{"elementType" : "input", "elementOptions" : [] ,"transformers": []}]}', '[]', 'General')
|
||||
conf.NETWORK_DEVICE_TYPES = ccd('NETWORK_DEVICE_TYPES', ['AP', 'Gateway', 'Firewall', 'Hypervisor', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet'] , c_d, 'Network device types', '{"dataType": "array","elements": [ {"elementType": "input","elementOptions": [{ "placeholder": "Enter value" },{ "suffix": "_in" },{ "cssClasses": "col-sm-10" },{ "prefillValue": "null" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": ["_in"] },{ "separator": "" },{ "cssClasses": "col-xs-12" },{ "onClick": "addList(this, false)" },{ "getStringKey": "Gen_Add" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeAllOptions(this)" },{ "getStringKey": "Gen_Remove_All" }],"transformers": []},{"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeFromList(this)" },{ "getStringKey": "Gen_Remove_Last" }],"transformers": []}, {"elementType": "select","elementOptions": [{ "multiple": "true" },{ "readonly": "true" },{ "editable": "true" }],"transformers": [] }]}', '[]', 'General')
|
||||
|
||||
# UI
|
||||
conf.UI_LANG = ccd('UI_LANG', 'English' , c_d, 'Language Interface', 'text.select', "['English', 'French', 'German', 'Norwegian', 'Russian', 'Spanish', 'Italian (it_it)', 'Portuguese (pt_br)', 'Polish (pl_pl)', 'Turkish (tr_tr)', 'Chinese (zh_cn)' ]", 'UI')
|
||||
conf.UI_NOT_RANDOM_MAC = ccd('UI_NOT_RANDOM_MAC', [] , c_d, 'Exlude from Random Prefix', 'list', "", 'UI')
|
||||
conf.UI_ICONS = ccd('UI_ICONS', ['PGkgY2xhc3M9ImZhIGZhLWNvbXB1dGVyIj48L2k+', 'PGkgY2xhc3M9ImZhIGZhLWV0aGVybmV0Ij48L2k+', 'PGkgY2xhc3M9ImZhIGZhLWdhbWVwYWQiPjwvaT4', 'PGkgY2xhc3M9ImZhIGZhLWdsb2JlIj48L2k+', 'PGkgY2xhc3M9ImZhIGZhLWxhcHRvcCI+PC9pPg==', 'PGkgY2xhc3M9ImZhIGZhLWxpZ2h0YnVsYiI+PC9pPg==', 'PGkgY2xhc3M9ImZhIGZhLXNoaWVsZCI+PC9pPg==', 'PGkgY2xhc3M9ImZhIGZhLXdpZmkiPjwvaT4'] , c_d, 'Icons', 'list', "", 'UI')
|
||||
conf.UI_REFRESH = ccd('UI_REFRESH', 0 , c_d, 'Refresh interval', 'integer', "", 'UI')
|
||||
conf.UI_DEV_SECTIONS = ccd('UI_DEV_SECTIONS', [] , c_d, 'Show sections', 'text.multiselect', "['Tile Cards', 'Device Presence']", 'UI')
|
||||
conf.UI_PRESENCE = ccd('UI_PRESENCE', ['online', 'offline', 'archived'] , c_d, 'Include in presence', 'text.multiselect', "['online', 'offline', 'archived']", 'UI')
|
||||
conf.UI_MY_DEVICES = ccd('UI_MY_DEVICES', ['online', 'offline', 'archived', 'new', 'down'] , c_d, 'Include in My Devices', 'text.multiselect', "['online', 'offline', 'archived', 'new', 'down']", 'UI')
|
||||
conf.UI_LANG = ccd('UI_LANG', 'English' , c_d, 'Language Interface', '{"dataType":"string", "elements": [{"elementType" : "select", "elementOptions" : [] ,"transformers": []}]}', "['English', 'French', 'German', 'Norwegian', 'Russian', 'Spanish', 'Italian (it_it)', 'Portuguese (pt_br)', 'Polish (pl_pl)', 'Turkish (tr_tr)', 'Chinese (zh_cn)' ]", 'UI')
|
||||
conf.UI_NOT_RANDOM_MAC = ccd('UI_NOT_RANDOM_MAC', [] , c_d, 'Exlude from Random Prefix', '{"dataType": "array","elements": [ {"elementType": "input","elementOptions": [{ "placeholder": "Enter value" },{ "suffix": "_in" },{ "cssClasses": "col-sm-10" },{ "prefillValue": "null" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": ["_in"] },{ "separator": "" },{ "cssClasses": "col-xs-12" },{ "onClick": "addList(this, false)" },{ "getStringKey": "Gen_Add" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeAllOptions(this)" },{ "getStringKey": "Gen_Remove_All" }],"transformers": []},{"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeFromList(this)" },{ "getStringKey": "Gen_Remove_Last" }],"transformers": []}, {"elementType": "select","elementOptions": [{ "multiple": "true" },{ "readonly": "true" },{ "editable": "true" }],"transformers": [] }]}', "[]", 'UI')
|
||||
conf.UI_ICONS = ccd('UI_ICONS', ['PGkgY2xhc3M9ImZhIGZhLWNvbXB1dGVyIj48L2k+', 'PGkgY2xhc3M9ImZhIGZhLWV0aGVybmV0Ij48L2k+', 'PGkgY2xhc3M9ImZhIGZhLWdhbWVwYWQiPjwvaT4', 'PGkgY2xhc3M9ImZhIGZhLWdsb2JlIj48L2k+', 'PGkgY2xhc3M9ImZhIGZhLWxhcHRvcCI+PC9pPg==', 'PGkgY2xhc3M9ImZhIGZhLWxpZ2h0YnVsYiI+PC9pPg==', 'PGkgY2xhc3M9ImZhIGZhLXNoaWVsZCI+PC9pPg==', 'PGkgY2xhc3M9ImZhIGZhLXdpZmkiPjwvaT4'] , c_d, 'Icons', '{"dataType": "array","elements": [ {"elementType": "input","elementOptions": [{ "placeholder": "Enter value" },{ "suffix": "_in" },{ "cssClasses": "col-sm-10" },{ "prefillValue": "null" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": ["_in"] },{ "separator": "" },{ "cssClasses": "col-xs-12" },{ "onClick": "addList(this, false)" },{ "getStringKey": "Gen_Add" }],"transformers": [] }, {"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeAllOptions(this)" },{ "getStringKey": "Gen_Remove_All" }],"transformers": []},{"elementType": "button","elementOptions": [{ "sourceSuffixes": [] },{ "separator": "" },{ "cssClasses": "col-xs-6" },{ "onClick": "removeFromList(this)" },{ "getStringKey": "Gen_Remove_Last" }],"transformers": []}, {"elementType": "select","elementOptions": [{ "multiple": "true" },{ "readonly": "true" },{ "editable": "true" }],"transformers": [] }]}', "[]", 'UI')
|
||||
conf.UI_REFRESH = ccd('UI_REFRESH', 0 , c_d, 'Refresh interval', '{"dataType":"integer", "elements": [{"elementType" : "input", "elementOptions" : [{"type": "number"}] ,"transformers": []}]}', "[]", 'UI')
|
||||
conf.UI_DEV_SECTIONS = ccd('UI_DEV_SECTIONS', [] , c_d, 'Show sections', '{"dataType":"array", "elements": [{"elementType" : "select", "elementOptions" : [{"multiple":"true"}] ,"transformers": []}]}', "['Tile Cards', 'Device Presence']", 'UI')
|
||||
conf.UI_PRESENCE = ccd('UI_PRESENCE', ['online', 'offline', 'archived'] , c_d, 'Include in presence', '{"dataType":"array", "elements": [{"elementType" : "select", "elementOptions" : [{"multiple":"true"}] ,"transformers": []}]}', "['online', 'offline', 'archived']", 'UI')
|
||||
conf.UI_MY_DEVICES = ccd('UI_MY_DEVICES', ['online', 'offline', 'archived', 'new', 'down'] , c_d, 'Include in My Devices', '{"dataType":"array", "elements": [{"elementType" : "select", "elementOptions" : [{"multiple":"true"}] ,"transformers": []}]}', "['online', 'offline', 'archived', 'new', 'down']", 'UI')
|
||||
|
||||
# Init timezone in case it changed
|
||||
conf.tz = timezone(conf.TIMEZONE)
|
||||
@@ -288,7 +288,7 @@ def importConfigs (db, all_plugins):
|
||||
|
||||
|
||||
# save the newly discovered plugins as options and default values
|
||||
conf.LOADED_PLUGINS = ccd('LOADED_PLUGINS', loaded_plugins_prefixes , c_d, 'Loaded plugins', 'text.multiselect', str(sorted(all_plugins_prefixes)), 'General')
|
||||
conf.LOADED_PLUGINS = ccd('LOADED_PLUGINS', loaded_plugins_prefixes , c_d, 'Loaded plugins', '{"dataType":"array", "elements": [{"elementType" : "select", "elementOptions" : [{"multiple":"true"}] ,"transformers": []}]}', str(sorted(all_plugins_prefixes)), 'General')
|
||||
|
||||
mylog('none', ['[Config] Number of Plugins to load: ', len(loaded_plugins_prefixes)])
|
||||
mylog('none', ['[Config] Plugins to load: ', loaded_plugins_prefixes])
|
||||
|
||||
@@ -22,7 +22,7 @@ def timeNowTZ():
|
||||
#-------------------------------------------------------------------------------
|
||||
# More verbose as the numbers go up
|
||||
debugLevels = [
|
||||
('none', 0), ('minimal', 1), ('verbose', 2), ('debug', 3)
|
||||
('none', 0), ('minimal', 1), ('verbose', 2), ('debug', 3), ('trace', 4)
|
||||
]
|
||||
|
||||
currentLevel = 0
|
||||
|
||||
@@ -61,7 +61,7 @@ def process_scan (db):
|
||||
skip_repeated_notifications (db)
|
||||
|
||||
# Clear current scan as processed
|
||||
# TODO comment below for CurrentScan debugging
|
||||
# 🐛 CurrentScan DEBUG: comment out below when debugging to keep the CurrentScan table after restarts/scan finishes
|
||||
db.sql.execute ("DELETE FROM CurrentScan")
|
||||
|
||||
# Commit changes
|
||||
|
||||
@@ -306,7 +306,7 @@ def write_notification(content, level, timestamp):
|
||||
if file_contents == '':
|
||||
file_contents = '[]' # If file is empty, initialize as empty list
|
||||
|
||||
mylog('debug', ['[Notification] User Notifications file: ', file_contents])
|
||||
# mylog('debug', ['[Notification] User Notifications file: ', file_contents])
|
||||
notifications = json.loads(file_contents) # Parse JSON data
|
||||
else:
|
||||
mylog('error', 'File is not of type _io.TextIOWrapper')
|
||||
|
||||
@@ -33,30 +33,30 @@ class plugin_param:
|
||||
setVal = inputValue["Value"] # setting value
|
||||
setTyp = inputValue["Type"] # setting type
|
||||
|
||||
noConversion = ['text', 'string', 'integer', 'boolean', 'password', 'password.SHA256', 'readonly', 'integer.select', 'text.select', 'integer.checkbox' ]
|
||||
arrayConversion = ['text.multiselect', 'list', 'list.select', 'subnets']
|
||||
jsonConversion = ['.template']
|
||||
setTypJSN = json.loads(setTyp.replace('"','\"').replace("'",'"'))
|
||||
|
||||
mylog('debug', f'[Plugins] setTyp: {setTyp}')
|
||||
mylog('debug', f'[Plugins] setTypJSN: {setTypJSN}')
|
||||
|
||||
if '.select' in setTyp or setTyp in arrayConversion:
|
||||
dataType = setTypJSN["dataType"]
|
||||
|
||||
mylog('debug', f'[Plugins] dType: {dataType}')
|
||||
|
||||
|
||||
if dataType == 'array':
|
||||
# store number of returned values
|
||||
paramValuesCount = len(setVal)
|
||||
|
||||
if setTyp in noConversion:
|
||||
if dataType in ['string','integer', 'boolean']:
|
||||
resolved = setVal
|
||||
|
||||
elif setTyp in arrayConversion:
|
||||
elif dataType == 'array':
|
||||
# make them safely passable to a python or linux script
|
||||
resolved = list_to_csv(setVal)
|
||||
|
||||
else:
|
||||
for item in jsonConversion:
|
||||
if setTyp.endswith(item):
|
||||
return json.dumps(setVal)
|
||||
else:
|
||||
mylog('none', ['[Plugins] ⚠ ERROR: Parameter not converted.'])
|
||||
|
||||
mylog('none', ['[Plugins] ⚠ ERROR: Parameter probably not converted.'])
|
||||
return json.dumps(setVal)
|
||||
|
||||
# Get SQL result
|
||||
if param["type"] == "sql":
|
||||
@@ -768,11 +768,9 @@ def check_and_run_user_event(db, all_plugins, pluginsState):
|
||||
# Split the line by '|', and take the third and fourth columns (indices 2 and 3)
|
||||
columns = line.strip().split('|')[2:4]
|
||||
|
||||
if len(columns) != 2:
|
||||
remaining_lines.append(line)
|
||||
continue
|
||||
|
||||
event, param = columns
|
||||
event, param = "", ""
|
||||
if len(columns) == 2:
|
||||
event, param = columns
|
||||
|
||||
if event == 'test':
|
||||
show_events_completed = True
|
||||
|
||||
@@ -172,15 +172,25 @@ def resolve_wildcards_arr(commandArr, params):
|
||||
|
||||
return commandArr
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Function to extract layer number from "execution_order"
|
||||
def get_layer(plugin):
|
||||
order = plugin.get("execution_order", "Layer_N")
|
||||
if order == "Layer_N":
|
||||
return float('inf') # Treat as the last layer if "execution_order" is missing
|
||||
return int(order.split('_')[1])
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def get_plugins_configs():
|
||||
pluginsList = [] # Create an empty list to store plugin configurations
|
||||
pluginsListSorted = [] # Sorted by "execution_order" : "Layer_0" first, Layer_N last
|
||||
|
||||
# Get a list of top-level directories in the specified pluginsPath
|
||||
dirs = next(os.walk(pluginsPath))[1]
|
||||
|
||||
# Sort the directories list if needed
|
||||
dirs.sort() # This will sort the directories alphabetically
|
||||
|
||||
# Loop through each directory (plugin folder) in dirs
|
||||
for d in dirs:
|
||||
# Check if the directory name does not start with "__" to skip python cache
|
||||
@@ -194,7 +204,10 @@ def get_plugins_configs():
|
||||
# Load the contents of the config.json file as a JSON object and append it to pluginsList
|
||||
pluginsList.append(json.loads(get_file_content(config_path)))
|
||||
|
||||
return pluginsList # Return the list of plugin configurations
|
||||
# Sort pluginsList based on "execution_order"
|
||||
pluginsListSorted = sorted(pluginsList, key=get_layer)
|
||||
|
||||
return pluginsListSorted # Return the sorted list of plugin configurations
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user