BGP-Ranking/bgpranking/parsers/malc0de.py

14 lines
320 B
Python
Raw Normal View History

2018-07-13 14:51:00 +02:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from dateutil.parser import parse
import re
from io import BytesIO
2018-07-13 14:51:00 +02:00
from typing import List
2018-07-13 14:51:00 +02:00
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())