8000 Rephrase custom PBA file descriptions in configuration by shreyamalviya · Pull Request #1027 · guardicore/monkey · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Rephrase custom PBA file descriptions in configuration #1027

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

Conversation

shreyamalviya
Copy link
Contributor

Related: #1020

@codecov
Copy link
codecov bot commented Mar 9, 2021

Codecov Report

Merging #1027 (2b4fd9e) into release/1.10.0 (53fa550) will increase coverage by 0.54%.
The diff coverage is n/a.

Impacted file tree graph

@@                Coverage Diff                 @@
##           release/1.10.0    #1027      +/-   ##
==================================================
+ Coverage           27.63%   28.18%   +0.54%     
==================================================
  Files                 402      402              
  Lines               12838    12830       -8     
==================================================
+ Hits                 3548     3616      +68     
+ Misses               9290     9214      -76     
Impacted Files Coverage Δ
monkey/monkey/infection_monkey/utils/monkey_dir.py 46.66% <0.00%> (+46.66%) ⬆️
monkey/monkey/infection_monkey/post_breach/pba.py 56.81% <0.00%> (+56.81%) ⬆️
...ion_monkey/post_breach/actions/users_custom_pba.py 57.37% <0.00%> (+57.37%) ⬆️
...ey/monkey/infection_monkey/post_breach/__init__.py 100.00% <0.00%> (+100.00%) ⬆️

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 53fa550...2b4fd9e. Read the comment docs.

Copy link
Contributor
@VakarisZ VakarisZ left a comment

Choose a reason for hiding this comment

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

First, let us resolve the PBA fix PR

@shreyamalviya shreyamalviya force-pushed the rephrasing-config-custom-pba branch from 9399b86 to 4ea6ac1 Compare March 9, 2021 12:47
@ghost
Copy link
ghost commented Mar 9, 2021

DeepCode failed to analyze this pull request

Something went wrong despite trying multiple times, sorry about that.
Please comment this pull request with "Retry DeepCode" to manually retry, or contact us so that a human can look into the issue.

elif WormConfiguration.custom_PBA_windows_cmd:
self.command = WormConfiguration.custom_PBA_windows_cmd

def _execute_default(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain this change? It think it's not ideal to be downloading files from the island in the constructor if we can avoid it. Also, it makes sense to me that downloading the file is part of execution; I wouldn't expect the initialization of the PBA to fail if there were a network outage or other condition that prevented the download.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense; fixed

Copy link
Collaborator
@mssalvatore mssalvatore left a comment

Choose a reason for hiding this comment

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

@shreyamalviya Can you rework and include the tests from #1020?

@shreyamalviya shreyamalviya force-pushed the rephrasing-config-custom-pba branch from 6e500f8 to 1020bd3 Compare March 10, 2021 07:16
@@ -0,0 +1,152 @@
import pytest
Copy link
Contributor

Choose a reason for hiding this comment

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

Unit tests are nice, but not a silver bullet. There's an antipattern in TDD called the "mockery", when most of the functionality is mocked. I don't suggest refactoring the whole pba's to solve it, but I can see BB tests bringing more value here and still being trivial enough to implement (command execution at least). Other PBA's should be tested with BB's IMO.

Comment on lines 23 to 25
"description": "File to be uploaded after breaching. "
"If you want the file to be executed, "
"specify it in the 'Linux post breach command' field. "
Copy link
Contributor
@VakarisZ VakarisZ Mar 10, 2021

Choose a reason for hiding this comment

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

Suggested change
"description": "File to be uploaded after breaching. "
"If you want the file to be executed, "
"specify it in the 'Linux post breach command' field. "
"description": "File will be uploaded after breaching. "
"Use 'Linux post-breach command' field to "
"change permissions, run or delete the file."

Copy link
Collaborator

Choose a reason for hiding this comment

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

"File will be uploaded" doesn't seem right as a description. "File to be uploaded" is what I would expect.

Comment on lines 38 to 40
"description": "File to be uploaded after breaching. "
"If you want the file to be executed, "
"specify it in the 'Windows post breach command' field. "
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"description": "File to be uploaded after breaching. "
"If you want the file to be executed, "
"specify it in the 'Windows post breach command' field. "
"description": "File will be uploaded after breaching. "
"Use 'Windows post-breach command' field to "
"run or delete the file."

@@ -35,9 +35,9 @@
"title": "Windows post breach file",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"title": "Windows post breach file",
"title": "Windows post-breach file",

@@ -20,9 +20,9 @@
"title": "Linux post breach file",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"title": "Linux post breach file",
"title": "Linux post-breach file",

Copy link
Contributor
@VakarisZ VakarisZ left a comment

Choose a reason for hiding this comment

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

We also need to change descriptions of PBA command fields. They should also contain examples. Linux description should be something like:
"Use this field to run custom commands or uploaded files on exploited machines. Example command chmod +x ./my_script.sh; ./my_script.sh ; rm ./my_script.sh"

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
0