|
|
@ -6,7 +6,6 @@ from os import path
|
|
|
|
import geoip2.database
|
|
|
|
import geoip2.database
|
|
|
|
from requests import get as r_get
|
|
|
|
from requests import get as r_get
|
|
|
|
from urllib.parse import urlparse
|
|
|
|
from urllib.parse import urlparse
|
|
|
|
from levin.section import Section
|
|
|
|
|
|
|
|
from levin.bucket import Bucket
|
|
|
|
from levin.bucket import Bucket
|
|
|
|
from levin.ctypes import *
|
|
|
|
from levin.ctypes import *
|
|
|
|
from levin.constants import LEVIN_SIGNATURE
|
|
|
|
from levin.constants import LEVIN_SIGNATURE
|
|
|
@ -166,4 +165,12 @@ def get_geoip(ip_or_dns):
|
|
|
|
resolved = socket.gethostbyname(host)
|
|
|
|
resolved = socket.gethostbyname(host)
|
|
|
|
host = host if resolved == host else resolved
|
|
|
|
host = host if resolved == host else resolved
|
|
|
|
with geoip2.database.Reader("./data/GeoLite2-City.mmdb") as reader:
|
|
|
|
with geoip2.database.Reader("./data/GeoLite2-City.mmdb") as reader:
|
|
|
|
return reader.city(host)
|
|
|
|
return reader.city(host)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_whois(ip_or_dns):
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# asn
|
|
|
|
|
|
|
|
# asn_cidr
|
|
|
|
|
|
|
|
# asn_country_code
|
|
|
|
|
|
|
|
# asn_description
|
|
|
|