2022-01-02 18:01:47 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import json
|
|
|
|
from urllib.request import urlopen, Request
|
|
|
|
|
|
|
|
|
|
|
|
def get_ips(url="https://ipbl.paulbsd.com"):
|
2022-01-02 18:09:13 +01:00
|
|
|
"""get_ips fetch ips blacklists from ipbl"""
|
2022-01-02 18:01:47 +01:00
|
|
|
fullurl = f"{url}/ips"
|
|
|
|
req = Request(method="GET", url=fullurl)
|
|
|
|
res = urlopen(req)
|
|
|
|
results = json.loads(res.read())
|
2022-01-02 18:09:13 +01:00
|
|
|
ips = [i["ip"] for i in results]
|
2022-01-02 18:01:47 +01:00
|
|
|
if res.status == 200:
|
2022-01-02 18:09:13 +01:00
|
|
|
return ips
|
2022-01-02 18:01:47 +01:00
|
|
|
return None
|