#!/usr/bin/python3 import json from urllib.request import urlopen, Request def get_ips(url="https://ipbl.paulbsd.com"): """get_ips fetch ips blacklists from ipbl""" fullurl = f"{url}/ips/last?interval=3%20h" req = Request(method="GET", url=fullurl) res = urlopen(req) results = json.loads(res.read()) ips = [i["ip"] for i in results] if res.status == 200: return ips return None