mirror of https://github.com/MISP/PyMISP
Allow to set org_id and orgc_id when creating a new MISPEvent
Squashed commit of the following:
commit 8a5dfda8a728d8722dfba890729066948e744e44
Merge: 477f81d
332fc05
Author: Raphaël Vinot <raphael@vinot.info>
Date: Tue Nov 15 09:52:26 2016 +0100
Merge https://github.com/garanews/PyMISP into garanews-master
commit 332fc0508d3f5dc32cf962bd2cad1d800b6b4b02
Author: garanews <puntogtg@tiscali.it>
Date: Mon Nov 14 15:29:04 2016 +0100
Delete api_old.py
commit 7fb955fa2fba964ae7120f4cf56cf85e203efe96
Author: garanews <puntogtg@tiscali.it>
Date: Mon Nov 14 14:05:22 2016 +0100
Create api.py
commit 7f6f45d9ce8ec4e948c5b2513b9bc59296985e09
Author: garanews <puntogtg@tiscali.it>
Date: Mon Nov 14 14:05:06 2016 +0100
Rename api.py to api_old.py
commit 63c325816c2bda646f462a322eb3063788ab91a4
Author: garanews <puntogtg@tiscali.it>
Date: Mon Nov 14 11:48:17 2016 +0100
Add files via upload
commit edf0cd1d90e89c30a4d3ef756d6bc6501de3885f
Author: garanews <puntogtg@tiscali.it>
Date: Wed Nov 2 15:31:42 2016 +0100
Add files via upload
pull/30/head
parent
477f81d3ab
commit
6885779be5
|
@ -297,10 +297,10 @@ class PyMISP(object):
|
||||||
# ######### Event handling (Json only) #########
|
# ######### Event handling (Json only) #########
|
||||||
# ##############################################
|
# ##############################################
|
||||||
|
|
||||||
def _prepare_full_event(self, distribution, threat_level_id, analysis, info, date=None, published=False):
|
def _prepare_full_event(self, distribution, threat_level_id, analysis, info, date=None, published=False, orgc_id=None, org_id=None):
|
||||||
misp_event = MISPEvent(self.describe_types)
|
misp_event = MISPEvent(self.describe_types)
|
||||||
misp_event.set_all_values(info=info, distribution=distribution, threat_level_id=threat_level_id,
|
misp_event.set_all_values(info=info, distribution=distribution, threat_level_id=threat_level_id,
|
||||||
analysis=analysis, date=date)
|
analysis=analysis, date=date, orgc_id=orgc_id, org_id=org_id)
|
||||||
if published:
|
if published:
|
||||||
misp_event.publish()
|
misp_event.publish()
|
||||||
return misp_event
|
return misp_event
|
||||||
|
@ -341,8 +341,8 @@ class PyMISP(object):
|
||||||
e.threat_level_id = threat_level_id
|
e.threat_level_id = threat_level_id
|
||||||
return self.update_event(event['Event']['id'], json.dumps(e, cls=EncodeUpdate))
|
return self.update_event(event['Event']['id'], json.dumps(e, cls=EncodeUpdate))
|
||||||
|
|
||||||
def new_event(self, distribution=None, threat_level_id=None, analysis=None, info=None, date=None, published=False):
|
def new_event(self, distribution=None, threat_level_id=None, analysis=None, info=None, date=None, published=False, orgc_id=None, org_id=None):
|
||||||
misp_event = self._prepare_full_event(distribution, threat_level_id, analysis, info, date, published)
|
misp_event = self._prepare_full_event(distribution, threat_level_id, analysis, info, date, published, orgc_id, org_id)
|
||||||
return self.add_event(json.dumps(misp_event, cls=EncodeUpdate))
|
return self.add_event(json.dumps(misp_event, cls=EncodeUpdate))
|
||||||
|
|
||||||
def add_tag(self, event, tag):
|
def add_tag(self, event, tag):
|
||||||
|
|
Loading…
Reference in New Issue