99
1010# XXX: the tab index may vary. TODO: Find it dynamically.
1111VT_TAB = 3
12+ VT_TAB_NAME = "vt_tab"
13+ VT_URL = "https://www.virustotal.com/gui"
1214
1315def build_vt_tab (plugin , parent ):
1416 """add a new tab with a text field that will contain the result of the query in JSON format.
@@ -18,7 +20,7 @@ def build_vt_tab(plugin, parent):
1820 # FIXME: find the widget with the name 'vt_tab', there could be more
1921 # plugins that are tabs.
2022 prev_wdg = parent .get_main_widget ().widget (VT_TAB )
21- if prev_wdg != None and prev_wdg .objectName () == "vt_tab" :
23+ if prev_wdg != None and prev_wdg .objectName () == VT_TAB_NAME :
2224 return prev_wdg
2325
2426 wdg = QtWidgets .QWidget ()
@@ -39,7 +41,7 @@ def build_vt_tab(plugin, parent):
3941 # https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QTextBrowser.html#PySide6.QtWidgets.QTextBrowser.openExternalLinks
4042 textWdg .setOpenExternalLinks (True )
4143 textWdg .setOpenLinks (True )
42- wdg .setObjectName ("vt_tab" )
44+ wdg .setObjectName (VT_TAB_NAME )
4345 gridLayout .setContentsMargins (5 , 3 , 5 , 5 )
4446 gridLayout .setVerticalSpacing (3 )
4547
@@ -69,16 +71,14 @@ def add_vt_response(parent, response, conn, error=None):
6971 md5 = conn .process_checksums [Config .OPERAND_PROCESS_HASH_MD5 ]
7072 dstip = conn .dst_ip
7173 dsthost = conn .dst_host
72- vturl = "https://www.virustotal.com/gui"
73- vthash = f"{ vturl } /file/{ md5 } "
74- vtip = f"{ vturl } /ip-address/{ dstip } "
75-
74+ vthash = f"{ VT_URL } /file/{ md5 } "
75+ vtip = f"{ VT_URL } /ip-address/{ dstip } "
7676 links = "View on VirusTotal: "
7777 links += f"<a href=\" { vtip } \" >IP</a>"
7878 if md5 != "" :
7979 links += f" – <a href=\" { vthash } \" >hash</a>"
8080 if dsthost != "" :
81- vtdomain = f"{ vturl } /domain/{ dsthost } "
81+ vtdomain = f"{ VT_URL } /domain/{ dsthost } "
8282 links += f" – <a target=\" _blank\" href=\" { vtdomain } \" >domain</a>"
8383
8484 textWdg .setHtml (links + "<br><br>" + _utils .report_to_html (response ))
0 commit comments