diff --git a/Dockerfile b/Dockerfile index d0d31873..ec7fb500 100755 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ ENV PATH="/opt/venv/bin:$PATH" COPY . ${INSTALL_DIR}/ -RUN pip install tplink-omada-client pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython \ +RUN pip install netifaces tplink-omada-client pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython \ && bash -c "find ${INSTALL_DIR} -type d -exec chmod 750 {} \;" \ && bash -c "find ${INSTALL_DIR} -type f -exec chmod 640 {} \;" \ && bash -c "find ${INSTALL_DIR} -type f \( -name '*.sh' -o -name '*.py' -o -name 'speedtest-cli' \) -exec chmod 750 {} \;" diff --git a/README.md b/README.md index 87a23b4b..2424f7ef 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# πŸ’»πŸ” Network security scanner & notification framework +# πŸ’»πŸ” Network scanner & notification framework Get visibility of what's going on on your WIFI/LAN network. Schedule scans for devices, port changes and get alerts if unknown devices or changes are found. Write your own [Plugins](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins#readme) with auto-generated UI and in-build notification system. Build out and easily maintain your network source of truth (NSoT). @@ -18,7 +18,7 @@ Get visibility of what's going on on your WIFI/LAN network. Schedule scans for d ![network_setup][network_setup] -Head to [https://netalertx.com/](https://netalertx.com/) for more screenshots. +Head to [https://netalertx.com/](https://netalertx.com/) for more gifs and screenshots πŸ“·.
πŸ“· Click for more screenshots @@ -36,13 +36,13 @@ Head to [https://netalertx.com/](https://netalertx.com/) for more screenshots. Most of us don't know what's going on on our home network, but we want our family and data to be safe. _Command-line tools_ are great, but the output can be _hard to understand_ and action if you are not a network specialist. - Net Alertx gives you peace of mind. _Visualize and immediately report πŸ“¬_ what is going on in your network - this is the first step to enhance your _network security πŸ”_. + NetAlertx gives you peace of mind. _Visualize and immediately report πŸ“¬_ what is going on in your network - this is the first step to enhance your _network security πŸ”_. - Net Alertx combines several network and other scanning tools πŸ” with notifications πŸ“§ into one user-friendly package πŸ“¦. + NetAlertx combines several network and other scanning tools πŸ” with notifications πŸ“§ into one user-friendly package πŸ“¦. Set up a _kill switch ☠_ for your network via a smart plug with the available [Home Assistant](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HOME_ASSISTANT.md) integration. Implement custom automations with the [CSV device Exports πŸ“€](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/csv_backup), [Webhooks](https://github.com/jokob-sk/NetAlertX/blob/main/docs/WEBHOOK_N8N.md), or [API endpoints](https://github.com/jokob-sk/NetAlertX/blob/main/docs/API.md) features. - Extend the app if you want to create your own scanner [Plugin](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins#readme) and handle the results and notifications in Net Alertx. + Extend the app if you want to create your own scanner [Plugin](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins#readme) and handle the results and notifications in NetAlertx. Looking forward to your contributions if you decide to share your work with the community ❀. @@ -96,14 +96,16 @@ Thank you to all the wonderful people who are sponsoring this project. -| [![GitHub](https://i.imgur.com/emsRCPh.png)](https://github.com/sponsors/jokob-sk) | [![Buy Me A Coffee](https://i.imgur.com/pIM6YXL.png)](https://www.buymeacoffee.com/jokobsk) | [![Patreon](https://i.imgur.com/MuYsrq1.png)](https://www.patreon.com/user?u=84385063) | -| --- | --- | --- | +
Click for more ways to donate
+ | [![GitHub](https://i.imgur.com/emsRCPh.png)](https://github.com/sponsors/jokob-sk) | [![Buy Me A Coffee](https://i.imgur.com/pIM6YXL.png)](https://www.buymeacoffee.com/jokobsk) | [![Patreon](https://i.imgur.com/MuYsrq1.png)](https://www.patreon.com/user?u=84385063) | +| --- | --- | --- | + - Bitcoin: `1N8tupjeCK12qRVU2XrV17WvKK7LCawyZM` - Ethereum: `0x6e2749Cb42F4411bc98501406BdcD82244e3f9C7` diff --git a/dockerfiles/README.md b/dockerfiles/README.md index 3b6d639e..2b62085b 100755 --- a/dockerfiles/README.md +++ b/dockerfiles/README.md @@ -4,7 +4,7 @@ ![GitHub Release](https://img.shields.io/github/v/release/jokob-sk/NetAlertX?color=0aa8d2&logoColor=fff&logo=GitHub) [![GitHub Sponsors](https://img.shields.io/github/sponsors/jokob-sk?style=social)](https://github.com/sponsors/jokob-sk) -# NetAlertX πŸ’»πŸ” Network security scanner & notification framework +# NetAlertX πŸ’»πŸ” Network scanner & notification framework | 🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/netalertx) | πŸ“‘ [Docker guide](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md) |πŸ†• [Release notes](https://github.com/jokob-sk/NetAlertX/releases) | πŸ“š [All Docs](https://github.com/jokob-sk/NetAlertX/tree/main/docs) | |----------------------|----------------------| ----------------------| ----------------------| @@ -13,6 +13,8 @@ +Head to [https://netalertx.com/](https://netalertx.com/) for more gifs and screenshots πŸ“·. + > [!NOTE] > There is also an experimental πŸ§ͺ [bare-metal install](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md) method available. diff --git a/front/php/templates/auth.php b/front/php/templates/auth.php new file mode 100755 index 00000000..b9993c78 --- /dev/null +++ b/front/php/templates/auth.php @@ -0,0 +1,35 @@ + diff --git a/front/plugins/__template/config.json b/front/plugins/__template/config.json index 8f6aa5c4..a7466e9d 100755 --- a/front/plugins/__template/config.json +++ b/front/plugins/__template/config.json @@ -1,9 +1,9 @@ { "code_name": "folder_name", "unique_prefix": "", - "plugin_type": "core|general|system|scanner|other|publisher", + "plugin_type": "scanner", "enabled": true, - "data_source": "script|app-db-query|template|sqlite-db-query", + "data_source": "script", "mapped_to_table": "CurrentScan", "data_filters": [ { @@ -122,6 +122,25 @@ } ] }, + { + "function": "list_example", + "type": "list", + "default_value": ["existing_entry_1", "existing_entry_2"], + "options": [], + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Setting name" + } + ], + "description": [ + { + "language_code": "en_us", + "string": "Description / simple setup instructions" + } + ] + }, { "function": "multiselect_example_from_setting", "type": "text.multiselect", @@ -255,7 +274,7 @@ }, { "column": "Watched_Value3", - "mapped_to_column": "cur_SyncHubNodeName", + "mapped_to_column": "cur_Type", "css_classes": "col-sm-2", "show": true, "type": "label", @@ -265,14 +284,14 @@ "name": [ { "language_code": "en_us", - "string": "Sync Node" + "string": "Device Type" } ] }, { "column": "Watched_Value4", "css_classes": "col-sm-2", - "show": true, + "show": false, "type": "label", "default_value": "", "options": [], @@ -280,7 +299,7 @@ "name": [ { "language_code": "en_us", - "string": "Device GUID" + "string": "N/A" } ] }, @@ -288,7 +307,7 @@ "column": "Dummy", "mapped_to_column": "cur_ScanMethod", "mapped_to_column_data": { - "value": "sync" + "value": "Example Plugin" }, "css_classes": "col-sm-2", "show": true, diff --git a/front/plugins/__template/rename_me.py b/front/plugins/__template/rename_me.py index 05e52dd8..1256f9d4 100755 --- a/front/plugins/__template/rename_me.py +++ b/front/plugins/__template/rename_me.py @@ -6,7 +6,6 @@ import sys import json import sqlite3 - # 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"]) @@ -47,18 +46,18 @@ def main(): #"database_column_definitions": [ # { # "column": "Object_PrimaryID", <--------- the value I save into primaryId - # "mapped_to_column": "cur_MAC", <--------- gets unserted into the CurrentScan DB table column cur_MAC + # "mapped_to_column": "cur_MAC", <--------- gets inserted into the CurrentScan DB table column cur_MAC # for device in device_data: plugin_objects.add_object( - primaryId = device['some_id'], - secondaryId = device['some_id'], - watched1 = device['some_id'], - watched2 = device['some_id'], - watched3 = device['some_id'], - watched4 = device['some_id'], + primaryId = device['mac_address'], + secondaryId = device['ip_address'], + watched1 = device['hostname'], + watched2 = device['vendor'], + watched3 = device['device_type'], + watched4 = device['last_seen'], extra = '', - foreignKey = device['some_id']) + foreignKey = device['mac_address']) mylog('verbose', [f'[{pluginName}] New entries: "{len(new_devices)}"']) @@ -75,7 +74,34 @@ def get_device_data(some_setting): # do some processing, call exteranl APIs, and return a device_data list # ... # + # Sample data for testing purposes, you can adjust the processing in main() as needed + # ... before adding it to the plugin_objects.add_object(...) + device_data = [ + { + 'device_id': 'device1', + 'mac_address': '00:11:22:33:44:55', + 'ip_address': '192.168.1.2', + 'hostname': 'iPhone 12', + 'vendor': 'Apple Inc.', + 'device_type': 'Smartphone', + 'last_seen': '2024-06-27 10:00:00', + 'port': '1', + 'network_id': 'network1' + }, + { + 'device_id': 'device2', + 'mac_address': '00:11:22:33:44:66', + 'ip_address': '192.168.1.3', + 'hostname': 'Moto G82', + 'vendor': 'Motorola Inc.', + 'device_type': 'Laptop', + 'last_seen': '2024-06-27 10:05:00', + 'port': '', + 'network_id': 'network1' + } + ] + # Return the data to be detected by teh main application return device_data if __name__ == '__main__': diff --git a/front/plugins/omada_sdn_imp/config.json b/front/plugins/omada_sdn_imp/config.json index 2dd9714e..d6f87225 100755 --- a/front/plugins/omada_sdn_imp/config.json +++ b/front/plugins/omada_sdn_imp/config.json @@ -119,22 +119,21 @@ ] }, { - "function": "site", - "type": "text", - "maxLength": 50, - "default_value": "", + "function": "sites", + "type": "list", + "default_value": [], "options": [], "localized": ["name", "description"], "name": [ { "language_code": "en_us", - "string": "OMADA site" + "string": "OMADA sites" } ], "description": [ { "language_code": "en_us", - "string": "Omada SDN site id. You can get it by..." + "string": "Omada SDN site IDs. You can get it by..." } ] }, @@ -178,6 +177,25 @@ } ] }, + { + "function": "force_overwrite", + "type": "boolean", + "default_value": false, + "options": [], + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Force overwrite" + } + ], + "description": [ + { + "language_code": "en_us", + "string": "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", @@ -247,6 +265,58 @@ "string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen." } ] + }, + { + "default_value": [], + "description": [ + { + "language_code": "en_us", + "string": "Send a notification if selected values change. Use CTRL + Click to select/deselect. " + } + ], + "function": "WATCH", + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Watched" + }, + { + "language_code": "es_es", + "string": "Visto" + } + ], + "options": [ + "Watched_Value1", + "Watched_Value2", + "Watched_Value3", + "Watched_Value4" + ], + "type": "text.multiselect" + }, + { + "default_value": ["new", "watched-changed"], + "description": [ + { + "language_code": "en_us", + "string": "Send a notification only on these statuses. new means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. watched-changed means that selected Watched_ValueN columns changed." + } + ], + "function": "REPORT_ON", + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Report on" + } + ], + "options": [ + "new", + "watched-changed", + "watched-not-changed", + "missing-in-last-scan" + ], + "type": "text.multiselect" } ], "database_column_definitions": [ diff --git a/front/report.php b/front/report.php index 2a838311..11db9f3b 100755 --- a/front/report.php +++ b/front/report.php @@ -85,8 +85,8 @@