1
1
#Copyright (c) 2018 Ryan Boyle randomrhythm@rhythmengineering.com.
2
- #All rights reserved.
3
2
4
3
#This program is free software: you can redistribute it and/or modify
5
4
#it under the terms of the GNU General Public License as published by
@@ -27,8 +26,7 @@ def run(self):
27
26
dictTIA = {'BitDefender' : None , 'TrendMicro' : None , 'Symantec' : None , 'F-Secure' : None , 'ESET-NOD32' : None , 'DrWeb' : None , 'Avira' : None , 'AntiVir' : None , 'Microsoft' : None , 'Sophos' : None , 'Panda' : None , 'BitDefender' : None , 'McAfee' : None , 'ClamAV' : None }
28
27
key = self .options .get ("key" , None )
29
28
if not key :
30
- raise CuckooProcessingError ("TIA API key not "
31
- "configured, skip" )
29
+ raise CuckooProcessingError ("TIA API key not configured, skip" )
32
30
response_data = ""
33
31
queryStringPart = ""
34
32
#print self.results["virustotal"]["results"]
@@ -50,7 +48,7 @@ def run(self):
50
48
try :
51
49
json_object = json .loads (response_data )
52
50
except ValueError , e :
53
- CuckooProcessingError ("TIA error processing combined JSON: " + response_data )
51
+ raise CuckooProcessingError ("TIA error processing combined JSON: " + response_data )
54
52
#print json_object
55
53
return json_object
56
54
@@ -59,19 +57,18 @@ def tia_request(vendorQueryString, apikey): #performs HTTP GET against TIA API a
59
57
data = {"ApiKey" : apikey }
60
58
timeout = 60
61
59
try :
62
- r = requests .get (url , params = data , verify = True , timeout = int ( timeout ))
60
+ r = requests .get (url , params = data , verify = True , timeout = timeout ) #set verify=False to bypass certificate verification
63
61
64
62
except requests .exceptions .RequestException as e :
65
- raise CuckooProcessingError ("Unable to complete connection "
66
- "to TIA: {0}" .format (e ))
63
+ raise CuckooProcessingError ("Unable to complete connection to TIA: {0}" .format (e ))
67
64
return r .content
68
65
69
66
def combineTIAresults (queryStringPart , vendorname , detectionName ):
70
67
queryStringPieces = queryStringPart
71
68
if queryStringPieces == "" :
72
- queryStringPieces = vendorname + "=" + detectionName
69
+ queryStringPieces = "%s=%s" % ( vendorname , detectionName )
73
70
else :
74
- queryStringPieces = queryStringPieces + "&" + vendorname + "=" + detectionName
71
+ queryStringPieces = queryStringPieces + "&" + "%s=%s" % ( vendorname , detectionName )
75
72
return queryStringPieces
76
73
77
74
def is_json (myjson ):
0 commit comments