Add 'add_yara' to upload yara rules, increase flexibility of config

fix #38
pull/16/head
Raphaël Vinot 2016-04-20 10:16:44 +02:00
parent 46396202f5
commit ea952a9588
1 changed files with 6 additions and 1 deletions

View File

@ -112,7 +112,7 @@ class PyMISP(object):
raise PyMISPError('Unable to connect to MISP ({}). Please make sure the API key and the URL are correct (http/https is required): {}'.format(self.root_url, e))
session = self.__prepare_session(out_type)
self.describe_types = session.get(self.root_url + 'attributes/describeTypes.json').json()
self.describe_types = session.get(urljoin(self.root_url, 'attributes/describeTypes.json')).json()
self.categories = self.describe_types['result']['categories']
self.types = self.describe_types['result']['types']
@ -450,6 +450,11 @@ class PyMISP(object):
attributes.append(self._prepare_full_attribute(category, 'mutex', mutex, to_ids, comment, distribution))
return self._send_attributes(event, attributes, proposal)
def add_yara(self, event, yara, category='Payload delivery', to_ids=False, comment=None, distribution=None, proposal=False):
attributes = []
attributes.append(self._prepare_full_attribute(category, 'yara', yara, to_ids, comment, distribution))
return self._send_attributes(event, attributes, proposal)
# ##### Network attributes #####
def add_ipdst(self, event, ipdst, category='Network activity', to_ids=True, comment=None, distribution=None, proposal=False):