2018-07-13 14:51:00 +02:00
|
|
|
#!/usr/bin/env python3
|
2018-06-11 18:59:41 +02:00
|
|
|
# -*- 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-06-11 18:59:41 +02:00
|
|
|
|
2018-07-13 14:51:00 +02:00
|
|
|
|
|
|
|
def parse_raw_file(self, f: BytesIO) -> List[bytes]:
|
2018-11-26 10:35:22 +01:00
|
|
|
if re.findall(b'This feed is not generated for this family', f.getvalue()):
|
|
|
|
return []
|
|
|
|
|
2018-06-11 18:59:41 +02:00
|
|
|
self.datetime = parse(re.findall(b'## Feed generated at: (.*)\n', f.getvalue())[0])
|
|
|
|
return self.extract_ipv4(f.getvalue())
|