diff --git a/vt.py b/vt.py old mode 100644 new mode 100755 index 9769c4d..8a95ac8 --- a/vt.py +++ b/vt.py @@ -8,11 +8,17 @@ import json, urllib, urllib2, argparse, hashlib, re, sys from pprint import pprint + class vtAPI(): def __init__(self): - self.api = '<--------------PRIVATE-API-KEY-GOES-HERE----->' - self.base = 'https://www.virustotal.com/vtapi/v2/' - + try: + your_private_api_key = '<--------------PRIVATE-API-KEY-GOES-HERE----->' + assert "KEY-GOES-HERE" not in your_private_api_key + self.api = your_private_api_key + self.base = 'https://www.virustotal.com/vtapi/v2/' + except AssertionError: + raise ValueError("Private API key not provided.") + def getReport(self,md5): param = {'resource':md5,'apikey':self.api,'allinfo': '1'} url = self.base + "file/report" diff --git a/vtlite.py b/vtlite.py old mode 100644 new mode 100755 index 8ef60e6..861d6a1 --- a/vtlite.py +++ b/vtlite.py @@ -8,11 +8,17 @@ import json, urllib, urllib2, argparse, hashlib, re, sys from pprint import pprint + class vtAPI(): def __init__(self): - self.api = '<--------------PUBLIC-API-KEY-GOES-HERE----->' - self.base = 'https://www.virustotal.com/vtapi/v2/' - + try: + your_public_api_key = '<--------------PUBLIC-API-KEY-GOES-HERE----->' + assert "KEY-GOES-HERE" not in your_public_api_key + self.api = your_public_api_key + self.base = 'https://www.virustotal.com/vtapi/v2/' + except AssertionError: + raise ValueError("Private API key not provided.") + def getReport(self,md5): param = {'resource':md5,'apikey':self.api} url = self.base + "file/report"