Skip to content

Commit 936d4aa

Browse files
committed
Fix err on empty IFACES
1 parent 246b35d commit 936d4aa

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [v2.0.2] - 2024-09-
5+
### Fixed
6+
- Error when `IFACES`=""
7+
48
## [v2.0.1] - 2024-09-02
59
### Added
610
- `Vlans` and `docker0` support [#47](https://github.com/aceberg/WatchYourLAN/issues/47). Thanks [thehijacker](https://github.com/thehijacker)!

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
[![Go Report Card](https://goreportcard.com/badge/github.com/aceberg/WatchYourLAN)](https://goreportcard.com/report/github.com/aceberg/WatchYourLAN)
88
[![Maintainability](https://api.codeclimate.com/v1/badges/46b17f99edc1726b5d7d/maintainability)](https://codeclimate.com/github/aceberg/WatchYourLAN/maintainability)
99
![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/aceberg/watchyourlan)
10-
![Docker Pulls](https://img.shields.io/docker/pulls/aceberg/watchyourlan)
10+
![GitHub Discussions](https://img.shields.io/github/discussions/aceberg/WatchYourLAN)
11+
1112

1213
Lightweight network IP scanner with web GUI. Features:
1314
- Send notification when new host is found

internal/arp/arpscan.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,21 @@ func parseOutput(text, iface string) []models.Host {
6868
// Scan all interfaces
6969
func Scan(ifaces, args string, strs []string) []models.Host {
7070
var text string
71+
var p []string
7172
var foundHosts = []models.Host{}
7273
arpArgs = args
7374

74-
p := strings.Split(ifaces, " ")
75+
if ifaces != "" {
7576

76-
for _, iface := range p {
77-
slog.Debug("Scanning interface " + iface)
78-
text = scanIface(iface)
79-
slog.Debug("Found IPs: \n" + text)
77+
p = strings.Split(ifaces, " ")
78+
79+
for _, iface := range p {
80+
slog.Debug("Scanning interface " + iface)
81+
text = scanIface(iface)
82+
slog.Debug("Found IPs: \n" + text)
8083

81-
foundHosts = append(foundHosts, parseOutput(text, iface)...)
84+
foundHosts = append(foundHosts, parseOutput(text, iface)...)
85+
}
8286
}
8387

8488
for _, s := range strs {

0 commit comments

Comments
 (0)