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
2.84k stars 163 forks source link

Devices table broke #148

Closed WAdama closed 1 year ago

WAdama commented 1 year ago

The devices table view is broke after update to 23.01.22: pialert1 pialert2


[2023-01-22 12:00:18] Process: Start
[2023-01-22 12:00:18] Process: Wait

 Permissions check (All should be True)
------------------------------------------------
  /config/pialert.conf |  READ  | True
  /config/pialert.conf |  WRITE | True
  /db/pialert.db       |  READ  | True
  /db/pialert.db       |  WRITE | True
------------------------------------------------
[Setup] Attempting to fix permissions.
[Setup] Attempting to fix permissions.
[upgradeDB] Adding dev_Icon to the Devices table
[upgradeDB] Re-creating Settings table
[2023-01-22 12:00:41] Config: Imported new config
[2023-01-22 12:00:41] Process: Start
[2023-01-22 12:00:40] Check Internet IP:
    Retrieving Internet IP:
      31.18.167.174
    Retrieving previous IP:
      31.18.167.174
    No changes to perform
    Skipping Dynamic DNS update
[2023-01-22 12:00:41] Scan: Pholus for 600s (10.0min)
        Pholus scan on [interface] bond0 [mask] 192.168.181.0/24
[2023-01-22 12:10:43] Scan: Pholus SUCCESS
[2023-01-22 12:00:40] Scan Devices:
    arp-scan start
  Processing scan results
    Devices Detected.......: 16
        arp-scan detected..: 14
        Pi-hole detected...: +0
        New Devices........: 0
    Devices in this cycle..: 16
        Down Alerts........: 0
        New Down Alerts....: 0
        New Connections....: 1
        Disconnections.....: 1
        IP Changes.........: 0
  Updating DB Info
    Sessions Events (connect / discconnect)
    Creating new devices
    Updating Devices Info
    Voiding false (ghost) disconnections
    Pairing session events (connection / disconnection) 
    Creating sessions snapshot
    Inserting scan results into Online_History
    Skipping repeated notifications
  Check if something to report
    No changes to report
    Notifications: 2
[2023-01-22 12:00:40] Upkeep Database:
    Online_History: Delete all older than 1 day
    Optimize Database
    Events: Delete all older than 90 days
    Pholus_Scan: Delete all older than 7 days
    Pholus_Scan: Delete all duplicates
    Nmap_Scan: Delete all duplicates
    Shrink Database
[2023-01-22 12:10:55] Last action: cleanup
[2023-01-22 12:10:55] Process: Wait

#-----------------AUTOGENERATED FILE-----------------#
#                                                    #
#         Generated:  2023-01-15_12-32-18            #
#                                                    #
#   Config file for the LAN intruder detection app:  #
#      https://github.com/jokob-sk/Pi.Alert          #
#                                                    #
#-----------------AUTOGENERATED FILE-----------------#

# General
#---------------------------
ENABLE_ARPSCAN=True
SCAN_SUBNETS=['192.168.xxx.0/24 --interface=bond0']
PRINT_LOG=False
TIMEZONE='Europe/Berlin'
PIALERT_WEB_PROTECTION=True
PIALERT_WEB_PASSWORD='pw'
INCLUDED_SECTIONS=['internet','new_devices','down_devices']
SCAN_CYCLE_MINUTES=5
DAYS_TO_KEEP_EVENTS=90
REPORT_DASHBOARD_URL='http://pi.alert/'
DIG_GET_IP_ARG='-4 myip.opendns.com @resolver1.opendns.com'

# Email
#---------------------------
REPORT_MAIL=True
SMTP_SERVER='smtp.strato.de'
SMTP_PORT=587
REPORT_TO='mymail'
REPORT_FROM='Pi.Alert <mymail>'
SMTP_SKIP_LOGIN=False
SMTP_USER='myuser'
SMTP_PASS='pw'
SMTP_SKIP_TLS=False

# Webhooks
#---------------------------
REPORT_WEBHOOK=False
WEBHOOK_URL='http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
WEBHOOK_PAYLOAD='json'
WEBHOOK_REQUEST_METHOD='GET'

