Beispiel #1
0
    def __init__(self, framework, parent=None):
        super(SearchDialog, self).__init__(parent)
        self.setupUi(self)

        self.connect(self, SIGNAL('finished()'), self.finishedHandler)

        self.framework = framework

        # progress dialog
        self.Progress = ProgressDialog(self)
        QObject.connect(self.Progress, SIGNAL('canceled()'), self.canceledHandler)

        self.searchRequestResponse = RequestResponseWidget(self.framework, self.searchTabWidget, self.searchSearchControlPlaceholder, self)

        self.searchResultsModel = ResponsesDataModel.ResponsesDataModel(self.framework, self)
        self.searchResultsTree.setModel(self.searchResultsModel)
        self.searchResultsTree.clicked.connect(self.fill_bottom)
        self.searchResultsTree.doubleClicked.connect(self.response_item_double_clicked)
        self.searchResultsTree.setSortingEnabled(True)
        self.searchResultsTree.sortByColumn(0, Qt.AscendingOrder)

        self.thread = SearchThread(self.framework, self.searchResultsModel)
        self.thread.start(QThread.LowestPriority)
        self.finished.connect(self.finishedHandler)
        self.searchPushButton.pressed.connect(self.startSearch)
        self.connect(self, SIGNAL('searchFinished()'), self.searchFinishedHandler, Qt.QueuedConnection)
        # Create context menu
        self.resultsContextMenu = ResponsesContextMenuWidget(self.framework, self.searchResultsModel, self.searchResultsTree, self)
        self.resultsContextMenu.set_currentChanged_callback(self.fill_bottom)
Beispiel #2
0
    def __init__(self, framework, parent=None):
        super(SearchDialog, self).__init__(parent)
        self.setupUi(self)

        self.connect(self, SIGNAL('finished()'), self.finishedHandler)

        self.framework = framework

        # progress dialog
        self.Progress = ProgressDialog(self)
        QObject.connect(self.Progress, SIGNAL('canceled()'),
                        self.canceledHandler)

        self.searchRequestResponse = RequestResponseWidget(
            self.framework, self.searchTabWidget,
            self.searchSearchControlPlaceholder, self)

        self.searchResultsModel = ResponsesDataModel.ResponsesDataModel(
            self.framework, self)
        self.searchResultsTree.setModel(self.searchResultsModel)
        self.searchResultsTree.clicked.connect(self.fill_bottom)
        self.searchResultsTree.doubleClicked.connect(
            self.response_item_double_clicked)
        self.searchResultsTree.setSortingEnabled(True)
        self.searchResultsTree.sortByColumn(0, Qt.AscendingOrder)

        self.thread = SearchThread(self.framework, self.searchResultsModel)
        self.thread.start(QThread.LowestPriority)
        self.finished.connect(self.finishedHandler)
        self.searchPushButton.pressed.connect(self.startSearch)
        self.connect(self, SIGNAL('searchFinished()'),
                     self.searchFinishedHandler, Qt.QueuedConnection)
        # Create context menu
        self.resultsContextMenu = ResponsesContextMenuWidget(
            self.framework, self.searchResultsModel, self.searchResultsTree,
            self)
        self.resultsContextMenu.set_currentChanged_callback(self.fill_bottom)
Beispiel #3
0
class SearchDialog(QDialog, SearchDialog.Ui_SearchDialog):
    """ The search dialog """
    def __init__(self, framework, parent=None):
        super(SearchDialog, self).__init__(parent)
        self.setupUi(self)

        self.connect(self, SIGNAL('finished()'), self.finishedHandler)

        self.framework = framework

        # progress dialog
        self.Progress = ProgressDialog(self)
        QObject.connect(self.Progress, SIGNAL('canceled()'),
                        self.canceledHandler)

        self.searchRequestResponse = RequestResponseWidget(
            self.framework, self.searchTabWidget,
            self.searchSearchControlPlaceholder, self)

        self.searchResultsModel = ResponsesDataModel.ResponsesDataModel(
            self.framework, self)
        self.searchResultsTree.setModel(self.searchResultsModel)
        self.searchResultsTree.clicked.connect(self.fill_bottom)
        self.searchResultsTree.doubleClicked.connect(
            self.response_item_double_clicked)
        self.searchResultsTree.setSortingEnabled(True)
        self.searchResultsTree.sortByColumn(0, Qt.AscendingOrder)

        self.thread = SearchThread(self.framework, self.searchResultsModel)
        self.thread.start(QThread.LowestPriority)
        self.finished.connect(self.finishedHandler)
        self.searchPushButton.pressed.connect(self.startSearch)
        self.connect(self, SIGNAL('searchFinished()'),
                     self.searchFinishedHandler, Qt.QueuedConnection)
        # Create context menu
        self.resultsContextMenu = ResponsesContextMenuWidget(
            self.framework, self.searchResultsModel, self.searchResultsTree,
            self)
        self.resultsContextMenu.set_currentChanged_callback(self.fill_bottom)

    def response_item_double_clicked(self, index):
        Id = interface.index_to_id(self.searchResultsModel, index)
        if Id:
            dialog = RequestResponseDetailDialog(self.framework, str(Id), self)
            dialog.show()
            dialog.exec_()

    def fill_bottom(self, index):
        if self.searchFilling:
            return
        Id = interface.index_to_id(self.searchResultsModel, index)
        if Id:
            self.searchRequestResponse.fill(str(Id))
            self.searchRequestResponse.set_search_info(
                str(self.searchText.text()).strip(),
                self.cbRegularExpression.isChecked())

    def startSearch(self):
        text = str(self.searchText.text()).strip()
        if 0 == len(text):
            return
        options = {
            'CaseSensitive': self.cbCaseSensitive.isChecked(),
            'RegularExpression': self.cbRegularExpression.isChecked(),
            'InvertSearch': self.cbInvertSearch.isChecked(),
            'Wildcard': self.cbWildcard.isChecked(),
        }
        locations = {
            'RequestHeaders': self.cbRequestHeaders.isChecked(),
            'RequestBody': self.cbRequestBody.isChecked(),
            'ResponseHeaders': self.cbResponseHeaders.isChecked(),
            'ResponseBody': self.cbResponseBody.isChecked(),
            'RequestUrl': self.cbRequestUrl.isChecked(),
            'AnalystNotes': self.cbAnalystNotes.isChecked(),
        }
        searchCriteria = SearchCriteria(text, options, locations)
        self.Progress.show()
        self.searchFilling = True
        self.searchRequestResponse.clear()
        self.searchResultsTree.clearSelection()
        self.searchResultsModel.clearModel()
        self.thread.startSearch(searchCriteria, self)

    def searchFinishedHandler(self):
        self.Progress.reset()
        self.searchFilling = False

    def finishedHandler(self, code):
        self.thread.emit(SIGNAL('quit()'))

    def canceledHandler(self):
        if self.Progress.wasCanceled():
            self.thread.stopSearch()

    def finishedHandler(self):
        self.thread.quit()
