-
Notifications
You must be signed in to change notification settings - Fork 792
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
Island: Rename local_network_scan #2348
Conversation
local_network_scan -> scan_local_interfaces
Codecov ReportBase: 60.26% // Head: 60.53% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #2348 +/- ##
===========================================
+ Coverage 60.26% 60.53% +0.26%
===========================================
Files 539 540 +1
Lines 14037 14091 +54
===========================================
+ Hits 8460 8530 +70
+ Misses 5577 5561 -16
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
:param scan_local_interfaces: Whether or not the agent should scan the machine's | ||
network interfaces in addition to the provided subnet ranges |
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 need to avoid the word "local". It implies that only local area networks (LANs) will be scanned.
"scan_my_networks" is the shortest way to convey that networks the machine belongs to will get scanned
monkey/infection_monkey/network_scanning/scan_target_generator.py
Outdated
Show resolved
Hide resolved
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.
You missed one in envs\monkey_zoo\blackbox\test_configurations\noop.py
.
@@ -52,14 +56,14 @@ def _remove_redundant_targets(targets: List[NetworkAddress]) -> List[NetworkAddr | |||
def _range_to_addresses(range_obj: NetworkRange) -> List[NetworkAddress]: | |||
addresses = [] | |||
for address in range_obj: | |||
if hasattr(range_obj, "domain_name"): | |||
if isinstance(range_obj, HasDomain): |
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 don't think this is a good approach. Type hints are for documentation, not for logic. Pythonic way would be to try creating the networks address and set it to none on attribute error
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 reverted this change. I don't like it because it's not straight-forward. We use a type to check for an attribute instead of just checking for an attribute. Mypy complains, but there are two options, either we 1. Create a protocol with optional domain name (but what's the point?) 2. ignore this error. I went for the latter
The responsibility of type-hints are not to implement logic. Implementing logic via type-hints diminishes readability, because it forces you to cross-reference a class instead of just exposing the logic where it's used
What does this PR do?
Fixes part of #2299.
Renames local_network_scan -> scan_local_interfaces
PR Checklist
Was the CHANGELOG.md updated to reflect the changes?Was the documentation framework updated to reflect the changes?Have you checked that you haven't introduced any duplicate code?Testing Checklist
Added relevant unit tests?If applicable, add screenshots or log transcripts of the feature working