Пример #1
0
    def importTrace(self, event, trace):
        importDialog = gtk.Dialog(title=_("Import selected Trace in a project"), flags=0, buttons=None)
        panel = gtk.Table(rows=4, columns=2, homogeneous=False)
        panel.show()

        # Label
        label = NetzobLabel(_("Trace ID"))
        panel.attach(label, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5)
        label2 = NetzobLabel(trace.getID())
        panel.attach(label2, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5)

        label3 = NetzobLabel(_("Select project"))
        panel.attach(label3, 0, 1, 1, 2, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5)
        # Delimiter type
        projectCombo = NetzobComboBoxEntry()
        for project in self.workspace.getProjects():
            projectCombo.append_text(project.getName())

        panel.attach(projectCombo, 1, 2, 1, 2, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5)

        # Progress bar
        self.progressbarAlignment = NetzobProgressBar()
        panel.attach(self.progressbarAlignment, 0, 2, 2, 3, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5)

        # Button
        importButton = NetzobButton(_("Import"))
        importButton.connect("clicked", self.importTraceAction, trace, projectCombo, importDialog)
        panel.attach(importButton, 0, 2, 3, 4, xoptions=gtk.FILL, yoptions=0, xpadding=5, ypadding=5)

        importDialog.vbox.pack_start(panel, True, True, 0)
        importDialog.show()
Пример #2
0
    def buildOptionsView(self):
        """buildOptionsView:
                Build the options view (bottom of the main view). This view proposes some options to sharpen the fuzzing.
        """
        self.optionsTable = Gtk.Table(rows=1, columns=4, homogeneous=False)
        self.optionsTable.show()

        label = NetzobLabel(_("Fuzzing based on: "))
        self.comboFuzzingBase = NetzobComboBoxEntry()
        self.comboFuzzingBase.append_text("Variable")
        self.comboFuzzingBase.append_text("Regex")
        self.comboFuzzingBase.set_active(0)
        self.optionsTable.attach(label, 0, 1, 0, 1)
        self.optionsTable.attach(self.comboFuzzingBase, 1, 2, 0, 1)

        self.checkMutateStaticFields = Gtk.CheckButton(_("Mutate static fields"))
        self.checkMutateStaticFields.show()
        self.checkMutateStaticFields.set_active(True)
        self.optionsTable.attach(self.checkMutateStaticFields, 2, 3, 0, 1)

        self.exportButton = Gtk.Button(_("Export"))
        self.exportButton.show()
        self.optionsTable.attach(self.exportButton, 3, 4, 0, 1)
Пример #3
0
class PeachExportView(AbstractExporterView):
    """PeachExportView:
            GUI for exporting results in Peach pit XML.
    """

    def __init__(self, plugin, controller):
        """Constructor of PeachExportView:
        """
        super(PeachExportView, self).__init__(plugin, controller)
        self.buildPanel()

        self.dialog = Gtk.Dialog(title=_("Export project as Peach pit XML"), flags=0, buttons=None)
        self.dialog.vbox.pack_start(self.panel, True, True, 0)
        self.dialog.set_size_request(800, 600)

    def getDialog(self):
        return self.dialog

    def buildPanel(self):
        """buildPanel:
                Build and display the Peach exporter GUI.
        """
        # First we create a VPaned which hosts the two main children
        self.panel = Gtk.VPaned()
        self.panel.show()

        self.hpanel = Gtk.HPaned()
        self.hpanel.show()

        # Create the symbol selection treeview
        self.buildSymbolTreeview()
        self.hpanel.add1(self.symbolTreeviewScroll)

        # Create the hbox content in order to display dissector data
        bottomFrame = Gtk.Frame()
        bottomFrame.show()
        self.hpanel.add2(bottomFrame)
        sw = Gtk.ScrolledWindow()
        self.textarea = Gtk.TextView()
        self.textarea.get_buffer().create_tag("normalTag", family="Courier")
        self.textarea.show()
        self.textarea.set_editable(False)
        sw.add(self.textarea)
        sw.show()
        bottomFrame.add(sw)

        self.buildOptionsView()
        self.panel.add1(self.hpanel)
        self.panel.pack2(self.optionsTable, resize=False)
        self.panel.set_position(550)
        self.hpanel.set_position(300)

    def buildSymbolTreeview(self):
        """builSymbolTreeView:
                Build a symbol tree view in the GUI (left column). This tree view lists all the symbol of the project.
        """
        # Tree store contains:
        # str : text (symbol Name)
        # str : color foreground
        # str : color background
        self.treestore = Gtk.TreeStore(str, str, str, str)
        self.symbolTreeview = Gtk.TreeView(self.treestore)

        renderer = Gtk.CellRendererText()
        columnSymbols = Gtk.TreeViewColumn(_("Fuzzer type"), renderer, text=1)
        self.symbolTreeview.append_column(columnSymbols)

        # Symbol list
        self.symbolTreeviewScroll = Gtk.ScrolledWindow()
        self.symbolTreeviewScroll.show()
        self.symbolTreeviewScroll.add(self.symbolTreeview)

        self.symbolTreeview.show()

    def buildOptionsView(self):
        """buildOptionsView:
                Build the options view (bottom of the main view). This view proposes some options to sharpen the fuzzing.
        """
        self.optionsTable = Gtk.Table(rows=1, columns=4, homogeneous=False)
        self.optionsTable.show()

        label = NetzobLabel(_("Fuzzing based on: "))
        self.comboFuzzingBase = NetzobComboBoxEntry()
        self.comboFuzzingBase.append_text("Variable")
        self.comboFuzzingBase.append_text("Regex")
        self.comboFuzzingBase.set_active(0)
        self.optionsTable.attach(label, 0, 1, 0, 1)
        self.optionsTable.attach(self.comboFuzzingBase, 1, 2, 0, 1)

        self.checkMutateStaticFields = Gtk.CheckButton(_("Mutate static fields"))
        self.checkMutateStaticFields.show()
        self.checkMutateStaticFields.set_active(True)
        self.optionsTable.attach(self.checkMutateStaticFields, 2, 3, 0, 1)

        self.exportButton = Gtk.Button(_("Export"))
        self.exportButton.show()
        self.optionsTable.attach(self.exportButton, 3, 4, 0, 1)