Beispiel #4
0
class SearchDialog(QDialog, SearchDialog.Ui_SearchDialog):
    """ The search dialog """
    
    def __init__(self, framework, parent=None):
        super(SearchDialog, self).__init__(parent)
        self.setupUi(self)

        self.connect(self, SIGNAL('finished()'), self.finishedHandler)

        self.framework = framework

        # progress dialog
        self.Progress = ProgressDialog(self)
        QObject.connect(self.Progress, SIGNAL('canceled()'), self.canceledHandler)

        self.searchRequestResponse = RequestResponseWidget(self.framework, self.searchTabWidget, self.searchSearchControlPlaceholder, self)

        self.searchResultsModel = ResponsesDataModel.ResponsesDataModel(self.framework, self)
        self.searchResultsTree.setModel(self.searchResultsModel)
        self.searchResultsTree.clicked.connect(self.fill_bottom)
        self.searchResultsTree.doubleClicked.connect(self.response_item_double_clicked)
        self.searchResultsTree.setSortingEnabled(True)
        self.searchResultsTree.sortByColumn(0, Qt.AscendingOrder)

        self.thread = SearchThread(self.framework, self.searchResultsModel)
        self.thread.start(QThread.LowestPriority)
        self.finished.connect(self.finishedHandler)
        self.searchPushButton.pressed.connect(self.startSearch)
        self.connect(self, SIGNAL('searchFinished()'), self.searchFinishedHandler, Qt.QueuedConnection)
        # Create context menu
        self.resultsContextMenu = ResponsesContextMenuWidget(self.framework, self.searchResultsModel, self.searchResultsTree, self)
        self.resultsContextMenu.set_currentChanged_callback(self.fill_bottom)

    def response_item_double_clicked(self, index):
        Id = interface.index_to_id(self.searchResultsModel, index)
        if Id:
            dialog = RequestResponseDetailDialog(self.framework, str(Id), self)
            dialog.show()
            dialog.exec_()

    def fill_bottom(self, index):
        if self.searchFilling:
            return
        Id = interface.index_to_id(self.searchResultsModel, index)
        if Id:
            self.searchRequestResponse.fill(str(Id))
            self.searchRequestResponse.set_search_info(str(self.searchText.text()).strip(), self.cbRegularExpression.isChecked())

    def startSearch(self):
        text = str(self.searchText.text()).strip()
        if 0 == len(text):
            return
        options = {
            'CaseSensitive' : self.cbCaseSensitive.isChecked(),
            'RegularExpression' : self.cbRegularExpression.isChecked(),
            'InvertSearch' : self.cbInvertSearch.isChecked(),
            'Wildcard' : self.cbWildcard.isChecked(),
            }
        locations = {
            'RequestHeaders' : self.cbRequestHeaders.isChecked(),
            'RequestBody' : self.cbRequestBody.isChecked(),
            'ResponseHeaders' : self.cbResponseHeaders.isChecked(),
            'ResponseBody' : self.cbResponseBody.isChecked(),
            'RequestUrl' : self.cbRequestUrl.isChecked(),
            'AnalystNotes' : self.cbAnalystNotes.isChecked(),
            }
        searchCriteria = SearchCriteria(text, options, locations)
        self.Progress.show()
        self.searchFilling = True
        self.searchRequestResponse.clear()
        self.searchResultsTree.clearSelection()
        self.searchResultsModel.clearModel()
        self.thread.startSearch(searchCriteria, self)

    def searchFinishedHandler(self):
        self.Progress.reset()
        self.searchFilling = False

    def finishedHandler(self, code):
        self.thread.emit(SIGNAL('quit()'))

    def canceledHandler(self):
        if self.Progress.wasCanceled():
            self.thread.stopSearch()
    
    def finishedHandler(self):
        self.thread.quit()