jokob-sk / NetAlertX

🖧🔍 WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found.
GNU General Public License v3.0
3.15k stars 186 forks source link

Notification about it having been updated constantly re-appears #791

Closed thefunkygibbon closed 2 months ago

thefunkygibbon commented 2 months ago

Is there an existing issue for this?

Current Behavior

Clicking on ok on the notification image it just re-appears after a short few seconds.
I've obviously done what it suggests and even tried opening it in a new browser which i've never used netalertx on before.

any ideas how to suppress it?

Expected Behavior

click ok. it goes away

Steps To Reproduce

already said

app.conf

can provide if its really needed

docker-compose.yml

can provide if its really needed

What branch are you running?

Production

app.log

can provide if its really needed

Debug enabled

jokob-sk commented 2 months ago

Thank you for the report.

Could you please try to:

If the pop up still appear can double check if the app is not restarting unexpectedly?

Can you please try to save settings to see if it disappears afterwards?

Dan-Sun commented 2 months ago

@jokob-sk
I had the same issue. This way as you mentioned works on this end.

jokob-sk commented 2 months ago

@Dan-Sun thanks for the confirmation - I will add those steps into the message as well for clarity

thefunkygibbon commented 2 months ago

not sure how it worked for @Dan-Sun , but as i said in my post, I've done all that, I've just tried on a completely different computer where I have never used it before and it still continuously pops up. used, linux, windows, chrome, opera, firefox now.

just tried to save the settings again but it makes no difference. and no its not restarting.

franbri commented 2 months ago

I have the same issue in the last update, i can fix it temporally going to notifications and marking all the interrupt level notifications in that page, but it only works until the next network scan is triggered.

Edit: after reading the app logs, the backend crashes, but the container no, so the backend is started again.

Edit 2: adding python error log

Pi.Alert  | 17:46:05 [API] Updating table_appevents.json file in /front/api
Pi.Alert  | 17:46:05 [API] Updating table_plugins_history.json file in /front/api
Pi.Alert  | Traceback (most recent call last):
Pi.Alert  |   File "<frozen runpy>", line 198, in _run_module_as_main
Pi.Alert  |   File "<frozen runpy>", line 88, in _run_code
Pi.Alert  |   File "/app/server/__main__.py", line 209, in <module>
Pi.Alert  |     sys.exit(main())
Pi.Alert  |              ^^^^^^
Pi.Alert  |   File "/app/server/__main__.py", line 139, in main
Pi.Alert  |     process_scan(db)
Pi.Alert  |   File "/app/server/networkscan.py", line 41, in process_scan
Pi.Alert  |     update_devices_data_from_scan (db)
Pi.Alert  |   File "/app/server/device.py", line 444, in update_devices_data_from_scan
Pi.Alert  |     dev_DeviceType = guess_type(device['dev_Vendor'], device['dev_MAC'], device['dev_LastIP'], device['dev_Name'], default_type)
Pi.Alert  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pi.Alert  |   File "/app/server/device.py", line 696, in guess_type
Pi.Alert  |     vendor = vendor.lower()
Pi.Alert  |              ^^^^^^^^^^^^
Pi.Alert  | AttributeError: 'NoneType' object has no attribute 'lower'
Pi.Alert  | 17:46:05 [Plugin utils] ---------------------------------------------
Pi.Alert  | 17:46:05 [Plugin utils] display_name: Internet-Check
jokob-sk commented 2 months ago

@franbri Thanks for the log, this helps! I just pushed some safety checks in that piece of code and the fix should be available in the netalertx-dev image in about 15 min from now. You can switch to it to test it. Hope this will fix the issue on your setup 🤞

@thefunkygibbon I think there is restart for you happening or some error might be logged in the logs for your instance as well. Can you check the log to see if there are any errors?

The1Waterman commented 2 months ago

Sampe issue, I have the following error apperaing:

09:58:51 [Plugin utils] display_name: Un-Discoverable Devices 09:58:51 [Plugin utils] description: This plugin is to import undiscoverable devices from a file. 09:58:51 [Plugin utils] --------------------------------------------- Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/app/server/main.py", line 209, in sys.exit(main())
^^^^^^ File "/app/server/main.py", line 105, in main pluginsState = check_and_run_user_event(db, all_plugins, pluginsState) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/server/plugin.py", line 856, in check_and_run_user_event pluginsState = handle_run(param, db, all_plugins, pluginsState) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/server/plugin.py", line 885, in handle_run pluginsState = execute_plugin(db, all_plugins, plugin, pluginsState) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/server/plugin.py", line 182, in execute_plugin tempParam = plugin_param(param, plugin, db) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/server/plugin.py", line 87, in init resolved = str(base64.b64encode(resolved.encode('ascii'))) ^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 87: ordinal not in range(128) 09:58:51 [Plugin utils] display_name: Vendor update 09:58:51 [Plugin utils] description: A plugin to schedule vendor database updates for mac based vendor resolution.

