Allow filenames with regexes.

Fix #52
pull/55/head
Raphaël Vinot 2017-02-23 16:59:37 +01:00
parent ad02ebdef7
commit ee3f0fb9ca
1 changed files with 18 additions and 22 deletions

View File

@ -447,22 +447,18 @@ class PyMISP(object):
attributes = []
type_value = '{}'
value = '{}'
value = ''
if filename:
type_value = 'filename|{}'
value = filename + '|{}'
value = filename + '|'
if md5:
attributes.append(self._prepare_full_attribute(category, type_value.format('md5'), value.format(md5),
to_ids, comment, distribution))
attributes.append(self._prepare_full_attribute(category, type_value.format('md5'), value + md5, to_ids, comment, distribution))
if sha1:
attributes.append(self._prepare_full_attribute(category, type_value.format('sha1'), value.format(sha1),
to_ids, comment, distribution))
attributes.append(self._prepare_full_attribute(category, type_value.format('sha1'), value + sha1, to_ids, comment, distribution))
if sha256:
attributes.append(self._prepare_full_attribute(category, type_value.format('sha256'), value.format(sha256),
to_ids, comment, distribution))
attributes.append(self._prepare_full_attribute(category, type_value.format('sha256'), value + sha256, to_ids, comment, distribution))
if ssdeep:
attributes.append(self._prepare_full_attribute(category, type_value.format('ssdeep'), value.format(ssdeep),
to_ids, comment, distribution))
attributes.append(self._prepare_full_attribute(category, type_value.format('ssdeep'), value + ssdeep, to_ids, comment, distribution))
return self._send_attributes(event, attributes, proposal)
@ -1413,7 +1409,7 @@ class PyMISP(object):
response = session.post(url, data=json.dumps(new_server))
return self._check_response(response)
def add_server_json(self, json_file, server_id):
def edit_server_json(self, json_file, server_id):
session = self.__prepare_session()
jdata = json.load(open(json_file))
url = urljoin(self.root_url, 'servers/edit/{}'.format(server_id))