Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Function to check a hash on VirusTotal and get the report summary

@param md5: The MD5 to check (hexdigest)
@param vtKey: The VirusTotal API key needed to perform the request
@return: A dictionary with the result of the request

        def vtcheck(md5, vtKey):
    '''
        Function to check a hash on VirusTotal and get the report summary
        
        @param md5: The MD5 to check (hexdigest)
        @param vtKey: The VirusTotal API key needed to perform the request
        @return: A dictionary with the result of the request
    '''
    vtUrl = 'https://www.virustotal.com/vtapi/v2/file/report'
    parameters = {'resource':md5,'apikey':vtKey}
    try:
        data = urllib.urlencode(parameters)
        req = urllib2.Request(vtUrl, data)
        response = urllib2.urlopen(req)
        jsonResponse = response.read()
    except:
        return (-1, 'The request to VirusTotal has not been successful')
    try:
        jsonDict = json.loads(jsonResponse)
    except:
        return (-1, 'An error has occurred while parsing the JSON response from VirusTotal')
    return (0, jsonDict)
        


src/t/h/thug-HEAD/src/peepdf/peepdf.py   thug(Download)
from datetime import datetime
from PDFCore import PDFParser, vulnsDict
from PDFUtils import vtcheck
 
VT_KEY = 'fc90df3f5ac749a94a94cb8bf87e05a681a2eb001aef34b6a0084b8c22c97a64'
                # Checks the MD5 on VirusTotal
                md5Hash = pdf.getMD5()
                ret = vtcheck(md5Hash, VT_KEY)
                if ret[0] == -1:
                    pdf.addError(ret[1])