Exemplo n.º 1
0
 def buttonClicked(self):
     sender = self.sender()
     btnName = sender.objectName()[3:]
     if btnName == 'Register':
         self.registerButtonClicked()
     elif btnName == 'SaveProfile':
         self.saveProfileButtonClicked()
     elif btnName == 'RemoveProfile':
         self.removeProfileButtonClicked()
     elif btnName == 'ReloadBinaries':
         self.queryAll()
     elif btnName == 'RefreshBinary':
         self.reprocess(self.ui.listBins.currentItem().text())
     elif btnName == 'DownloadBinary':
         if self.ui.listBins.currentItem() is not None:
             self.download(self.ui.listBins.currentItem().text(), False)
     elif btnName == 'DownloadChildBinary':
         if self.ui.listChildren.currentItem() is not None:
             self.download(self.ui.listChildren.currentItem().text(), True)
     elif btnName == 'ReloadSimilarBins':
         self.reloadSimilarBinsClicked()
     elif btnName == 'DownloadMatchedBin':
         hash = self.ui.listMatchedBins.currentItem().text()
         if hash != '':
             self.download(hash, False)
     elif btnName == 'ReloadMatchedProcs':
         self.ReloadMatchedProcsClicked()
     elif btnName == 'HighlightColorChooser':
         color = QtGui.QColorDialog.getColor()
         css = 'background-color: rgb(%s, %s, %s);'%(
             str(color.red()), str(color.green()), str(color.blue()))
         self.ui.btnHighlightColorChooser.setStyleSheet(css)
     elif btnName == 'RemoveHighlights':
         funcs = VBIDAHelper.getFunctions()            
         for func in funcs:
             VBIDAHelper.delFunctionComment(func)
             VBIDAHelper.setFunctionColor(func, 0xff, 0xff, 0xff)
         
         self.notifyStatus({
             'statuscode': 0,
             'message': 'Highlights has been removed'
         })
     elif btnName == 'HighlightAllProcs':
         self.highlightMatchedProcs()
     elif btnName == 'ShowProcsWithSim':
         c = VBFunctionChooser("Procedures with Matches", False, self.matchedProcsCache)
         c.Show()
     elif btnName == 'ShowMatchedProcs':
         if self.ui.listProcsWithSim.currentItem() is not None:
             rvaStr = self.ui.listProcsWithSim.currentItem().text()
             self.openMatchedProcsChooser(rvaStr)
         else:
             self.notifyStatus({
                 'statuscode': 1,
                 'message': 'No procedure has been selected'
             })
     elif btnName == 'MatchedLeftProcMoreInfo':
         print "This feature will be added on the next release."
         # if self.ui.listProcsWithSim.currentItem() is not None:
         #     rva = self.ui.listProcsWithSim.currentItem().text()
         #     hash = self.openedFileHash
         #     # dissViewer = VBDisassemblyViewer(self.juiciesCache.read(hash)[rva])
         #     # print dissViewer.Show()
         # else:
         #     self.notifyStatus({
         #         'statuscode': 1,
         #         'message': 'No procedure has been selected'
         #     })                        
         # disassemblyInfo = self.juiciesCache.read(self.openedFileHash)[rva]
     elif btnName == 'MatchedRightProcMoreInfo':
         print "This feature will be added on the next release."
     elif btnName == 'ShowChild':
         childHash = self.ui.editChildHash.text()
         childSName = self.ui.editChildServiceName.text()
         self.showChildView(childHash, childSName)
     elif btnName == 'ShowBinOther':
         if self.ui.listBins.currentItem() is not None:
             hash = self.ui.listBins.currentItem().text()
             self.ui.editOtherSHA.setText(hash)
             self.ui.toolBox.setCurrentIndex(2)
     elif btnName == 'ReloadOther':
         tabIndex = self.ui.tabWidgetOther.currentIndex()
         if tabIndex == 0:
             self.otherInfosAvailability['avscans'] = False
         elif tabIndex == 1:
             self.otherInfosAvailability['behaviors'] = False
         elif tabIndex == 2:
             self.otherInfosAvailability['pedata'] = False
         self.tabWidgetOtherChanged(tabIndex)
     else:
         self.status('idle', 'black')
