def proxyCheck(ipaddr): text.printGreen("IP2Proxy: https://github.com/ip2location/ip2proxy-python") try: db = IP2Proxy.IP2Proxy() db.open("IP2PROXY-LITE-PX8.BIN") record = db.get_all(ipaddr) if str(record['is_proxy']) == "1": print( " * Determined this is a proxy based on the IP2Proxy database." ) print('Proxy Type: ' + record['proxy_type']) print('Country Code: ' + record['country_short']) print('Country Name: ' + record['country_long']) print('Region Name: ' + record['region']) print('City Name: ' + record['city']) print('ISP: ' + record['isp']) print('Domain: ' + record['domain']) print('Usage Type: ' + record['usage_type']) print('ASN: ' + record['asn']) print('AS Name: ' + record['as_name']) print('Last Seen: ' + record['last_seen']) elif str(record['is_proxy']) != "1": text.printRed( " * Determined this is not a proxy based on the reputation .BIN file referenced." ) else: text.printRed( " * Encountered an error while checking if the IP was a proxy." ) except Exception as e: print(e) return
def get_ipproxy_db(): db = None filepath = os.path.join(settings.GEOIP_PATH, "IP2Proxy.BIN") if os.path.exists(filepath): db = IP2Proxy.IP2Proxy(filepath) return db
def iptrace(ip): database = IP2Location.IP2Location() database.open("src/IP2LOCATION-LITE-DB11.BIN") loc = database.get_all(ip) print("IP : " + ip) print("City : " + loc.city) print("State : " + loc.region) print("Country : " + loc.country_long) proxy = IP2Proxy.IP2Proxy() # open IP2Proxy BIN database for proxy lookup proxy.open("src/IP2PROXY-LITE-PX8.BIN") record = proxy.get_all(ip) isproxy = str(record['is_proxy']) if isproxy == '1': print('Proxy : Yes') if record['proxy_type'] == "PUB": print("Proxy Type : Public") else: print('Proxy Type: ' + record['proxy_type']) print('ISP : ' + record['isp']) print('Domain : ' + record['domain']) print('Usage Type : ' + record['usage_type']) print('ASN : ' + record['asn']) print('Company Name : ' + record['as_name']) else: pass lats = [] lons = [] r = requests.get("http://api.ipstack.com/" + ip + "?access_key=" + api_key) resp = r.json() print("Latitude : {longitude}".format(**resp)) print("Longitude : {longitude}".format(**resp)) if resp['latitude'] and resp['longitude']: lats = resp['latitude'] lons = resp['longitude'] maps_url = "https://maps.google.com/maps?q=%s,+%s" % (lats, lons) openWeb = input("Open GPS location in web broser? (Y/N) ") if openWeb.upper() == 'Y': webbrowser.open(maps_url, new=2) else: print() get_ip() proxy.close() database.close()
def get_ipproxy_db(): db = None filepath = os.path.join(settings.GEOIP_PATH, "IP2Proxy.BIN") if os.path.exists(filepath): db = IP2Proxy.IP2Proxy(filepath) else: log.warning("IP Proxy detection is not available.") return db
def ip2Proxy(): IP=input(C+"\nroot@osint:"+W+"~/IP2Proxy# Enter the IP Address: ") if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$",IP): db = IP2Proxy.IP2Proxy() db.open("src/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN.BIN") print ( W + '[+]' + G + "Processing....." + '\n') record = db.get_all(IP) db.close() if record['is_proxy']!=0: #print(record) print(C+"Proxy: " + "Enabled") print(C+"Proxy Type:" + W+record['proxy_type']) print(C+"Country Code:" + W+record['country_short']) print(C+"Country:" +W+ record['country_long']) print(C+"Region Name:" + W+record['region']) print(C+"City:" +W+ record['city']) print(C+"Isp:" +W+ record['isp']) print(C+"Domain:" +W+ record['domain']) print(C+"Usage:" +W+ record['usage_type']) print(C+"ASN:" +W+ record['asn']) print(C+"Name:" +W+ record['as_name']) api_key = ipstack() if api_key == "": print("Add your ipstack API key to src/api.py") exit() r = requests.get("http://api.ipstack.com/" + IP + "?access_key=" + api_key) response = r.json() print(C+"Latitude :"+W+" {latitude}".format(**response)) print(C+"Longitude :"+W+" {longitude}".format(**response)) if input(C+"Want More WHOIS Details? (Y/N): "+W): whois_more(IP) if response['latitude'] and response['longitude']: lats = response['latitude'] lons = response['longitude'] url = "https://maps.google.com/maps?q=%s,+%s" % (lats, lons) print(C+"Google Map Link: " +W+ url) else: print(G+"IP does not use any proxy or VPN") else: print(R+"\nEnter a valid IP Address") ip2Proxy() ch=input(C+"Redo (Y/N):"+W) if ch=="y" or ch=="Y": ip2Proxy() print("")
def isproxy(proxyip): # get versioning information versionDict = { 'Module Version': db.get_module_version(), 'Package Version': db.get_package_version(), 'Database Version': db.get_database_version(), } # Web Service ws = IP2Proxy.IP2ProxyWebService("demo", "PX11", True) rec = ws.lookup("89.208.35.79") # single function to get all proxy data returned in array # this returns a dict record = db.get_all(proxyip) userinput = input( 'if you want the info to be shown enter p otherwise enter c :') if userinput == 'p': print('Is Proxy: ' + str(record['is_proxy'])) print('Proxy Type: ' + record['proxy_type']) print('Country Code: ' + record['country_short']) print('Country Name: ' + record['country_long']) print('Region Name: ' + record['region']) print('City Name: ' + record['city']) print('ISP: ' + record['isp']) print('Domain: ' + record['domain']) print('Usage Type: ' + record['usage_type']) print('ASN: ' + record['asn']) print('AS Name: ' + record['as_name']) print('Last Seen: ' + record['last_seen']) print('Threat: ' + record['threat']) print('Provider: ' + record['provider']) print(versionDict['Module Version']) print(versionDict['Package Version']) print(versionDict['Database Version']) print("\n") print("Credit Remaining: {}\n".format(ws.getcredit())) else: pass # close IP2Proxy BIN database db.close() return versionDict, record
def get_location(): data = {} IP_address = request.remote_addr db = IP2Proxy.IP2Proxy() db.open("ahrvo/static/location_data/IP2PROXY-LITE-PX1.IPV6.CSV") check_proxy = db.is_proxy(str(IP_address)) if check_proxy == "-1" or check_proxy == -1: proxy = False else: proxy = True temp_proxy = {"proxy":proxy,"ip":IP_address} data.update(temp_proxy) IP2LocObj = IP2Location.IP2Location() IP2LocObj.open("ahrvo/static/location_data/IP2LOCATION-LITE-DB3.BIN") location = IP2LocObj.get_all(str(IP_address)) temp_location = {"country":location.country_long,"region":location.region,"city":location.city} data.update(temp_location) device_info = get_device_info() data.update(device_info) return data
def ip2Proxy(IP): if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", IP): db = IP2Proxy.IP2Proxy() db.open("./plugins/IP2PROXY-LITE-PX8.BIN") record = db.get_all(IP) db.close() if record['is_proxy'] != 0: #print(record) print("Proxy: " + "Enabled") print("Proxy Type:" + record['proxy_type']) print("Country Code:" + record['country_short']) print("Country:" + record['country_long']) print("Region Name:" + record['region']) print("City:" + record['city']) print("Isp:" + record['isp']) print("Domain:" + record['domain']) print("Usage:" + record['usage_type']) print("ASN:" + record['asn']) print("Name:" + record['as_name']) api_key = ipstack() if api_key == "": print("Add you ipstack api key to src/api.py") exit() r = requests.get("http://api.IPstack.com/" + IP + "?access_key=" + api_key) response = r.json() print("Latitude :" + " {latitude}".format(**response)) print("Longitude :" + " {longitude}".format(**response)) if input("Want More Whois Details (Y/N):") in ["Y", "y"]: whois_more(IP) if response['latitude'] and response['longitude']: lats = response['latitude'] lons = response['longitude'] url = "https://maps.google.com/maps?q=%s,+%s" % (lats, lons) print("Google Map Link :" + url) else: print("IP does not use any Proxy or VPN") else: print("\nEnter a Valid IP Address") print("")
# res = session.get(p).text print('trying : ' + p) res = getHTML(p) s = re.findall('[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}', res) ret.append(s) except Exception as e: ret.append(e.args) return ret """ REturns True if the IP provided is VPN/PROXY PROVIDER OR TOR exit node """ db = IP2Proxy.IP2Proxy() # open IP2Proxy BIN database for proxy lookup db.open("IP2PROXY-LITE-PX10.BIN") def isproxy(proxyip): # get versioning information versionDict = { 'Module Version': db.get_module_version(), 'Package Version': db.get_package_version(), 'Database Version': db.get_database_version(), } # Web Service ws = IP2Proxy.IP2ProxyWebService("demo", "PX11", True) rec = ws.lookup("89.208.35.79")
#!/usr/bin/python # #This script search the BIN files for the given IP # import kalchas_headers import os import IP2Location import IP2Proxy #Initialize the main functions Location2BIN = "IP2LOCATION-LITE-DB11.IPV6.BIN" Proxy2BIN = "IP2PROXY-LITE-PX4.BIN" proxy = IP2Proxy.IP2Proxy() location = IP2Location.IP2Location() #Get the real path which the bin files are saved location.open(os.path.realpath(Location2BIN)) proxy.open(os.path.realpath(Proxy2BIN)) def check_ip(ip): #Get all results for the given IP from IP2Proxy Lite proxyResults = proxy.get_all(ip) #GEt all results for the given IP from IP2Location Lite locationResults = location.get_all(ip) proxyConfirmation = str(proxy.is_proxy(ip))
def __init__(self): self.__db = IP2Proxy.IP2Proxy() path = os.getcwd() self.__db.open(path + "/proxydetectorfirewall/data/IP2PROXY.BIN")