# Apprise
#---------------------------
REPORT_APPRISE=False
APPRISE_HOST='http://localhost:8000/notify'
APPRISE_URL='mailto://smtp-relay.sendinblue.com:587?from=user@gmail.com&name=apprise&user=user@gmail.com&pass=password&to=user@gmail.com'

# NTFY
#---------------------------
REPORT_NTFY=False
NTFY_HOST='https://ntfy.sh'
NTFY_TOPIC='replace_my_secure_topicname_91h889f28'
NTFY_USER='user'
NTFY_PASSWORD='passw0rd'

# PUSHSAFER
#---------------------------
REPORT_PUSHSAFER=False
PUSHSAFER_TOKEN='ApiKey'

# MQTT
#---------------------------
REPORT_MQTT=False
MQTT_BROKER='192.168.1.2'
MQTT_PORT=1883
MQTT_USER='mqtt'
MQTT_PASSWORD='passw0rd'
MQTT_QOS=0
MQTT_DELAY_SEC=2

# DynDNS
#---------------------------
DDNS_ACTIVE=False
DDNS_DOMAIN='your_domain.freeddns.org'
DDNS_USER='dynu_user'
DDNS_PASSWORD='A0000000B0000000C0000000D0000000'
DDNS_UPDATE_URL='https://api.dynu.com/nic/update?'

# PiHole
#---------------------------
PIHOLE_ACTIVE=False
DHCP_ACTIVE=False

# Pholus
#---------------------------
PHOLUS_ACTIVE=False
PHOLUS_TIMEOUT=20
PHOLUS_FORCE=False
PHOLUS_RUN='once'
PHOLUS_RUN_TIMEOUT=600
PHOLUS_RUN_SCHD='0 4 * * *'
PHOLUS_DAYS_DATA=7

# Nmap
#---------------------------
NMAP_ACTIVE=True
NMAP_TIMEOUT=150
NMAP_RUN='none'
NMAP_RUN_SCHD='0 2 * * *'
NMAP_ARGS='-p -10000'

#-------------------IMPORTANT INFO-------------------#
#   This file is ingested by a python script, so if  #
#        modified it needs to use python syntax      #
#-------------------IMPORTANT INFO-------------------#

docker-compose.yml


version: '3'

services:
  pihole:
    container_name: PiAlert
    image: jokobsk/pi.alert:latest
    network_mode: "host"
    restart: unless-stopped
    environment:
      - "TZ=Europe/Berlin"
      - "USER_GID=xxx"
      - "USER_ID=xxxx"
      - "PORT=20211"
    volumes:
      - /volume1/docker/pialert/db:/home/pi/pialert/db
      - /volume1/docker/pialert/config:/home/pi/pialert/config
      - /volume1/docker/pialert/log:/home/pi/pialert/front/log
corasaniti commented 1 year ago

@WAdama Hi, I have similar issue https://github.com/jokob-sk/Pi.Alert/issues/147

WAdama commented 1 year ago

Also it seems I can't no longer save the settings...

WAdama commented 1 year ago

I just created for test a new container, the error is the same...

Going back to last version makes it working again.

jokob-sk commented 1 year ago

Hey, thanks for the report, can you try saving this setting?

image

jokob-sk commented 1 year ago

Building a new image where this should be fixed. Image will be live after this workflow finishes: https://github.com/jokob-sk/Pi.Alert/actions/runs/3979834409

corasaniti commented 1 year ago

@jokob-sk Thanks

WAdama commented 1 year ago

Thanks, too...

I ment the save button in settings, by the way...

WAdama commented 1 year ago

I just loaded the new image, the table problem seems to be solved.

But I have the feeling, there are much more problems.

Opening device from device list brings this: pialert3

Network looks like this: pialert4

And if I opened a device over the presence list there seems information missing: pialert5

Another thing: It seems that after stopping the container the database is not correctly closed. Normally when a sqlite database is closed the db-shm and db-wal files are merged into the db file, if I remember correct.