Exemplo n.º 2
0
    def buttonClicked(self):
        sender = self.sender()
        btnName = sender.objectName()[3:]
        if btnName == 'Register':
            self.registerButtonClicked()
        elif btnName == 'SaveProfile':
            self.saveProfileButtonClicked()
        elif btnName == 'RemoveProfile':
            self.removeProfileButtonClicked()
        elif btnName == 'ReloadBinaries':
            self.queryAll()
        elif btnName == 'RefreshBinary':
            self.reprocess(self.ui.listBins.currentItem().text())
        elif btnName == 'DownloadBinary':
            if self.ui.listBins.currentItem() is not None:
                self.download(self.ui.listBins.currentItem().text(), False)
        elif btnName == 'DownloadChildBinary':
            if self.ui.listChildren.currentItem() is not None:
                self.download(self.ui.listChildren.currentItem().text(), True)
        elif btnName == 'ReloadSimilarBins':
            self.reloadSimilarBinsClicked()
        elif btnName == 'DownloadMatchedBin':
            hash = self.ui.listMatchedBins.currentItem().text()
            if hash != '':
                self.download(hash, False)
        elif btnName == 'ReloadMatchedProcs':
            self.ReloadMatchedProcsClicked()
        elif btnName == 'HighlightColorChooser':
            color = QtGui.QColorDialog.getColor()
            css = 'background-color: rgb(%s, %s, %s);' % (str(
                color.red()), str(color.green()), str(color.blue()))
            self.ui.btnHighlightColorChooser.setStyleSheet(css)
        elif btnName == 'RemoveHighlights':
            funcs = VBIDAHelper.getFunctions()
            for func in funcs:
                VBIDAHelper.delFunctionComment(func)
                VBIDAHelper.setFunctionColor(func, 0xff, 0xff, 0xff)

            self.notifyStatus({
                'statuscode': 0,
                'message': 'Highlights has been removed'
            })
        elif btnName == 'HighlightAllProcs':
            self.highlightMatchedProcs()
        elif btnName == 'ShowProcsWithSim':
            c = VBFunctionChooser("Procedures with Matches", False,
                                  self.matchedProcsCache)
            c.Show()
        elif btnName == 'ShowMatchedProcs':
            if self.ui.listProcsWithSim.currentItem() is not None:
                rvaStr = self.ui.listProcsWithSim.currentItem().text()
                self.openMatchedProcsChooser(rvaStr)
            else:
                self.notifyStatus({
                    'statuscode': 1,
                    'message': 'No procedure has been selected'
                })
        elif btnName == 'MatchedLeftProcMoreInfo':
            print "This feature will be added on the next release."
            # if self.ui.listProcsWithSim.currentItem() is not None:
            #     rva = self.ui.listProcsWithSim.currentItem().text()
            #     hash = self.openedFileHash
            #     # dissViewer = VBDisassemblyViewer(self.juiciesCache.read(hash)[rva])
            #     # print dissViewer.Show()
            # else:
            #     self.notifyStatus({
            #         'statuscode': 1,
            #         'message': 'No procedure has been selected'
            #     })
            # disassemblyInfo = self.juiciesCache.read(self.openedFileHash)[rva]
        elif btnName == 'MatchedRightProcMoreInfo':
            print "This feature will be added on the next release."
        elif btnName == 'ShowChild':
            childHash = self.ui.editChildHash.text()
            childSName = self.ui.editChildServiceName.text()
            self.showChildView(childHash, childSName)
        elif btnName == 'ShowBinOther':
            if self.ui.listBins.currentItem() is not None:
                hash = self.ui.listBins.currentItem().text()
                self.ui.editOtherSHA.setText(hash)
                self.ui.toolBox.setCurrentIndex(2)
        elif btnName == 'ReloadOther':
            tabIndex = self.ui.tabWidgetOther.currentIndex()
            if tabIndex == 0:
                self.otherInfosAvailability['avscans'] = False
            elif tabIndex == 1:
                self.otherInfosAvailability['behaviors'] = False
            elif tabIndex == 2:
                self.otherInfosAvailability['pedata'] = False
            self.tabWidgetOtherChanged(tabIndex)
        else:
            self.status('idle', 'black')