jokob-sk commented 2 months ago

@The1Waterman Can you please post the value of the UNDIS_devices_to_import setting? It might contain an non-ASCII character. From the looks of it it might be an em dash (—) - try to replace it with a hyphen (-).

Edit: I also updated the description of the setting to: "This plugin is to import undiscoverable devices from a file. Only ASCII characters are supported."

The1Waterman commented 2 months ago

Thanks, I'm struggling to find this setting, I assume you are talking from the web browers debugger, ie F12 in chrome ?

On Mon, Sep 16, 2024 at 1:59 PM jokob-sk @.***> wrote:

@The1Waterman https://github.com/The1Waterman Can you please post the value of the UNDIS_devices_to_import setting? It might contain an non-ASCII character. From the looks of it it might be an em dash (—) - try to replace it with a hyphen (-).

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/NetAlertX/issues/791#issuecomment-2351909138, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGL5B4ZIZNCCYTCW7QKIY6LZWY3OVAVCNFSM6AAAAABOE4WIUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRHEYDSMJTHA . You are receiving this because you were mentioned.Message ID: @.***>

jokob-sk commented 2 months ago

Hi @The1Waterman,

You should be able to search for it in the Settings page in NAX, otherwise you should be able to find it under " Device scanners " -> "Un-Discoverable Devices" -> "UnDiscoverable Devices".

itsmemac commented 2 months ago

Tried above mentioned fixes, still can't get into the page same popup no errors in container log image

itsmemac commented 2 months ago

Switching to dev image doesn't show any devices and just the popup shows now and then image

jokob-sk commented 2 months ago

Hi @itsmemac,

Can you please post your app.log after enabling debug?

thefunkygibbon commented 2 months ago

@thefunkygibbon I think there is restart for you happening or some error might be logged in the logs for your instance as well. Can you check the log to see if there are any errors?

I see nothing in my docker logs which indicate any kind of restarting of the container or crashing. I cannot access the netalert logs as I don't seem to have a log file contained within the persistent storage folders.

the only thing i see in my docker logs show the following

09:30:36 [Config] Number of Plugins to load: 18 09:30:36 [Config] Plugins to load: ['OMDSDN', 'ARPSCAN', 'PIHOLE', 'INTRNT', 'NMAP', 'NSLOOKUP', 'SMTP', 'CSVBCKP', 'DBCLNP', 'MAINT', 'NEWDEV', 'NTFPRCS', 'PHOLUS', 'SETPWD', 'SYNC', 'UI', 'VNDRPDT', 'WORKFLOWS'] Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/app/server/__main__.py", line 209, in <module> sys.exit(main()) ^^^^^^ File "/app/server/__main__.py", line 139, in main process_scan(db) File "/app/server/networkscan.py", line 41, in process_scan update_devices_data_from_scan (db) File "/app/server/device.py", line 428, in update_devices_data_from_scan dev_Icon = guess_icon(device['dev_Vendor'], device['dev_MAC'], device['dev_LastIP'], device['dev_Name'], default_icon) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/server/device.py", line 640, in guess_icon vendor = vendor.lower() ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'lower' 09:30:36 [API] Updating table_settings.json file in /front/api 09:30:36 [Config] Imported new config

:edit: actually there is this but gives zero clue as to whats causing it..

`09:30:34 [Process Scan] Updating Devices Info [INSTALL] 🚀 Starting app (:20211)

08:30:35 [MAIN] Setting up ... 08:30:35 [conf.tz] Setting up ... 

08:30:35 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 

08:30:35 Permissions check (All should be True)`

thefunkygibbon commented 2 months ago

also netalertx:/app/front/log# tail -10000 app.log | grep restarted 06:50:48 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 06:56:15 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:00:42 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:06:08 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:10:34 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:16:02 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:20:26 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:25:53 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:30:20 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:35:47 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:41:13 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:45:39 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:51:04 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 07:55:28 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:00:57 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:05:22 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:10:48 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:16:15 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:20:40 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:26:08 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:30:35 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:36:02 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:40:29 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:45:57 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. 08:50:23 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. netalertx:/app/front/log#

