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

Island: Rename local_network_scan #2348

Merged
merged 9 commits into from
Sep 27, 2022
Merged

Conversation

cakekoa
Copy link
Contributor

@cakekoa cakekoa commented Sep 23, 2022

What does this PR do?

Fixes part of #2299.

Renames local_network_scan -> scan_local_interfaces

PR Checklist

  • Have you added an explanation of what your changes do and why you'd like to include them?
  • Is the TravisCI build passing?
  • 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?
  • Have you successfully tested your changes locally? Elaborate:

    The unit tests still pass

  • If applicable, add screenshots or log transcripts of the feature working

local_network_scan -> scan_local_interfaces
@codecov
Copy link

codecov bot commented Sep 23, 2022

Codecov Report

Base: 60.26% // Head: 60.53% // Increases project coverage by +0.26% 🎉

Coverage data is based on head (688a41a) compared to base (4f4eea3).
Patch coverage: 95.83% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
...agent_configuration/default_agent_configuration.py 100.00% <ø> (ø)
monkey/infection_monkey/master/propagator.py 99.00% <ø> (+<0.01%) ⬆️
...nkey/monkey_island/cc/services/reporting/report.py 25.64% <0.00%> (ø)
...on/agent_configuration/agent_sub_configurations.py 100.00% <100.00%> (ø)
monkey/common/network/network_range.py 90.62% <100.00%> (ø)
monkey/infection_monkey/network/info.py 59.09% <100.00%> (ø)
...n_monkey/network_scanning/scan_target_generator.py 100.00% <100.00%> (ø)
monkey/tests/common/example_agent_configuration.py 100.00% <100.00%> (ø)
...y/monkey_island/cc/services/infection_lifecycle.py 43.75% <0.00%> (-20.54%) ⬇️
monkey/monkey_island/cc/services/database.py 75.00% <0.00%> (-3.13%) ⬇️
... and 46 more

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines 82 to 83
:param scan_local_interfaces: Whether or not the agent should scan the machine's
network interfaces in addition to the provided subnet ranges
Copy link
Collaborator

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.

VakarisZ and others added 3 commits September 26, 2022 16:14
"scan_my_networks" is the shortest way to convey that networks the machine belongs to will get scanned
Copy link
Contributor

@shreyamalviya shreyamalviya left a 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):
Copy link
Contributor

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

Copy link
Contributor

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
@VakarisZ VakarisZ merged commit 9823301 into develop Sep 27, 2022
@VakarisZ VakarisZ deleted the 2299-rename-local-network-scan branch September 27, 2022 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants