Skip to content

Commit

Permalink
Eliminating arbitrary returns
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-kevin committed Aug 23, 2021
1 parent 4d495d3 commit 7a7684d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jsjaws.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _extract_payloads(self, sample_sha256: str, deep_scan: bool) -> None:
unique_shas = {sample_sha256}
max_payloads_extracted = self.config.get("max_payloads_extracted", MAX_PAYLOAD_FILES_EXTRACTED)
extracted_count = 0
for file in listdir(PAYLOAD_EXTRACTION_DIR):
for file in sorted(listdir(PAYLOAD_EXTRACTION_DIR)):
extracted = path.join(PAYLOAD_EXTRACTION_DIR, file)
# No empty files
if path.getsize(extracted) == 0:
Expand Down
16 changes: 8 additions & 8 deletions test/test_jsjaws.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,22 @@ def test_extract_payloads(jsjaws_class_instance):
f.write("blah")

# valid file 1
valid_file_name = "blah2.txt"
valid_file_path = f"{PAYLOAD_EXTRACTION_DIR}{valid_file_name}"
with open(valid_file_path, "w") as f:
valid_file_name1 = "blah2.txt"
valid_file_path1 = f"{PAYLOAD_EXTRACTION_DIR}{valid_file_name1}"
with open(valid_file_path1, "w") as f:
f.write("blah")

# valid file 2
valid_file_name = "blah3.txt"
valid_file_path = f"{PAYLOAD_EXTRACTION_DIR}{valid_file_name}"
with open(valid_file_path, "w") as f:
valid_file_name2 = "blah3.txt"
valid_file_path2 = f"{PAYLOAD_EXTRACTION_DIR}{valid_file_name2}"
with open(valid_file_path2, "w") as f:
f.write("blah")

jsjaws_class_instance.artifact_list = []
jsjaws_class_instance._extract_payloads("blah", False)
assert jsjaws_class_instance.artifact_list[0] == {
"name": valid_file_name,
"path": valid_file_path,
"name": valid_file_name1,
"path": valid_file_path1,
"description": "Extracted Payload",
"to_be_extracted": True
}
Expand Down

0 comments on commit 7a7684d

Please sign in to comment.