Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Scan VLAN subnets #47

Closed
thehijacker opened this issue Feb 9, 2023 · 7 comments
Closed

Feature Request: Scan VLAN subnets #47

thehijacker opened this issue Feb 9, 2023 · 7 comments

Comments

@thehijacker
Copy link

Looking for alternative to PiAlert. This looks like much simpler version of it with simillar features. But one is missing that I need so I can capture all my subnets. Arp-scan can also scan VLAN subnets with syntax:

arp-scan --ignoredups --retry=6 10.0.107.0/24 -vlan=107 --interface=eth0

Can this vlan parameter be added as well as option to scan multiple subnets?

Thank you.

@thehijacker
Copy link
Author

thehijacker commented Feb 13, 2023

I made some changes to the internal/scan/arpscan.go:

-func scanIface(iface string) string {
+func scanIface(iface []string) string {
-        cmd, err := exec.Command("arp-scan", "-glNx", "-I", iface).Output()
+       cmd, err := exec.Command("arp-scan", iface...).Output()
        if err != nil {
                return string("")
        }
        return string(cmd)
}
// Scan all interfaces
func arpScan(allIfaces string) []models.Host {
        var text string
        var foundHosts = []models.Host{}

        perString := strings.Split(allIfaces, ",")

        for _, iface := range perString {
                log.Println("INFO: scanning interface", iface)
-                 text = scanIface(iface)
+                text = scanIface(strings.Split("-gNx " + strings.TrimSpace(iface), " "))
                log.Println("INFO: found IPs:", text)
                foundHosts = append(foundHosts, parseOutput(text)...)
        }

        return foundHosts
}

Basically the parameters can be anything and it will pass them as array of parameters. For example:

IFACE=-l -I vmbr0, 10.0.208.0/24 -Q 208 -I vmbr0, 10.0.107.0/24 -Q 107 -I vmbr0

or long syntax

IFACE=-l --interface=vmbr0, 10.0.208.0/24 --vlan=208 --interface=vmbr0, 10.0.107.0/24 --vlan=107 --interface=vmbr0

Using this changes and IFACE parameters, all three of my home networks are scanned. Could this be included in next version? Or possible improved. First time I looked at a go code :)

Next I need to figure out how to put this new binary inside my docker container.

@GentleHoneyLover
Copy link

+1 for the feature. Segmented my network into VLANs recently and realized that WatchYourLAN can only see within its subnet...

@lima3w
Copy link

lima3w commented Mar 20, 2023

Just set up an instance myself and noticed there wasnt an option for specifying what subnets to scan. I have a few subnets, based on wifi, homelab, hardwire, guest, iot devices, etc. I dont want to have to run an instance for each.

+1 for this

@hobybrenner
Copy link

Multiple subnets/vlans would be wonderful!

@dustingrady
Copy link

Agreed. I just tried this (and the various forks of Pi Alert) trying to find one that would work for my multi-VLAN setup. This feature would be amazing.

@Jffrey
Copy link

Jffrey commented May 12, 2024

This feature would be awsome! sadly im not a dev and cant help :(

I will try to get my head into how to fix that like @thehijacker advertised, maybe you could provide a little guide for non devs?

thx in advance

@aceberg
Copy link
Owner

aceberg commented Sep 2, 2024

Done in v2.0.1 - see docs/VLAN_ARP_SCAN.md for a howto.

@aceberg aceberg closed this as completed Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants