Browse Source

Slightly better Rapid7 parser

newworkflow_packbefore
Geoffrey Frogeye 2 years ago
parent
commit
954b33b2a6
Signed by: geoffrey GPG Key ID: D8A7ECA00A8CD3DD
  1. 13
      feed_dns.py

13
feed_dns.py

@ -2,7 +2,6 @@
import argparse
import database
import json
import logging
import sys
import typing
@ -66,12 +65,16 @@ class Rapid7Parser(Parser):
}
def consume(self) -> None:
data = dict()
for line in self.buf:
self.db.enter_step('parse_rapid7')
try:
data = json.loads(line)
except json.decoder.JSONDecodeError:
continue
split = line.split('"')
for k in range(1, 14, 4):
key = split[k]
val = split[k+2]
data[key] = val
self.register(
Rapid7Parser.TYPES[data['type']],
int(data['timestamp']),

Loading…
Cancel
Save