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

filter network interfaces for arp scan #109

Merged
merged 3 commits into from
May 17, 2024
Merged

Conversation

pascalzauberzeug
Copy link
Contributor

If no network interface is provided, arp-scan will use the first one that is up.

The network interface to use can be specified with the --interface option. If this option is not present, arp-scan will search the system interface list for the lowest numbered, configured up interface (excluding loopback).

I had the problem where arp-scan tried to use a can-bus interface, so I wrote this function to filter out unwanted interfaces.
Which are loopback, docker interfaces, virtual interfaces and can.

Two possible issues here:

  • The netifaces module is no longer maintained, but is already in the rosys dependencies, so I used it
  • It still just accepts the first correct interface. An interface parameter would be nice, but would mean a long parameter passthrough chain

Copy link
Contributor

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks good to me. Just a few thoughts:

  • Should we sort the interfaces before filtering them to get predictable results? Or how is the order of netifaces.interfaces() defined?
  • netifaces not being maintained since 2021 could sooner or later become a problem. @rodja Do you know why RoSys has this dependency even though it isn't used other than in this PR? And is there an alternative to switch to? Or do we need to call netifaces on the command line and parse the result. I'd very much prefer a Python library...
  • Regarding your suggestion of an interface parameter, I'm not sure about the costs and benefits. If we don't need it at the moment, let's not add it. If we do need it, let's create a new branch/PR to find and discuss a possible implementation.

@falkoschindler falkoschindler added the enhancement New feature or request label May 10, 2024
@falkoschindler falkoschindler added this to the 0.10.8 milestone May 10, 2024
@rodja
Copy link
Member

rodja commented May 11, 2024

I think netifaces is just a relict. NiceGUI already uses ifaddr: https://github.com/zauberzeug/nicegui/blob/cf61dcb2191d55fbf38fb8d38fc7867a4801c07c/nicegui/welcome.py#L11
@pascalzauberzeug could you try to switch to this dependency?

@pascalzauberzeug
Copy link
Contributor Author

@falkoschindler regarding the sorting of the interfaces, ifaddr uses the order the operating system provides. I would keep it that way to have to same order as commands like ifconfig

Copy link
Contributor

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! ifaddr seems to work very similar to netifaces. Great to have this dependency removed.
I think we can merge into main. 🙂

@falkoschindler falkoschindler merged commit 71889af into main May 17, 2024
3 checks passed
@falkoschindler falkoschindler deleted the arp_scan_interface branch May 17, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants