Merge branch 'master' of https://github.com/arcsector/MISP-Taxii-Server
commit
4fd353fbec
|
@ -12,6 +12,7 @@ from pyaml import yaml
|
||||||
from yaml import Loader
|
from yaml import Loader
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from requests.exceptions import ConnectionError
|
from requests.exceptions import ConnectionError
|
||||||
|
from pymisp.exceptions import PyMISPError
|
||||||
|
|
||||||
logging_level = logging.INFO
|
logging_level = logging.INFO
|
||||||
log = logging.getLogger("__main__")
|
log = logging.getLogger("__main__")
|
||||||
|
@ -70,12 +71,14 @@ else:
|
||||||
"collections": misp_collections
|
"collections": misp_collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try:
|
||||||
MISP = pymisp.PyMISP(
|
MISP = pymisp.PyMISP(
|
||||||
CONFIG["misp"]["url"],
|
CONFIG["misp"]["url"],
|
||||||
CONFIG["misp"]["api"],
|
CONFIG["misp"]["api"],
|
||||||
ssl = CONFIG["misp"].get("verifySSL", True)
|
ssl = CONFIG["misp"].get("verifySSL", True)
|
||||||
)
|
)
|
||||||
|
except PyMISPError:
|
||||||
|
log.error("Cannot connect to MISP; please ensure that MISP is up and running at {}. Skipping MISP upload.".format(CONFIG['misp']['url']))
|
||||||
|
|
||||||
def post_stix(manager, content_block, collection_ids, service_id):
|
def post_stix(manager, content_block, collection_ids, service_id):
|
||||||
'''
|
'''
|
||||||
|
@ -151,7 +154,7 @@ def post_stix(manager, content_block, collection_ids, service_id):
|
||||||
try:
|
try:
|
||||||
event = MISP.add_event(package)
|
event = MISP.add_event(package)
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
log.error("MISP-Taxii-Server - Cannot connect to MISP; please ensure that MISP is up and running at {}. Skipping MISP upload.".format(CONFIG['misp']['url']))
|
log.error("Cannot push to MISP; please ensure that MISP is up and running at {}. Skipping MISP upload.".format(CONFIG['misp']['url']))
|
||||||
if (
|
if (
|
||||||
CONFIG["misp"]["publish"] == True or
|
CONFIG["misp"]["publish"] == True or
|
||||||
CONFIG["misp"]["publish"] == "True"
|
CONFIG["misp"]["publish"] == "True"
|
||||||
|
|
Loading…
Reference in New Issue