def from_dict(analysis_dict): if not analysis_dict: return None analysis_ = Analysis(None) analysis_.id = analysis_dict.get("id") analysis_.method = analysis_dict.get("method") analysis_.type = analysis_dict.get("type") analysis_.ordinal_position = analysis_dict.get("ordinal_position") analysis_.complete_datetime = analysis_dict.get("complete_datetime") analysis_.start_datetime = analysis_dict.get("start_datetime") analysis_.lastupdate_datetime = analysis_dict.get("lastupdate_datetime") analysis_.source = Source.from_dict(analysis_dict.get("source")) analysis_.analysts = Personnel.from_list(analysis_dict.get("analysts")) analysis_.summary = StructuredText.from_dict(analysis_dict.get("summary")) analysis_.comments = CommentList.from_list(analysis_dict.get("comments")) if analysis_dict.get("findings_bundle_reference"): analysis_.findings_bundle_reference = [ BundleReference.from_dict(x) for x in analysis_dict.get("findings_bundle_reference") ] analysis_.tools = ToolList.from_list(analysis_dict.get("tools", [])) analysis_.dynamic_analysis_metadata = DynamicAnalysisMetadata.from_dict( analysis_dict.get("dynamic_analysis_metadata") ) analysis_.analysis_environment = AnalysisEnvironment.from_dict(analysis_dict.get("analysis_environment")) analysis_.report = StructuredText.from_dict(analysis_dict.get("report")) return analysis_
def from_obj(analysis_obj): if not analysis_obj: return None analysis_ = Analysis(None) analysis_.id = analysis_obj.get_id() analysis_.method = analysis_obj.get_method() analysis_.type = analysis_obj.get_type() analysis_.ordinal_position = analysis_obj.get_ordinal_position() analysis_.complete_datetime = analysis_obj.get_complete_datetime() analysis_.start_datetime = analysis_obj.get_start_datetime() analysis_.lastupdate_datetime = analysis_obj.get_lastupdate_datetime() analysis_.source = Source.from_obj(analysis_obj.get_Source()) analysis_.analysts = Personnel.from_obj(analysis_obj.get_Analysts()) analysis_.summary = StructuredText.from_obj(analysis_obj.get_Summary()) analysis_.comments = CommentList.from_obj(analysis_obj.get_Comments()) if analysis_obj.get_Findings_Bundle_Reference(): analysis_.findings_bundle_reference = [ BundleReference.from_obj(x) for x in analysis_obj.get_Findings_Bundle_Reference() ] analysis_.tools = ToolList.from_obj(analysis_obj.get_Tools()) analysis_.dynamic_analysis_metadata = DynamicAnalysisMetadata.from_obj( analysis_obj.get_Dynamic_Analysis_Metadata() ) analysis_.analysis_environment = AnalysisEnvironment.from_obj(analysis_obj.get_Analysis_Environment()) analysis_.report = StructuredText.from_obj(analysis_obj.get_Report()) return analysis_
def from_obj(measure_source_obj): if not measure_source_obj: return None measure_source_ = MeasureSource() measure_source_.class_ = measure_source_obj.get_class() measure_source_.source_type = measure_source_obj.get_source_type() measure_source_.name = measure_source_obj.get_name() measure_source_.information_source_type = VocabString.from_obj(measure_source_obj.get_Information_Source_Type()) measure_source_.tool_type = VocabString.from_obj(measure_source_obj.get_Tool_Type()) measure_source_.description = StructuredText.from_obj(measure_source_obj.get_Description()) measure_source_.contributors = Personnel.from_obj(measure_source_obj.get_Contributors()) measure_source_.time = Time.from_obj(measure_source_obj.get_Time()) measure_source_.tools = ToolInformationList.from_obj(measure_source_obj.get_Tools()) measure_source_.platform = None #TODO: add support measure_source_.system = ObjectProperties.from_obj(measure_source_obj.get_System()) measure_source_.instance = ObjectProperties.from_obj(measure_source_obj.get_Instance()) return measure_source_
def from_dict(measure_source_dict): if not measure_source_dict: return None measure_source_ = MeasureSource() measure_source_.class_ = measure_source_dict.get('class') measure_source_.source_type = measure_source_dict.get('source_type') measure_source_.name = measure_source_dict.get('name') measure_source_.information_source_type = VocabString.from_dict(measure_source_dict.get('information_source_type')) measure_source_.tool_type = VocabString.from_dict(measure_source_dict.get('tool_type')) measure_source_.description = StructuredText.from_dict(measure_source_dict.get('description')) measure_source_.contributors = Personnel.from_list(measure_source_dict.get('contributors')) measure_source_.time = Time.from_dict(measure_source_dict.get('time')) measure_source_.tools = ToolInformationList.from_list(measure_source_dict.get('tools')) measure_source_.platform = None #TODO: add support measure_source_.system = ObjectProperties.from_dict(measure_source_dict.get('system')) measure_source_.instance = ObjectProperties.from_dict(measure_source_dict.get('instance')) return measure_source_