def ip_lookup(ip): ''' Lookup IP information VirusTotal. ''' # Query response_dict = "" try: # Check cache cache = load_cache(ip) if cache: return cache # Query VT ip_parameters = {'ip': ip, 'apikey': API_KEY} response = urllib.urlopen('%s?%s' % (ip_query_url, urllib.urlencode(ip_parameters))).read() response_dict = json.loads(response) # Cache results dump_cache(ip, response_dict) except Exception as e: exit(e) return response_dict
def sample_lookup(hash): # Query response_dict = "" try: # Check cache cache = load_cache(hash) if cache: return cache # Query VT hash_parameters = {'resource': hash, 'apikey': API_KEY} response = urllib.urlopen('%s?%s' % (file_url, urllib.urlencode(hash_parameters))).read() response_dict = json.loads(response) # Cache results dump_cache(hash, response_dict) except Exception as e: exit(e) return response_dict
def domain_lookup(domain): ''' Lookup domain information VirusTotal. ''' # Query response_dict = "" try: # Check cache cache = load_cache(domain) if cache: return cache # Query VT domain_parameters = {'domain': domain, 'apikey': API_KEY} response = urllib.urlopen('%s?%s' % (domain_query_url, urllib.urlencode(domain_parameters))).read() response_dict = json.loads(response) # Cache results dump_cache(domain, response_dict) except Exception as e: exit(e) return response_dict
def ip_lookup(ip): ''' Lookup IP information VirusTotal. ''' # Query response_dict = "" try: # Check cache cache = load_cache(ip) if cache: return cache # Query VT ip_parameters = {'ip': ip, 'apikey': API_KEY} response = urllib.urlopen( '%s?%s' % (ip_query_url, urllib.urlencode(ip_parameters))).read() response_dict = json.loads(response) # Cache results dump_cache(ip, response_dict) except Exception as e: exit(e) return response_dict
def domain_lookup(domain): ''' Lookup domain information VirusTotal. ''' # Query response_dict = "" try: # Check cache cache = load_cache(domain) if cache: return cache # Query VT domain_parameters = {'domain': domain, 'apikey': API_KEY} response = urllib.urlopen( '%s?%s' % (domain_query_url, urllib.urlencode(domain_parameters))).read() response_dict = json.loads(response) # Cache results dump_cache(domain, response_dict) except Exception as e: exit(e) return response_dict