Skip to content

Commit

Permalink
Fix err on empty IFACES
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Sep 4, 2024
1 parent 246b35d commit 936d4aa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## [v2.0.2] - 2024-09-
### Fixed
- Error when `IFACES`=""

## [v2.0.1] - 2024-09-02
### Added
- `Vlans` and `docker0` support [#47](https://github.com/aceberg/WatchYourLAN/issues/47). Thanks [thehijacker](https://github.com/thehijacker)!
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/aceberg/WatchYourLAN)](https://goreportcard.com/report/github.com/aceberg/WatchYourLAN)
[![Maintainability](https://api.codeclimate.com/v1/badges/46b17f99edc1726b5d7d/maintainability)](https://codeclimate.com/github/aceberg/WatchYourLAN/maintainability)
![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/aceberg/watchyourlan)
![Docker Pulls](https://img.shields.io/docker/pulls/aceberg/watchyourlan)
![GitHub Discussions](https://img.shields.io/github/discussions/aceberg/WatchYourLAN)


Lightweight network IP scanner with web GUI. Features:
- Send notification when new host is found
Expand Down
16 changes: 10 additions & 6 deletions internal/arp/arpscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,21 @@ func parseOutput(text, iface string) []models.Host {
// Scan all interfaces
func Scan(ifaces, args string, strs []string) []models.Host {
var text string
var p []string
var foundHosts = []models.Host{}
arpArgs = args

p := strings.Split(ifaces, " ")
if ifaces != "" {

for _, iface := range p {
slog.Debug("Scanning interface " + iface)
text = scanIface(iface)
slog.Debug("Found IPs: \n" + text)
p = strings.Split(ifaces, " ")

for _, iface := range p {
slog.Debug("Scanning interface " + iface)
text = scanIface(iface)
slog.Debug("Found IPs: \n" + text)

foundHosts = append(foundHosts, parseOutput(text, iface)...)
foundHosts = append(foundHosts, parseOutput(text, iface)...)
}
}

for _, s := range strs {
Expand Down

0 comments on commit 936d4aa

Please sign in to comment.