0

I'm using python with requests/bs4/flask and I'd like to identify the user type of an incoming IP request to my flask app.

http://ipleak.net identifies the type as residential, college, cafe, corporate, ect but they only check your IP.

GeoIP2 is the API that drives ipleak.net for this and the returned parameter is called User Type.

How do I identify an IP type without using their API? I'm okay with less accuracy/classification. Is there a public API for this? Or can I scrape it from a whois DB? Or can I identify it in another way?

davidism
  • 121,510
  • 29
  • 395
  • 339
azillion
  • 46
  • 8

1 Answers1

0

I monitored the network traffic and found the call to check the type of IP. I wrote this function to check any IP that I pass to the function.

  import requests
  from bs4 import BeautifulSoup

  # check type of IP address
  def ip_check(ip):
        result = requests.get('https://ipleak.net/?mode=ajax&ip={}'.format(ip))
        soup = BeautifulSoup(result.text, 'html.parser')
        parse = soup.get_text()
        final = parse.replace('\xa0', '').replace(ip, '')
        return final
azillion
  • 46
  • 8