Skip to content

Commit 7525f48

Browse files
style: fix formatting and type checks in remaining files
1 parent 81d3a87 commit 7525f48

File tree

105 files changed

+956
-913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+956
-913
lines changed

contrib/eventdb/apply_mapping_eventdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def eventdb_apply(malware_name_column, malware_family_column, host, port,
6262
'WHERE "classification.taxonomy" = \'malicious-code\' {where}'
6363
''.format(table=table, where=where))
6464
if dry_run:
65-
execute = lambda x, y: print(cur.mogrify(x, y).decode()) # noqa: E731
65+
def execute(x, y): return print(cur.mogrify(x, y).decode()) # noqa: E731
6666
else:
6767
execute = cur.execute
6868
for (identifier, malware_name) in cur.fetchall():

contrib/eventdb/to_json.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
from psycopg2.extras import RealDictCursor
1515

1616
parser = ArgumentParser(
17-
prog='EventDB to JSON',
18-
description='Extract data from the IntelMQ EventDB')
17+
prog='EventDB to JSON',
18+
description='Extract data from the IntelMQ EventDB')
1919
parser.add_argument('-v', '--verbose', action='store_true')
2020
parser.add_argument('-i', '--id', help='Get events by ID')
2121
parser.add_argument('-p', '--pretty', action='store_true', help='Pretty print JSON output')
@@ -36,7 +36,7 @@
3636
print(f'Using DSN {conninfo!r}.')
3737
db = connect(dsn=conninfo)
3838
cur = db.cursor(cursor_factory=RealDictCursor)
39-
cur.execute ('SELECT * FROM events WHERE id = %s', (args.id, ))
39+
cur.execute('SELECT * FROM events WHERE id = %s', (args.id, ))
4040

4141
for row in cur.fetchall():
4242
del row['id']

contrib/malware_name_mapping/download_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def none_len(arg: Optional[list]):
3939

4040
def generate_rule(expression: str, identifier: str, name=None):
4141
return {"rulename": name if name else "{}-{}".format(identifier,
42-
hashlib.sha1(expression.encode()).hexdigest()[:10]),
42+
hashlib.sha1(expression.encode()).hexdigest()[:10]),
4343
"if": {"classification.taxonomy": "malicious-code",
4444
"malware.name": expression
4545
},

contrib/systemd/systemd.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,14 @@ def main():
9393
os.makedirs(SYSTEMD_OUTPUT_DIR)
9494

9595
collectors = [i for i in rc_data if rc_data[i]['group'] == 'Collector' and i not in ignored_ids]
96-
#parsers = [i for i in pipe_data if rc_data[i]['group'] == 'Parser']
96+
# parsers = [i for i in pipe_data if rc_data[i]['group'] == 'Parser']
9797

9898
for bot in collectors:
9999
bot_data = rc_data[bot]
100100

101101
if DISABLE_IN_CONF:
102102
rc_data[bot]['enabled'] = False
103103

104-
105104
bot_parameters = bot_data['parameters']
106105
bot_service_name = SERVICE_PREFIX + bot + '.service'
107106
if bot_data.get('run_mode') == 'continuous' or 'rate_limit' not in bot_parameters:

intelmq/bots/collectors/stomp/collector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class StompListener(stomp.PrintingListener):
2222
the stomp listener gets called asynchronously for
2323
every STOMP message
2424
"""
25+
2526
def __init__(self, n6stompcollector, conn, destination, connect_kwargs=None):
2627
self.stompbot = n6stompcollector
2728
self.conn = conn

intelmq/bots/parsers/eset/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
class ESETParserBot(ParserBot):
1919
"""Parse data collected from ESET's TAXII API"""
20+
2021
def init(self):
2122
self.f_map = {
2223
'ei.urls (json)': self.urls_parse,

intelmq/bots/parsers/hibp/parser_callback.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
class HIBPCallbackParserBot(ParserBot):
1919
"""Parse reports of the 'Have I Been Pwned' Callback for Enterprise Subscribers"""
20+
2021
def recover_line(self, line):
2122
return json.dumps(line, sort_keys=True)
2223

intelmq/bots/parsers/malwareurl/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def handle_data(self, data):
3131

3232
class MalwareurlParserBot(ParserBot):
3333
"""Parse the MalwareURL feed"""
34+
3435
def process(self):
3536
report = self.receive_message()
3637
raw_report = utils.base64_decode(report["raw"])

intelmq/bots/parsers/surbl/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
class SurblParserBot(ParserBot):
1111
"""Parse the Surbl feed"""
12+
1213
def process(self):
1314
report = self.receive_message()
1415
raw_report = utils.base64_decode(report["raw"]) # decoding

intelmq/bots/parsers/threatminer/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def process_data(self):
2929

3030
class ThreatminerParserBot(ParserBot):
3131
"""Parse the Threatminer feed"""
32+
3233
def process(self):
3334
report = self.receive_message()
3435
raw_report = utils.base64_decode(report["raw"])

0 commit comments

Comments
 (0)