-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVTGui.py
More file actions
58 lines (43 loc) · 1.43 KB
/
VTGui.py
File metadata and controls
58 lines (43 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/python
import sys
import urllib2
import urllib
import json
from PyQt4.QtCore import *
from PyQt4.QtGui import *
VIRUSTOTAL_API2_KEY = ''
VIRUSTOTAL_REPORT_URL = "https://www.virustotal.com/vtapi/v2/file/report"
class Form(QDialog):
def __init__(self,parent=None):
super(Form,self).__init__(parent)
self.hash_label = QLabel("Hash: ")
self.lineedit = QLineEdit("paste in a file hash")
self.result_label = QLabel("Results: ")
self.scanner_label = QLabel("<b><font color=green>0/0</font></b>")
self.setGeometry(200,200,600,50)
grid = QGridLayout()
grid.addWidget(self.hash_label,0,0)
grid.addWidget(self.lineedit,0,1)
grid.addWidget(self.result_label,1,0)
grid.addWidget(self.scanner_label,1,1)
self.setLayout(grid)
self.connect(self.lineedit,SIGNAL("returnPressed()"), self.updateUi)
def updateUi(self):
self.scanner_label.setText(self.VTScan())
def VTScan(self):
searchTerm = self.lineedit.text()
webForms = {'resource':searchTerm,'apikey':VIRUSTOTAL_API2_KEY}
req = urllib2.Request(VIRUSTOTAL_REPORT_URL,urllib.urlencode(webForms))
hRequest = urllib2.urlopen(req, timeout=15)
data = hRequest.read()
data = json.loads(data)
pos = data['positives']
total = data['total']
if pos > 0:
return "<b><font color=red>%s / %s</font></b>" % (pos, total)
else:
return "<b><font color=green>%s / %s</font></b>" % (pos, total)
app = QApplication(sys.argv)
form = Form()
form.show()
app.exec_()