def query_ip(query): logger.info("IP query received for \"%s\"" % (query)) if not ip.is_valid_ipv4(query): response = make_response() response.status_code = 404 return response output = {} output["arin"] = ip.arin(query) output["geoip"] = ip.geoip(query, geoip_file=app.config['GEOIP_FILE']) output["reversedns"] = ip.reversedns(query) output["shodan"] = ip.shodanquery(query, api_key=app.config['SHODAN_API_KEY']) response_code = 200 return response_json(output, response_code=response_code)
def query_dns(query): logger.info("DNS query received for \"%s\"" % (query)) if not ip.is_valid_domain(query): response = make_response() response.status_code = 404 return response output = {} output["dns"] = ip.dnsquery(query) output["whois"] = ip.whois(query) output["shodan"] = ip.shodanquery(query, api_key=app.config['SHODAN_API_KEY']) output["resources"] = [ {"name":"Built With - Display the technology 'profile' of a website", "value":"http://builtwith.com/" + query}, {"name":"Snapito - Website Screenshot", "value":"http://snapito.com/?url=%s&freshness=86400" % (query)} ] response_code = 200 return response_json(output, response_code=response_code)