Make pep8 happy

pull/212/head
Raphaël Vinot 2017-05-24 07:38:17 +02:00
parent 699a35e507
commit b43722c73f
1 changed files with 113 additions and 112 deletions

View File

@ -145,6 +145,7 @@ iocMispCompositeMapping = {
'RegistryItem/Path|RegistryItem/Text': {'type': 'regkey|value'}
}
def extract_field(report, field_name):
if report:
data = report.find(field_name.lower())
@ -202,8 +203,7 @@ def set_values(value1, value2=None):
if value2 is not None:
# construct attribut composite value
value = "{}|{}".format(
extract_field(value1, 'Content'),
value = "{}|{}".format(extract_field(value1, 'Content'),
extract_field(value2, 'Content')
)
else:
@ -216,7 +216,7 @@ def set_values(value1, value2=None):
if value2 is not None:
# construct attribut composite type
compositeMapping = value1.find('context')['search']+'|'+value2.find('context')['search']
compositeMapping = '{}|{}'.format(value1.find('context')['search'], value2.find('context')['search'])
mapping = get_mapping(compositeMapping, mappingDict=iocMispCompositeMapping)
else:
mapping = get_mapping(value1.find('context')['search'])
@ -234,13 +234,13 @@ def set_values(value1, value2=None):
attribute_values['type'] = attribute_values['type'] + '|port'
attribute_values['value'] = attribute_values['value'].replace(':', '|')
attribute_values["comment"] = '{}{}'.format(
extract_field(value1, 'Comment'),
attribute_values["comment"] = '{}{}'.format(extract_field(value1, 'Comment'),
extract_field(value2, 'Comment')
)
return attribute_values
def set_all_attributes(openioc, misp_event):
processed = set()
@ -280,6 +280,7 @@ def set_all_attributes(openioc, misp_event):
return misp_event
if __name__ == '__main__':
import requests
# test file for composite