paulbsd-salt/states/_modules/bl.py
Paul Lecuq 1b59cdacdd * Update salt states
- bl module updated
- borg state updated
- config state updated
- netbox state updated
- nginx state updated
- misc updates
2022-02-21 13:52:46 +01:00

17 lines
407 B
Python

#!/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"
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