thefunkygibbon commented 2 months ago

but , if those events don't seem to tie in to me testing the popup notification. and i can refresh the page multiple times and it doesn't "restart"

itsmemac commented 2 months ago

Hi @itsmemac,

Can you please post your app.log after enabling debug?

Now it wierdly seems to work but the popup keeps popping up now and then only errors in app.log

Traceback (most recent call last): File "/app/front/plugins/pholus_scan/pholus/pholus3.py", line 1190, in main() File "/app/front/plugins/pholus_scan/pholus/pholus3.py", line 1060, in main ipn = ipaddress.ip_network(values.rdns_scanning) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/ipaddress.py", line 74, in ip_network return IPv4Network(address, strict) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/ipaddress.py", line 1544, in init raise ValueError('%s has host bits set' % self) ValueError: 192.168.0.1/24 has host bits set

16:10:07 [PHOLUS] ⚠ ERROR - Pholus Scan - check logs 16:10:07 [PHOLUS] Scan: Pholus FAIL - check logs

jokob-sk commented 2 months ago

@thefunkygibbon

I see nothing in my docker logs which indicate any kind of restarting of the container or crashing. I cannot access the netalert logs as I don't seem to have a log file contained within the persistent storage folders.

the only thing i see in my docker logs show the following

09:30:36 [Config] Number of Plugins to load: 18 09:30:36 [Config] Plugins to load: ['OMDSDN', 'ARPSCAN', 'PIHOLE', 'INTRNT', 'NMAP', 'NSLOOKUP', 'SMTP', 'CSVBCKP', 'DBCLNP', 'MAINT', 'NEWDEV', 'NTFPRCS', 'PHOLUS', 'SETPWD', 'SYNC', 'UI', 'VNDRPDT', 'WORKFLOWS'] Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/app/server/__main__.py", line 209, in <module> sys.exit(main()) ^^^^^^ File "/app/server/__main__.py", line 139, in main process_scan(db) File "/app/server/networkscan.py", line 41, in process_scan update_devices_data_from_scan (db) File "/app/server/device.py", line 428, in update_devices_data_from_scan dev_Icon = guess_icon(device['dev_Vendor'], device['dev_MAC'], device['dev_LastIP'], device['dev_Name'], default_icon) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/server/device.py", line 640, in guess_icon vendor = vendor.lower() ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'lower' 09:30:36 [API] Updating table_settings.json file in /front/api 09:30:36 [Config] Imported new config

:edit: actually there is this but gives zero clue as to whats causing it..

`09:30:34 [Process Scan] Updating Devices Info [INSTALL] 🚀 Starting app (:20211)

08:30:35 [MAIN] Setting up ... 08:30:35 [conf.tz] Setting up ... �

08:30:35 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips. �

08:30:35 Permissions check (All should be True)`

This seems to be the same issue @franbri was experiencing. I pushed a fix in the netalertx-dev image. Can you try to switch over after creating backups of your setup? (backup at least the app.conf and devices.csv files)

jokob-sk commented 2 months ago

@itsmemac I just pushed a fix for this to the netalertx-dev image. Can you try to switch over in about 15 minutes after the above build finishes - after creating backups of your setup? (backup at least the app.conf and devices.csv files)

BambamNZ commented 2 months ago

@jokob-sk just deployed the dev image as new container from a backup and it is working as expected, the pop-up showed up once, cleared cache and refreshed and pop-up did not return.

BambamNZ commented 2 months ago

@jokob-sk just deployed the dev image as new container from a backup and it is working as expected, the pop-up showed up once, cleared cache and refreshed and pop-up did not return.

Mmmh may have said it is solved a bit quickly, closing and opening the browser / window and the pop-up re-appears

image

With this log entry

16:01:10 The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips.

thefunkygibbon commented 2 months ago

just installed dev, been running for half hour now and the pop up has not occurred and i've not seen the restarting in the logs since either. so looks positive, but will keep checking over the next day or so.

thanks.

let me know when i should pop back to the maintrain release code.

jokob-sk commented 2 months ago

@thefunkygibbon glad to hear that - I might push out a hotfix over the weekend - let's see

@BambamNZ Can you post the app.log error that is shown before the restart? You might need to check the docker logs (e.g. via Portainer)

