helperFunctions.task_conversion module

helperFunctions.task_conversion.check_for_errors(analysis_task)

Check an analysis task for missing fields and return a dict with error messages (that are intended to be displayed in the webinterface).

Parameters:

analysis_task (dict) – The analysis task data.

Returns:

A dictionary containing error messages in the form {task_key: error_message}.

Return type:

dict[str, str]

helperFunctions.task_conversion.convert_analysis_task_to_fw_obj(analysis_task, base_fw=None)

Convert an analysis task to a firmware object.

Parameters:
  • analysis_task (dict) – The analysis task data.

  • base_fw (Firmware | None) – The existing Firmware object in case of analysis update.

Returns:

A Firmware object based on the analysis task data.

Return type:

Firmware

helperFunctions.task_conversion.create_analysis_task(request)

Create an analysis task from the data stored in the flask request object.

Parameters:

request (Request) – The flask request object.

Returns:

A dict containing the analysis task data.

Return type:

dict[str, Any]

helperFunctions.task_conversion.create_re_analyze_task(request, uid)

Create an analysis task for a file that is already in the database.

Parameters:
  • request (Request) – The flask request object.

  • uid (str) – The unique identifier of the firmware.

Returns:

A dict containing the analysis task data.

Return type:

dict[str, Any]

helperFunctions.task_conversion.get_file_name_and_binary_from_request(request)

Retrieves the file name and content from the flask request object.

Parameters:

request (Request) – The flask request object.

Returns:

A Tuple containing the file name and the file content.

Return type:

tuple[str, bytes]