mirror of https://github.com/MISP/misp-modules
fix: Making pep8 happy
parent
de8d78cc70
commit
26b0357ac7
|
@ -88,18 +88,18 @@ def handler(q=False):
|
|||
else:
|
||||
misperrors['error'] = "Unsupported attributes type"
|
||||
return misperrors
|
||||
listed = []
|
||||
info = []
|
||||
listeds = []
|
||||
infos = []
|
||||
ipRev = '.'.join(ip.split('.')[::-1])
|
||||
for rbl in rbls:
|
||||
query = '{}.{}'.format(ipRev, rbl)
|
||||
try:
|
||||
txt = resolver.query(query, 'TXT')
|
||||
listed.append(query)
|
||||
info.append([str(t) for t in txt])
|
||||
listeds.append(query)
|
||||
infos.append([str(t) for t in txt])
|
||||
except Exception:
|
||||
continue
|
||||
result = "\n".join(["{}: {}".format(l, " - ".join(i)) for l, i in zip(listed, info)])
|
||||
result = "\n".join([f"{listed}: {' - '.join(info)}" for listed, info in zip(listeds, infos)])
|
||||
if not result:
|
||||
return {'error': 'No data found by querying known RBLs'}
|
||||
return {'results': [{'types': mispattributes.get('output'), 'values': result}]}
|
||||
|
|
|
@ -244,11 +244,11 @@ def __any_mandatory_misp_field(header):
|
|||
|
||||
|
||||
def __special_parsing(data, delimiter):
|
||||
return list(tuple(l.strip() for l in line[0].split(delimiter)) for line in csv.reader(io.TextIOWrapper(io.BytesIO(data.encode()), encoding='utf-8')) if line and not line[0].startswith('#'))
|
||||
return list(tuple(part.strip() for part in line[0].split(delimiter)) for line in csv.reader(io.TextIOWrapper(io.BytesIO(data.encode()), encoding='utf-8')) if line and not line[0].startswith('#'))
|
||||
|
||||
|
||||
def __standard_parsing(data):
|
||||
return list(tuple(l.strip() for l in line) for line in csv.reader(io.TextIOWrapper(io.BytesIO(data.encode()), encoding='utf-8')) if line and not line[0].startswith('#'))
|
||||
return list(tuple(part.strip() for part in line) for line in csv.reader(io.TextIOWrapper(io.BytesIO(data.encode()), encoding='utf-8')) if line and not line[0].startswith('#'))
|
||||
|
||||
|
||||
def handler(q=False):
|
||||
|
|
|
@ -99,7 +99,7 @@ def handler(q=False):
|
|||
results = process_analysis_json(json.loads(data.decode('utf-8')))
|
||||
except ValueError:
|
||||
log.warning('MISP modules {0} failed: uploaded file is not a zip or json file.'.format(request['module']))
|
||||
return {'error': 'Uploaded file is not a zip or json file.'.format(request['module'])}
|
||||
return {'error': 'Uploaded file is not a zip or json file.'}
|
||||
pass
|
||||
# keep only unique entries based on the value field
|
||||
results = list({v['values']: v for v in results}.values())
|
||||
|
|
Loading…
Reference in New Issue