BambamNZ commented 2 months ago

@thefunkygibbon glad to hear that - I might push out a hotfix over the weekend - let's see

@BambamNZ Can you post the app.log error that is shown before the restart? You might need to check the docker logs (e.g. via Portainer)

@jokob-sk

Couple of lines earlier are these error messages

15:31:01 [Plugin utils] display_name: Un-Discoverable Devices 15:31:01 [Plugin utils] description: This plugin is to import undiscoverable devices from a file. 15:31:01 [Plugin utils] --------------------------------------------- Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/app/server/main.py", line 209, in sys.exit(main())
^^^^^^ File "/app/server/main.py", line 139, in main process_scan(db) File "/app/server/networkscan.py", line 37, in process_scan create_new_devices (db) File "/app/server/device.py", line 252, in create_new_devices sql.execute(sqlQuery, (startTime, startTime)) sqlite3.OperationalError: near "L": syntax error 15:31:01 [Plugin utils] display_name: Vendor update 15:31:01 [Plugin utils] description: A plugin to schedule vendor database updates for mac based vendor resolution. 15:31:01 [Plugin utils] --------------------------------------------- 15:31:01 [Plugin utils] display_name: Website monitor 15:31:01 [Plugin utils] description: This plugin is to monitor status changes of services or websites. 15:31:01 [Plugin utils] --------------------------------------------- 15:31:01 [Plugin utils] display_name: Workflows 15:31:01 [Plugin utils] description: A plugin to adjust behavior of workflows.

I have loaded the latest Dev image since and prompted me once again to Clear Cache etc. and has been stable since then

thefunkygibbon commented 2 months ago

i wanted to make a change to the settings and it no longer seems to want to save/apply them now!?

ie i make a change.. click save , nothing happens. if i try to refresh or go to a different page then i just get a popup saying that i will lose my changes if i do.

jokob-sk commented 2 months ago

@thefunkygibbon

Could you please check you are using the latest - dev image? I was debugging an issue and forgot to remove a return statement earlier today, but it should be working on the latest build.

Sorry for the inconvenience, J

thefunkygibbon commented 2 months ago

no worries, I think i noticed it updating overnight on my watchtower... but i'll re-pull it now

thefunkygibbon commented 2 months ago

yep that works now. cheers. no need to apologise :-)

jokob-sk commented 2 months ago

@BambamNZ hummm, the error message is interesting. There might be a character passed to a sql query breaking it. Can you please try to enable debug or trace and post the log if there's more useful information? Please disable trace shortly after as it produces big log files.

Thanks for the help in advance, J

jokob-sk commented 2 months ago

@thefunkygibbon glad to hear that 🙂

thefunkygibbon commented 2 months ago

ok for some reason i've lost all of my "offline" devices which i previously had in there. not sure if its anything to do with this dev update?

or could it be to do with changing the option of "Keep new devices for" (changed from 0 to 168). I figured it was the option which automatically de-tags it as being "new" (couldn't see any other option which appeared to do that). Am i going mad? (sorry to keep it in this post, I did put about it in the "discussions" page but didn't get a response.

BambamNZ commented 2 months ago

@BambamNZ hummm, the error message is interesting. There might be a character passed to a sql query breaking it. Can you please try to enable debug or trace and post the log if there's more useful information? Please disable trace shortly after as it produces big log files.

Thanks for the help in advance, J

Hey @jokob-sk

I've been unable to replicate the error messages at this point, if I see it again will update.

ca1986 commented 2 months ago

The same popup issue as described above is happening to me regardless of emptying the cache, refreshing, different browser, different computer etc. The application is essentially unusable.

jokob-sk commented 2 months ago

Hi @ca1986,

As per the previous messages, can you please check and post the app.log to see if the app restarts? The backed is probably in a restart loop.

Thanks in advance, J

jokob-sk commented 2 months ago

Thanks for the report and help everyone - the underlying issues from this thread should be fixed in the latest release in ~15 min from now -> Closing

thefunkygibbon commented 2 months ago

FYI i've just checked again this morning and i'm getting the same issue. (still on dev channel)

jokob-sk commented 2 months ago

@thefunkygibbon could you please open a new issue with the necessary details to debug your problem further?

jokob-sk commented 2 months ago

Locking this as the reappearing notification is a symptom only. If you experience it, please check your log. Likely the application is restarting in the background. Open a new issue so that I can help you to resolve the problem.