From b6ca96d1471bcf440e34a41f0dc6c1293a240bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 12 Dec 2018 17:44:06 +0100 Subject: [PATCH] fix: Add parser for feodotracker --- .../config/modules/FeodotrackerIPBlockList.json | 2 +- bgpranking/parsers/abusech_feodo.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 bgpranking/parsers/abusech_feodo.py diff --git a/bgpranking/config/modules/FeodotrackerIPBlockList.json b/bgpranking/config/modules/FeodotrackerIPBlockList.json index fe98413..fb97e56 100644 --- a/bgpranking/config/modules/FeodotrackerIPBlockList.json +++ b/bgpranking/config/modules/FeodotrackerIPBlockList.json @@ -3,5 +3,5 @@ "vendor": "feodotracker", "name": "ipblocklist", "impact": 5, - "parser": ".parsers.abusech" + "parser": ".parsers.abusech_feodo" } diff --git a/bgpranking/parsers/abusech_feodo.py b/bgpranking/parsers/abusech_feodo.py new file mode 100644 index 0000000..0e43956 --- /dev/null +++ b/bgpranking/parsers/abusech_feodo.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +from dateutil.parser import parse +import re +from io import BytesIO + +from typing import List + + +def parse_raw_file(self, f: BytesIO) -> List[bytes]: + self.datetime = parse(re.findall(b'# Last updated: (.*)#\n', f.getvalue())[0]) + return self.extract_ipv4(f.getvalue())