mirror of https://github.com/MISP/PyMISP
Allow to update an event by UUID, syntax fixes.
parent
7c8cde0afd
commit
748136f3f1
|
@ -327,6 +327,9 @@ class PyMISP(object):
|
||||||
return self.get_stix_event(**kwargs)
|
return self.get_stix_event(**kwargs)
|
||||||
|
|
||||||
def update(self, event):
|
def update(self, event):
|
||||||
|
if event['Event'].get('uuid'):
|
||||||
|
eid = event['Event']['uuid']
|
||||||
|
else:
|
||||||
eid = event['Event']['id']
|
eid = event['Event']['id']
|
||||||
return self.update_event(eid, event)
|
return self.update_event(eid, event)
|
||||||
|
|
||||||
|
@ -360,7 +363,7 @@ class PyMISP(object):
|
||||||
response = session.post(urljoin(self.root_url, 'events/removeTag'), data=json.dumps(to_post))
|
response = session.post(urljoin(self.root_url, 'events/removeTag'), data=json.dumps(to_post))
|
||||||
return self._check_response(response)
|
return self._check_response(response)
|
||||||
|
|
||||||
def _valid_uuid(self,uuid):
|
def _valid_uuid(self, uuid):
|
||||||
"""Test if uuid is valid
|
"""Test if uuid is valid
|
||||||
Will test against CakeText's RFC 4122, i.e
|
Will test against CakeText's RFC 4122, i.e
|
||||||
"the third group must start with a 4,
|
"the third group must start with a 4,
|
||||||
|
@ -450,6 +453,7 @@ class PyMISP(object):
|
||||||
|
|
||||||
# Send it on its way
|
# Send it on its way
|
||||||
return self.add_named_attribute(event, 'attachment', filename, category, to_ids, comment, distribution, proposal, data=encodedData)
|
return self.add_named_attribute(event, 'attachment', filename, category, to_ids, comment, distribution, proposal, data=encodedData)
|
||||||
|
|
||||||
def add_regkey(self, event, regkey, rvalue=None, category='Artifacts dropped', to_ids=True, comment=None, distribution=None, proposal=False):
|
def add_regkey(self, event, regkey, rvalue=None, category='Artifacts dropped', to_ids=True, comment=None, distribution=None, proposal=False):
|
||||||
if rvalue:
|
if rvalue:
|
||||||
type_value = 'regkey|value'
|
type_value = 'regkey|value'
|
||||||
|
|
|
@ -78,6 +78,7 @@ class MISPAttribute(object):
|
||||||
self.SharingGroup = []
|
self.SharingGroup = []
|
||||||
self.ShadowAttribute = []
|
self.ShadowAttribute = []
|
||||||
self.disable_correlation = False
|
self.disable_correlation = False
|
||||||
|
self.RelatedAttribute = []
|
||||||
|
|
||||||
def _serialize(self):
|
def _serialize(self):
|
||||||
return '{type}{category}{to_ids}{uuid}{timestamp}{comment}{deleted}{value}'.format(
|
return '{type}{category}{to_ids}{uuid}{timestamp}{comment}{deleted}{value}'.format(
|
||||||
|
|
Loading…
Reference in New Issue