Skip to content

Instantly share code, notes, and snippets.

@thekindlyone
Created December 20, 2014 14:44
Show Gist options
  • Save thekindlyone/e086628d7f2fb79a9a6d to your computer and use it in GitHub Desktop.
Save thekindlyone/e086628d7f2fb79a9a6d to your computer and use it in GitHub Desktop.
import json
import urllib
tmp=open("tmp.txt","a")
url = 'https://www.virustotal.com/vtapi/v2/ip-address/report'
parameters = {'ip': '50.7.189.194', 'apikey': '54ea2f1b2adf87f75eb1c8bbf7aefac361e869d66cc7d8d6b70f084c25cf3e2f'}
response = urllib.urlopen('%s?%s' % (url, urllib.urlencode(parameters))).read()
response_dict = json.loads(response)
resp_code=response_dict.get("response_code")
if resp_code==1:
mesg=response_dict.get("verbose_msg")
print mesg
reso=response_dict.get("resolutions")
print "\nResolutions:\n"
for line in reso:
print >>tmp,'{} {}'.format(line["last_resolved"],line["hostname"])
print "\nLatest URLs hosted in this IP address detected by at least one URL scanner or malicious URL datase:\n"
detected=response_dict.get("detected_urls")
for line in detected:
print line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment