Skip to content

Conversation

VakarisZ
Copy link
Contributor

@VakarisZ VakarisZ commented Jun 20, 2022

Based on the previous logic the depth parameter represented hops remaining, not current depth.

What does this PR do?

Fixes incorrect depth logic on the agent side. Based on the previous logic the depth parameter represented hops remaining, not current depth. This is misleading and might result in a situation where max depth is 3 in the configuration, so the user runs the agent with -d 2 expecting the agent to do one more hop. In reality, the agent will make 2 hops, because --depth was countdown to zero, not count to maximum depth.

Add any further explanations here.

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:

    Tested by running agent manually with max depth
    Tested by running unit tests

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

Based on the previous logic the depth parameter represented hops remaining, not current depth.
@codecov
Copy link

codecov bot commented Jun 20, 2022

Codecov Report

Merging #2033 (eeba0e0) into develop (e8001d8) will decrease coverage by 0.09%.
The diff coverage is 21.42%.

@@             Coverage Diff             @@
##           develop    #2033      +/-   ##
===========================================
- Coverage    56.86%   56.77%   -0.10%     
===========================================
  Files          463      465       +2     
  Lines        12840    12850      +10     
===========================================
- Hits          7302     7296       -6     
- Misses        5538     5554      +16     
Impacted Files Coverage Δ
monkey/common/utils/argparse_types.py 0.00% <0.00%> (ø)
monkey/infection_monkey/dropper.py 0.00% <0.00%> (ø)
monkey/infection_monkey/exploit/hadoop.py 0.00% <0.00%> (ø)
monkey/infection_monkey/exploit/log4shell.py 0.00% <0.00%> (ø)
monkey/infection_monkey/exploit/mssqlexec.py 0.00% <ø> (ø)
monkey/infection_monkey/exploit/powershell.py 96.29% <ø> (ø)
monkey/infection_monkey/exploit/smbexec.py 0.00% <ø> (ø)
monkey/infection_monkey/exploit/sshexec.py 21.51% <0.00%> (ø)
monkey/infection_monkey/exploit/web_rce.py 0.00% <0.00%> (ø)
monkey/infection_monkey/exploit/wmiexec.py 0.00% <ø> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8001d8...eeba0e0. Read the comment docs.

@VakarisZ VakarisZ marked this pull request as ready for review June 20, 2022 13:03
Copy link
Contributor

@ilija-lazoroski ilija-lazoroski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test and it seems good.

VakarisZ added 3 commits June 22, 2022 12:31
This method is used to determine if the inbound tunnel should be open and if the master should attempt exploiting other machines
VakarisZ added 2 commits June 22, 2022 14:33
If user runs the agent it should start with depth 0, because usually it means that it's running on the island
@VakarisZ VakarisZ requested a review from mssalvatore June 22, 2022 11:48
@mssalvatore mssalvatore merged commit ada5618 into develop Jun 22, 2022
@mssalvatore mssalvatore deleted the fix-depth-logic branch June 22, 2022 15:23
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.

3 participants