ToqQrrl commented 1 year ago

I'm on the latest version and i unfortunately have the same behavior as WAdama.

jokob-sk commented 1 year ago

Thanks for reporting and patience! These issues should be fixed in the latest build - get the latest image after this build finishes: https://github.com/jokob-sk/Pi.Alert/actions/runs/3986226783

corasaniti commented 1 year ago

Thanks, I will try the new release

corasaniti commented 1 year ago

@jokob-sk

Thanks everything works fine What are columns

Last IP Order
Row ID
MAC parent nodes

The real MAC of the device is Full MAC what's the difference with the MAC parent nodes? Thanks in advance PC

WAdama commented 1 year ago

@jokob-sk Just tested it, too...

I can second it, it works again. The network map is real nice feature.

Thanks again for the support...

corasaniti commented 1 year ago

@jokob-sk Just tested it, too...

I can second it, it works again. The network map is real nice feature.

Thanks again for the support... I can't see my network map. Here's what I see... Cattura

jokob-sk commented 1 year ago

@WAdama Glad you like it, it took a lot of work and effort > that's why there were so many bugs ;)

@corasaniti You need to assign devices to the node. Two ways how to do this:

1) in the Device Details > you can assign an End device (e.g. PC) to a Network -> node (e.g. WiFi).

image

2) Directly in the Network tab with the Assign/Unassign buttons.

image

More info the FAQ section under What means " Node (MAC)" / " Port"? and Network > What is this page for?

Info to the columns:

corasaniti commented 1 year ago

@jokob-sk Thank you so much for your suggestions, but still I can't see my network map. Maybe I'm doing something wrong.

Here is my network below. My router Fritz7590 which has DHCP server enabled has an IP 192.168.2.1. I assigned the various devices as you can see from the screen but the map does not appear. I can only view the node of my Internet Provider

Thanks again

Cattura1

Cattura2

jokob-sk commented 1 year ago

@corasaniti The root mac needs to be "Internet"(Other mac addresses are NOT supported as a root node). You then need to connect other devices to that root node, for example:

image

Detailed config for Android-2 :

image

corasaniti commented 1 year ago

@jokob-sk Hi Unfortunately in the device details I don't see the Internet node but only the node of my Fritz router and I can't assign the Internet node to the devices. What am I doing wrong? Thanks again Cattura

jokob-sk commented 1 year ago

Go to your device Fritz7590 and make sure the MAC is Internet on that device

jokob-sk commented 1 year ago

I also wrote up a detailed guide: https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md

corasaniti commented 1 year ago

@jokob-sk I think I don't understand. I simply have an ONT--->RouterFritz7590 with DHCP server enabled and all devices are connected to the Fritz7590 via cable or Wifi... Thanks

corasaniti commented 1 year ago

@jokob-sk This is ma network map setting... (the MAC AABBCCDD1122 is a fake for example) Cattura1 Cattura2

jokob-sk commented 1 year ago

This needs to be Internet: image

Please thoroughly read the guide here: https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md

corasaniti commented 1 year ago

how do i open other tabs when assigning devices. I only see fritz tab Cattura

jokob-sk commented 1 year ago

Please thoroughly read the guide here: https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md

corasaniti commented 1 year ago

As I already said in the detail of the device in the Node Mac combo I can only see my Fritz and not the Internet node. Thanks 214253206-6906fe43-a760-499d-83aa-d2ee2bda996c

jokob-sk commented 1 year ago

As already said, it's described in the guide https://github.com/jokob-sk/Pi.Alert/blob/main/docs/NETWORK_TREE.md


    In the (2) Details tab navigate to the the Type (3) dropdown and select the type Switch (4).

    Note: Only the following device types will show up as selectable Network nodes ( = devices you can connect other devices to): AP, Firewall, Gateway, PLC, Powerline, Router, Switch, USB LAN Adapter, USB WIFI Adapter and WLAN.

Closing and locking as off-topic. Feel free to open a new issue if still facing problems.