74 Commits

Author SHA1 Message Date
Maxi Quoß 14b9e031d5 update deps, migrate pocketbase to ganigeorgiev.com/pocketbase 2026-11-06 21:12:18 +01:00
Jerry 5018b01542 fix: wait for custom wake commands before accepting online status 2026-10-12 00:05:32 +08:00
Maxi Quoß 5435d914b3 remove broadcast again
https://github.com/seriousm4x/UpSnap/pull/1760#issuecomment-5720918551
2026-09-18 12:07:15 +02:00
invario b17b09109f feature: Support use of FQDN resolution with DNS and mDNS (#1760)
* feature: Support use of FQDN resolution with DNS and mDNS

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* - fixed `cronjobs.go` call to `port.Set()`
- refactored lots of the new code and fixed errors
- added validation functions into `validate.go` to handle unicode FQDN and punycode
- fixed memory leak from not closing avahi server connection by establishing permanent connection
- updated regex used in on device form and PB validation pattern to accept international unicode FQDN or IPv4 addresses
- updated regex used for netmask validation on form
- timeout mDNS queries after 2 seconds

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* fix: remove unintentional change

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* perform FQDN/IP validation in Svelte instead of HTML form

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* disable IP tracking if field value does not match regex for IPv4

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* fix: port state not always saved, don't resolve deviceIP for every port

* send wol packets also to broadcast

* fix: handle lowercase string comparision

---------

Signed-off-by: invario <67800603+invario@users.noreply.github.com>
Co-authored-by: Maxi Quoß <maxi@quoss.org>
2026-09-17 22:15:03 +02:00
Maxi Quoß aee5c8c3c7 improve logging, filter only upsnap logs 2026-09-10 16:46:40 +02:00
Maxi Quoß 7bbe114407 feat: add /logs page, close #1756 2026-09-09 23:50:00 +02:00
Mike Pastore b5fd864320 feat: optional per-device IP address tracking via periodic ARP scan (#1763)
* feat: optional per-device ip address tracking via periodic arp scan

Adds a per-device "Track IP address" toggle (disabled by default) and a
global cron interval setting. When enabled, upsnap periodically arp-scans
the local subnets of opted-in devices with nmap and updates a device's ip
address whenever its mac address is found at a different one. Subnets are
skipped unless directly attached to the host, so routed devices are never
scanned. Uses the same nmap + CAP_NET_RAW requirements as the existing
network scan feature; no new privileges needed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: cover ip tracking subnet helpers and nmap xml parsing

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* refactor: extract ip tracking into its own package and expand test coverage

Move the arp scan sweep out of cronjobs into a new iptracking package with
two entry points: TrackAllSubnets (the cron sweep) and TrackOneSubnet (a
single validated scan). Device lookup is now by mac address across all
tracked devices, with updates constrained to the device's own subnet.

The scannability check becomes networking.ValidateScannableSubnet, which
reports why a subnet can't be scanned and accepts any subnet overlapping a
directly attached network, so sub-blocks of an attached prefix are now
scannable. The mac-to-ip mapping moves to networking as Nmaprun.MacToIP.

Cover the subnet guard, mac normalization, skip paths, and sweep
orchestration with tests against a stubbed scanner and a real migrated
schema.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat: pause tracking sweeps while nobody is connected

With lazy_ping turned on, the periodic tracking sweep now skips its tick
while no realtime clients are connected, just like the ping cron, and owes
a catch-up sweep to the next client that connects: the realtime connect
hook runs one sweep only when a tick was actually skipped (or none has run
since boot), so page reloads during active use trigger nothing. This
extends lazy_ping's meaning from "pause pings when idle" to "pause
periodic network activity when idle"; the setting's description is updated
accordingly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ui: move lazy ping section below ip tracking in settings

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* disable toggle when tracking is disabled

* fix: load private store

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Maxi Quoß <maxi@quoss.org>
2026-08-27 20:21:51 +02:00
Maxi Quoß 297518f008 fix: only allow valid ipv4 addresses as netmask, close #1761 2026-07-26 12:20:30 +02:00
invario 3614f3654b Fix: subnet mask check (#1757) 2026-07-23 19:01:04 +02:00
Maxi Quoß 43f3f65d65 fix: validate ip and mac addresses to prevent RCE
https://github.com/seriousm4x/UpSnap/security/advisories/GHSA-6mc7-6948-w5h4
2026-05-26 19:08:52 +02:00
Maxi Quoß 65d6e9fa86 update deps 2026-04-01 19:24:57 +02:00
monstercjz 6d53e9e197 fix(cron/wake): fix closure bugs, add reload hooks, and improve command robustness (#1723)
Co-authored-by: Maxi Quoß <maxi@quoss.org>
2026-04-01 19:21:47 +02:00
Maxi Quoß 95d722ba56 fix: test udp 2026-03-23 20:54:43 +01:00
invario 59b1723b1c send additional 2 magic packets via IP address for routed WOL (#1718)
Signed-off-by: invario <67800603+invario@users.noreply.github.com>
2026-03-23 20:51:07 +01:00
invario 48a8c736b2 fix: loop in shutdown code rewritten to work properly (#1695)
* FIX: loop in shutdown code rewritten to work properly

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* remove unneeded wait()

we already wait in shutdown.go#L52

* cleanup

---------

Signed-off-by: invario <67800603+invario@users.noreply.github.com>
Co-authored-by: Maxi Quoß <maxi@quoss.org>
2026-03-19 12:10:45 +01:00
invario 1d361e3f8b update ping privileged/unprivileged logic (#1586)
* update ping privileged/unprivileged logic, add entrypoint

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* Removed entrypoint script, code in GO instead to raise NET_RAW cap

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* Rewritten to only split pingdevice func into separate GO files

Signed-off-by: invario <67800603+invario@users.noreply.github.com>

* remove runtime check

* readme: cap_net_raw=+p

* clear up

* readme: clearify linux only

* set `privileged = false` on darwin

---------

Signed-off-by: invario <67800603+invario@users.noreply.github.com>
Co-authored-by: Maxi Quoß <maxi@quoss.org>
2026-03-19 11:20:46 +01:00
Maxi Quoß 4bfc0576ee fix: remove test case 2026-01-07 15:51:35 +01:00
Maxi Quoß d18b54e7b6 fix: go tests 2026-01-07 15:48:28 +01:00
Maxi Quoß c736561fab feat: add ip and mac variables to wake/shutdown commands 2025-10-19 22:42:27 +02:00
Maxi Quoß c9bc0c8f38 fix: port check ignore connection refused error 2025-03-18 01:27:02 +01:00
Maxi Quoß 8bedcbf88a cleaner if 2025-03-17 11:14:14 +01:00
Maxi Quoß c125afdfc7 fix: use netErr.Timeout() to check for timeout 2025-03-17 11:05:48 +01:00
Maxi Quoß 80fb1a6127 fix: ping test case 2025-03-17 11:02:10 +01:00
Maxi Quoß 92a66fc8a4 fix: reduce port check errors 2025-03-17 10:39:28 +01:00
Maxi Quoß 40226c2984 fix: change logger warning msg 2025-03-12 14:06:11 +01:00
Maxi Quoß b7811dbe27 fix: better err msg formatting 2025-03-11 08:30:48 +01:00
Maxi Quoß 3dcc3fb64b feat: improve cross platform ping
- set privileged ping based on run as root
- distinguish between ping errors
2025-03-08 12:39:46 +01:00
Maxi Quoß ebe28b45c0 fix: remove debug prints 2025-03-06 22:01:49 +01:00
Maxi Quoß 2e64e85d4b feat: custom timeouts for wake and shutdown 2025-03-06 00:49:24 +01:00
Maxi Quoß de4a46995c fix: formatting 2025-02-09 23:49:42 +01:00
Maxi Quoß c2f574426f feat: add more test cases 2025-02-08 02:29:20 +01:00
Maxi Quoß e124f5b86e fix: minimize destination slice to just use the broadcast string 2024-12-31 13:41:07 +01:00
Maxi Quoß 322c1ccc50 fix: go test 2024-12-31 13:28:38 +01:00
Maxi Quoß 4540d8b851 fix: send 4 magic packets to different address combinations #583 2024-12-31 13:20:11 +01:00
Maxi Quoß 2f1acee092 go-dep: pocketbase > 0.23 2024-12-28 11:03:19 +01:00
seriousm4x 976e808d75 feat: add ping privileged env UPSNAP_PING_PRIVILEGED #207 2023-12-22 09:30:39 +01:00
seriousm4x a9fa2b6a46 always defer close on port check #356 2023-12-17 09:45:34 +01:00
seriousm4x 3331ae96f5 minor adjustments 2023-12-14 16:35:46 +01:00
Tom Stivers faa47f2cdd feat: add support for custom wake/ping commands 2023-12-14 16:32:52 +01:00
seriousm4x 86ed3c1c08 fix: cross platform build 2023-10-19 19:34:18 +02:00
seriousm4x 92a142b5ee fix: import sys/windows 2023-10-19 19:02:13 +02:00
seriousm4x d50245ebaf capitalize logs 2023-10-19 18:54:15 +02:00
seriousm4x 2f3ad2fdcb fix: use SIGTERM, then SIGKILL to avoid zombies #266 2023-10-19 18:47:14 +02:00
seriousm4x fc3e6e6e90 fix: seperate platform specific process killing #266 2023-10-19 12:21:22 +02:00
seriousm4x f3ba2489f4 fix: kill child processes of shutdown cmd #266 2023-10-19 11:03:17 +02:00
seriousm4x 4426d60248 possible fix for #266 2023-10-18 01:22:38 +02:00
seriousm4x 8f84afaacc remove ping test 2023-09-19 01:35:13 +02:00
seriousm4x e3ab652483 feat: add some go unit tests 2023-09-18 23:24:14 +02:00
seriousm4x 8299f22dfd fix: temp revert of #207 2023-09-11 00:52:28 +02:00
Maxi Quoß cce6823f25 feat: optional non-root docker user #207 2023-09-10 22:45:56 +02:00