Allow to update an event by UUID, syntax fixes.

pull/41/head
Raphaël Vinot 2017-01-16 14:41:32 -05:00
parent 7c8cde0afd
commit 748136f3f1
3 changed files with 13 additions and 8 deletions

View File

@ -327,6 +327,9 @@ class PyMISP(object):
return self.get_stix_event(**kwargs)
def update(self, event):
if event['Event'].get('uuid'):
eid = event['Event']['uuid']
else:
eid = event['Event']['id']
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))
return self._check_response(response)
def _valid_uuid(self,uuid):
def _valid_uuid(self, uuid):
"""Test if uuid is valid
Will test against CakeText's RFC 4122, i.e
"the third group must start with a 4,
@ -450,6 +453,7 @@ class PyMISP(object):
# Send it on its way
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):
if rvalue:
type_value = 'regkey|value'

View File

@ -78,6 +78,7 @@ class MISPAttribute(object):
self.SharingGroup = []
self.ShadowAttribute = []
self.disable_correlation = False
self.RelatedAttribute = []
def _serialize(self):
return '{type}{category}{to_ids}{uuid}{timestamp}{comment}{deleted}{value}'.format(