-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add macOS network interface plugin #839
base: main
Are you sure you want to change the base?
Conversation
94dd6ef
to
886eda9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #839 +/- ##
==========================================
+ Coverage 75.51% 75.64% +0.12%
==========================================
Files 305 312 +7
Lines 26348 26625 +277
==========================================
+ Hits 19897 20140 +243
- Misses 6451 6485 +34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
0e9676d
to
bee41b3
Compare
bee41b3
to
0cf1a69
Compare
plistlease = {} | ||
plistnetwork = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an @cache
better shows your intent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the @cache
decorator instead of a manually maintained dict
.
SYSTEM = "/Library/Preferences/SystemConfiguration/preferences.plist" | ||
DHCP = "/private/var/db/dhcpclient/leases" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you inline these in the code.
record = MacInterfaceRecord(_target=self.target) | ||
record.source = "NetworkServices" | ||
device = interface.get("Interface", {}) | ||
record.name = device.get("DeviceName") | ||
record.type = device.get("Type") | ||
record.vlan = vlan_lookup.get(record.name) | ||
record.interface_service_order = service_order.index(_id) if _id in service_order else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really use this way of initializing a record anywhere else, can you change that to how we usually do it?
from dissect.target.plugins.os.unix.bsd.osx.network import MacNetworkPlugin | ||
from dissect.target.target import Target | ||
|
||
fake_plist = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you make this a fixture, you can get rid of all the deep copies.
Co-authored-by: pyrco <[email protected]>
plistlease = {} | ||
plistnetwork = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the @cache
decorator instead of a manually maintained dict
.
@@ -175,7 +175,7 @@ def DynamicDescriptor(types): # noqa | |||
[ | |||
*COMMON_INTERFACE_ELEMENTS, | |||
("varint", "vlan"), | |||
("string", "proxy"), | |||
("net.ipaddress[]", "proxy"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I don't think you'll want to add it in this PR, can you add a ticket to extend the macOS network interface plugin with proxy records that include the type, port and exclusions.
(DIS-3024)