Repository navigation
Ransomware README with configurable directories - #1309
Conversation
| def test_no_readme_if_no_directory( | ||
| build_ransomware_payload, ransomware_payload_config, ransomware_target | ||
| ): | ||
| ransomware_payload_config["encryption"]["enabled"] = True | ||
| ransomware_payload_config["encryption"]["directories"]["linux_target_dir"] = "" | ||
| ransomware_payload_config["encryption"]["directories"]["windows_target_dir"] = "" | ||
| ransomware_payload_config["other_behaviors"]["readme"] = True | ||
| ransomware_payload = build_ransomware_payload(ransomware_payload_config) | ||
|
|
||
| ransomware_payload.run_payload() | ||
| assert not Path(ransomware_target / README_DEST).exists() |
There was a problem hiding this comment.
With an empty target directory, there's no reason to think that a readme would be left in ransomware_target/. From the test's perspective, it's very unpredictable where RansomwarePayload might leave the file. It depends on how we're processing the target directory and how that code handles an empty path. This assert is not sufficient to verify that no readme file is left on the system.
Take a look at test_readme_already_exists(). This test needs to basically do the same thing, which is to assert that no attempt at copying the file is made.
Codecov Report
@@ Coverage Diff @@
## develop #1309 +/- ##
========================================
Coverage 30.86% 30.87%
========================================
Files 454 454
Lines 13544 13545 +1
========================================
+ Hits 4181 4182 +1
Misses 9363 9363
Continue to review full report at Codecov.
|
8b5091d to
eb36869
Compare
What does this PR do?
Fixes first task of #1287 . If we don't specify a directory, the readme should not be left.
PR Checklist
Testing Checklist
Explain Changes
Are the commit messages enough? If not, elaborate.