From 1a1e5a919f586f010864e81b6d9b5a3591c8307b Mon Sep 17 00:00:00 2001 From: Oren Isacson Date: Thu, 8 Sep 2022 14:21:35 -0300 Subject: [PATCH 1/2] Add timeout command to binwalk call. Related to FACT_core #820 Timeout is set to 580 as the docker image has a 600 seconds timeout, so 580 seconds should be a safe number so partial results could be extracted. --- .../plugins/unpacking/generic_carver/code/generic_carver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py b/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py index f2adc4ce..d643310c 100644 --- a/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py +++ b/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py @@ -22,7 +22,7 @@ def unpack_function(file_path, tmp_dir): ''' logging.debug('File Type unknown: execute binwalk on {}'.format(file_path)) - output = execute_shell_command(f'binwalk --extract --carve --signature --directory {tmp_dir} {file_path}') + output = execute_shell_command(f'timeout 580 binwalk --extract --carve --signature --directory {tmp_dir} {file_path}') drop_underscore_directory(tmp_dir) return {'output': output, 'filter_log': ArchivesFilter(tmp_dir).remove_false_positive_archives()} From 95ad81b0444b650a50e8040d3b02c7f966e2f43a Mon Sep 17 00:00:00 2001 From: Oren Isacson Date: Wed, 21 Sep 2022 14:11:19 -0300 Subject: [PATCH 2/2] Changing timeout set to binwalk call. Changing timeout to 280 as the docker image has a 300 seconds timeout. --- .../plugins/unpacking/generic_carver/code/generic_carver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py b/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py index d643310c..fdafaf94 100644 --- a/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py +++ b/fact_extractor/plugins/unpacking/generic_carver/code/generic_carver.py @@ -13,7 +13,7 @@ VERSION = '0.8' TAR_MAGIC = b'ustar' - +TIMEOUT = 280 def unpack_function(file_path, tmp_dir): ''' @@ -22,7 +22,7 @@ def unpack_function(file_path, tmp_dir): ''' logging.debug('File Type unknown: execute binwalk on {}'.format(file_path)) - output = execute_shell_command(f'timeout 580 binwalk --extract --carve --signature --directory {tmp_dir} {file_path}') + output = execute_shell_command(f'timeout {TIMEOUT} binwalk --extract --carve --signature --directory {tmp_dir} {file_path}') drop_underscore_directory(tmp_dir) return {'output': output, 'filter_log': ArchivesFilter(tmp_dir).remove_false_positive_archives()}