From ae3d762b504439b40206064e968805c0a7eb2003 Mon Sep 17 00:00:00 2001 From: yonatanS1 <99646226+yonatan424@users.noreply.github.com> Date: Thu, 26 Jan 2023 22:12:30 +0200 Subject: [PATCH] Fix bz2 command (#2299) Details: Cast bz2content to str to avoid type error. (TypeError: write() argument must be str, not bytes) Testing: Local testing was done. Associated Issues: N/A Co-authored-by: Carrie Roberts --- atomics/T1560.002/T1560.002.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atomics/T1560.002/T1560.002.yaml b/atomics/T1560.002/T1560.002.yaml index 45a247bb..e857fa37 100644 --- a/atomics/T1560.002/T1560.002.yaml +++ b/atomics/T1560.002/T1560.002.yaml @@ -57,7 +57,7 @@ atomic_tests: name: bash elevation_required: false command: | - $which_python -c "import bz2;input_file=open('#{path_to_input_file}','rb');content=input_file.read();input_file.close();bz2content=bz2.compress(content,compresslevel=9);output_file=open('#{path_to_output_file}','w+');output_file.write(bz2content);output_file.close();" + $which_python -c "import bz2;input_file=open('#{path_to_input_file}','rb');content=input_file.read();input_file.close();bz2content=bz2.compress(content,compresslevel=9);output_file=open('#{path_to_output_file}','w+');output_file.write(str(bz2content));output_file.close();" cleanup_command: | rm #{path_to_output_file} - name: Compressing data using zipfile in Python (Linux)