def from_dict(observable_dict): if not observable_dict: return None from cybox.core import PatternFidelity obs = Observable() obs.id_ = observable_dict.get('id') obs.title = observable_dict.get('title') obs.description = StructuredText.from_dict( observable_dict.get('description')) obs.object_ = Object.from_dict(observable_dict.get('object')) obs.event = Object.from_dict(observable_dict.get('event')) obs.observable_composition = ObservableComposition.from_dict( observable_dict.get('observable_composition')) obs.idref = observable_dict.get('idref') obs.sighting_count = observable_dict.get('sighting_count') if observable_dict.get('observable_source'): obs.observable_source = [ MeasureSource.from_dict(x) for x in observable_dict.get('observable_source') ] obs.keywords = Keywords.from_dict(observable_dict.get('keywords')) obs.pattern_fidelity = PatternFidelity.from_dict( observable_dict.get('pattern_fidelity')) return obs
def from_dict(observables_dict): if observables_dict is None: return None #TODO: look at major_version and minor_version obs = Observables() for o in observables_dict.get("observables", []): obs.add(Observable.from_dict(o)) obs.observable_package_source = MeasureSource.from_dict(observables_dict.get('observable_package_source')) return obs
def from_dict(observable_dict): if not observable_dict: return None obs = Observable() obs.id_ = observable_dict.get('id') obs.title = observable_dict.get('title') obs.description = StructuredText.from_dict(observable_dict.get('description')) obs.object_ = Object.from_dict(observable_dict.get('object')) obs.event = Object.from_dict(observable_dict.get('event')) obs.observable_composition = ObservableComposition.from_dict(observable_dict.get('observable_composition')) obs.idref = observable_dict.get('idref') obs.sighting_count = observable_dict.get('sighting_count') if observable_dict.get('observable_source'): obs.observable_source = [MeasureSource.from_dict(x) for x in observable_dict.get('observable_source')] return obs
def from_dict(observable_dict): if not observable_dict: return None from cybox.core import PatternFidelity obs = Observable() obs.id_ = observable_dict.get('id') obs.title = observable_dict.get('title') obs.description = StructuredText.from_dict(observable_dict.get('description')) obs.object_ = Object.from_dict(observable_dict.get('object')) obs.event = Object.from_dict(observable_dict.get('event')) obs.observable_composition = ObservableComposition.from_dict(observable_dict.get('observable_composition')) obs.idref = observable_dict.get('idref') obs.sighting_count = observable_dict.get('sighting_count') if observable_dict.get('observable_source'): obs.observable_source = [MeasureSource.from_dict(x) for x in observable_dict.get('observable_source')] obs.keywords = Keywords.from_dict(observable_dict.get('keywords')) obs.pattern_fidelity = PatternFidelity.from_dict(observable_dict.get('pattern_fidelity')) return obs
def from_dict(action_dict, action_cls = None): if not action_dict: return None if action_cls == None: action_cls = Action() action_ = action_cls action_.id = action_dict.get('id') action_.idref = action_dict.get('idref') action_.ordinal_position = action_dict.get('ordinal_position') action_.action_status = action_dict.get('action_status') action_.context = action_dict.get('context') action_.timestamp = action_dict.get('timestamp') action_.type = VocabString.from_dict(action_dict.get('type')) action_.name = VocabString.from_dict(action_dict.get('name')) action_.description = StructuredText.from_dict(action_dict.get('description')) action_.action_aliases = action_dict.get('action_aliases', []) action_.action_arguments = ActionArguments.from_list(action_dict.get('action_arguments', [])) action_.discovery_method = MeasureSource.from_dict(action_dict.get('discovery_method')) action_.associated_objects = AssociatedObjects.from_list(action_dict.get('associated_objects', [])) action_.relationships = ActionRelationships.from_list(action_dict.get('relationships', [])) #action_.frequency = Frequency.from_dict(action_dict.get('frequency')) #TODO: add support return action_