-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Implement global & extensible interfaces #2707
Conversation
e8965a9
to
163effa
Compare
Codecov Report
@@ Coverage Diff @@
## master #2707 +/- ##
==========================================
- Coverage 88.26% 88.18% -0.09%
==========================================
Files 252 254 +2
Lines 53534 54004 +470
==========================================
+ Hits 47252 47622 +370
- Misses 6282 6382 +100
|
754931d
to
a9fa891
Compare
f422824
to
1451e45
Compare
1451e45
to
ab772d1
Compare
The display looks way better now. Thanks! I did not notice it during my first test, but on macOS inactive interfaces are also listed. I think that is not necessary as they Scapy won't be able to use them. Another point, the "WARNING: No IPv4 address found" messages are not necessary too. |
On a fresh Ubuntu 18.04 installation, the following creating a dummy network interface with
I see several issues here:
|
04b8d1eaef3b7d1228b3673b3a45059c8746a275 works fine on FreeBSD 12.1 (^^)/ |
I'm pretty sure Should we remove interfaces that are not up from Also sorry but I lost track of what 04b8d1eaef3b7d1228b3673b3a45059c8746a275 was ^^ |
5017d5e
to
4387093
Compare
Let's keep the current By the way, do you think that |
I've settled on a middle ground:
I also changed the sorting |
@p-l- what's your call? |
Can I merge this or do you want me to sqash the commits? |
I still think that the current function name needs to be changed to something more meaningful =)
|
* Implement global & extensible interfaces * Simplify detection of valid interfaces * Linux: handle interfaces with no IPv4 * Reimplement get_working_ifaces * Remove 'main' IPv6 in interfaces * Don't show invalid interfaces by default * Update error message
* Implement global & extensible interfaces * Simplify detection of valid interfaces * Linux: handle interfaces with no IPv4 * Reimplement get_working_ifaces * Remove 'main' IPv6 in interfaces * Don't show invalid interfaces by default * Update error message
A pretty major refactor based on a very old PR, but pretty cool. This:
scapy/interfaces.py
file and introducingconf.ifaces
get_if_list
on all platformsIt brings the "interfaces" objects to other platforms. Those are cool because they give you the content of the flags and avoid having to re-read the /etc/ files each time you need them.
Screenshots
e.g.: Linux

e.g.: Usbpcap AND libpcap

This is fully backward compatible: the interfaces objects implement the same functions as strings:
conf.iface + "test" == "eth0test"
so that it doesn't break anything, and all functions use anetwork_name
function to get the network name from the object or a string (instead of the currentif WINDOWS:
.... checks)Tested
How to test this
Mainteners, please test the changes (there are unit tests, but I'd like you all to give some feedback on the features): try playing around with
conf.ifaces
andconf.iface
, then withconf.use_pcap
to understand what it does.