def checkIpDetails(query=None):
    ''' 
        Method that checks if the given hash is stored in the md5crack.com website. An example of the json received:
        {
            "as": "AS8560 1\u00261 Internet AG",
            "city": "",
            "country": "Germany",
            "countryCode": "DE",
            "isp": "1\u00261 Internet AG",
            "lat": 51,
            "lon": 9,
            "org": "1\u00261 Internet AG",
            "query": "217.160.251.126",
            "region": "",
            "regionName": "",
            "status": "success",
            "timezone": "",
            "zip": ""
        }

        :param query:    Query to verify. It can be either a domain or an IPv4 address.

        :return:    Python structure for the json received. If nothing was found, it will return an empty dictionary.
        [
          {
            "attributes": [
              {
                "attributes": [], 
                "type": "i3visio.text", 
                "value": "DE"
              }
            ], 
            "type": "i3visio.location.country", 
            "value": "Germany"
          }, 
          {
            "attributes": [], 
            "type": "i3visio.text", 
            "value": "1&1 Internet AG"
          }, 
          {
            "attributes": [], 
            "type": "i3visio.ipv4", 
            "value": "217.160.129.99"
          }, 
          {
            "attributes": [], 
            "type": "i3visio.location.geo", 
            "value": "51, 9"
          }
        ]        
    '''
    try:    
        apiURL = "http://ip-api.com/json/" + query


        # Accessing the ip-api.com RESTful API
        data = urllib2.urlopen(apiURL).read()

        # Reading the text data onto python structures
        apiData = json.loads(data)
        
        # i3visio structure to be returned
        jsonData = []
       
        if apiData["status"] == "success":
            for key in apiData:
                value = apiData[key]
                if value != "":
                    aux = {}
                    if key == "city":
                        aux["type"] = "i3visio.location." + key
                        aux["value"] = value
                        aux["attributes"] = []
                        # Appending to the list of results                        
                        jsonData.append(aux)
                    elif key == "country":
                        aux["type"] = "i3visio.location." + key
                        aux["value"] = value
                        # Adding a new attribute
                        att ={}
                        att["type"] = "i3visio.text"
                        att["value"] = apiData["countryCode"]
                        att["attributes"] = []
                        aux["attributes"] = [att]
                        # Appending to the list of results
                        jsonData.append(aux)
                    elif key == "isp":
                        aux["type"] = "i3visio.text"
                        aux["value"] = value
                        aux["attributes"] = []
                        # Appending to the list of results                        
                        jsonData.append(aux)                        
                    elif key == "lat":
                        aux["type"] = "i3visio.location.geo"
                        aux["value"] = str(apiData["lat"]) + ", " + str(apiData["lon"])
                        aux["attributes"] = []
                        # Appending to the list of results                        
                        jsonData.append(aux)
                    elif key == "region":
                        aux["type"] = "i3visio.location.province"
                        aux["value"] = value
                        # Adding a new attribute
                        att ={}
                        att["type"] = "i3visio.text"
                        att["value"] = apiData["regionName"]
                        att["attributes"] = []                        
                        aux["attributes"] = [att]
                        # Appending to the list of results                        
                        jsonData.append(aux)
                    elif key == "timezone":
                        aux["type"] = "i3visio.text"
                        aux["value"] = value
                        aux["attributes"] = []
                        # Appending to the list of results                        
                        jsonData.append(aux)                        
                    elif key == "zip":
                        aux["type"] = "i3visio.location.postalcode"
                        aux["value"] = value
                        aux["attributes"] = []
                        # Appending to the list of results                        
                        jsonData.append(aux)                        
                    elif key == "query":
                        aux["type"] = "i3visio.ipv4"
                        aux["value"] = value
                        aux["attributes"] = []
                        # Appending to the list of results                        
                        jsonData.append(aux)                        
            
        #print json.dumps(jsonData, indent = 2)
        return jsonData
    except:
        # No information was found, then we return a null entity
        return {}
def checkIpDetails ( query = None ) : try : apiURL = "http://ip-api.com/json/" + query data = urllib2 . urlopen ( apiURL ) . read ( ) apiData = json . loads ( data ) jsonData = [ ] if apiData [ "status" ] == "success" : for key in apiData : value = apiData [ key ] if value != "" : aux = { } if key == "city" : aux [ "type" ] = "i3visio.location." + key aux [ "value" ] = value aux [ "attributes" ] = [ ] jsonData . append ( aux ) elif key == "country" : aux [ "type" ] = "i3visio.location." + key aux [ "value" ] = value att = { } att [ "type" ] = "i3visio.text" att [ "value" ] = apiData [ "countryCode" ] att [ "attributes" ] = [ ] aux [ "attributes" ] = [ att ] jsonData . append ( aux ) elif key == "isp" : aux [ "type" ] = "i3visio.text" aux [ "value" ] = value aux [ "attributes" ] = [ ] jsonData . append ( aux ) elif key == "lat" : aux [ "type" ] = "i3visio.location.geo" aux [ "value" ] = str ( apiData [ "lat" ] ) + ", " + str ( apiData [ "lon" ] ) aux [ "attributes" ] = [ ] jsonData . append ( aux ) elif key == "region" : aux [ "type" ] = "i3visio.location.province" aux [ "value" ] = value att = { } att [ "type" ] = "i3visio.text" att [ "value" ] = apiData [ "regionName" ] att [ "attributes" ] = [ ] aux [ "attributes" ] = [ att ] jsonData . append ( aux ) elif key == "timezone" : aux [ "type" ] = "i3visio.text" aux [ "value" ] = value aux [ "attributes" ] = [ ] jsonData . append ( aux ) elif key == "zip" : aux [ "type" ] = "i3visio.location.postalcode" aux [ "value" ] = value aux [ "attributes" ] = [ ] jsonData . append ( aux ) elif key == "query" : aux [ "type" ] = "i3visio.ipv4" aux [ "value" ] = value aux [ "attributes" ] = [ ] jsonData . append ( aux ) return jsonData except : return { }
Method that checks if the given hash is stored in the md5crack.com website. An example of the json received:
        {
            "as": "AS8560 1\u00261 Internet AG",
            "city": "",
            "country": "Germany",
            "countryCode": "DE",
            "isp": "1\u00261 Internet AG",
            "lat": 51,
            "lon": 9,
            "org": "1\u00261 Internet AG",
            "query": "217.160.251.126",
            "region": "",
            "regionName": "",
            "status": "success",
            "timezone": "",
            "zip": ""
        }

        :param query:    Query to verify. It can be either a domain or an IPv4 address.

        :return:    Python structure for the json received. If nothing was found, it will return an empty dictionary.
        [
          {
            "attributes": [
              {
                "attributes": [], 
                "type": "i3visio.text", 
                "value": "DE"
              }
            ], 
            "type": "i3visio.location.country", 
            "value": "Germany"
          }, 
          {
            "attributes": [], 
            "type": "i3visio.text", 
            "value": "1&1 Internet AG"
          }, 
          {
            "attributes": [], 
            "type": "i3visio.ipv4", 
            "value": "217.160.129.99"
          }, 
          {
            "attributes": [], 
            "type": "i3visio.location.geo", 
            "value": "51, 9"
          }
        ]