-
Notifications
You must be signed in to change notification settings - Fork 54
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
Create base class for the network plugin #810
Create base class for the network plugin #810
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #810 +/- ##
==========================================
+ Coverage 75.48% 75.53% +0.04%
==========================================
Files 298 299 +1
Lines 25684 25744 +60
==========================================
+ Hits 19388 19445 +57
- Misses 6296 6299 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
6c7ae43
to
8fea5e4
Compare
dissect/target/helpers/record.py
Outdated
[ | ||
*COMMON_INTERFACE_ELEMENTS, | ||
("string", "vlan"), | ||
("string", "dns_server"), |
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.
should this not be just "dns"?
dissect/target/helpers/record.py
Outdated
[ | ||
*COMMON_INTERFACE_ELEMENTS, | ||
("string", "vlan"), | ||
("string", "dns_server"), |
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.
should this not be just "dns"?
output_list = [] | ||
for record in self.find_interfaces(): | ||
if output := getattr(record, field_name, None): | ||
output_list.append(output) | ||
return output_list |
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.
output_list = [] | |
for record in self.find_interfaces(): | |
if output := getattr(record, field_name, None): | |
output_list.append(output) | |
return output_list | |
yield from filter( lambda elem: elem is not None, | |
map( lambda elem: getattr(elem, field_name, None), self.find_interfaces() ) | |
) |
but maybe this is just making things more complex...
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 adjusted the current one slightly to remove indentation and add support for list operations.
("string", "mac"), | ||
("net.ipaddress", "ip"), | ||
("net.ipaddress", "gateway"), | ||
("string", "source"), |
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.
dns not part of this?
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 was following the ticket, with dns not being explicitly part of unix stuff.
I did see you can retrieve that information using systemd or resolvectl, so it probably should be added.
I will also adjust it a little bit, as a single interface can have multiple ips and gateways and so on.
Also add caching of the records, so they would only need to be computed once in the future
Co-authored-by: Erik Schamper <[email protected]>
…-interface-plugin
closes #774