Exemplo n.º 1
0
    def __init__(self, w3af, parentWidg, label='config'):
        gtk.VBox.__init__(self)
        Preferences.__init__(self, label)

        self.set_spacing(5)
        self.def_padding = 5
        self.w3af = w3af
        self.parentWidg = parentWidg
        self.widgets_status = {}
        self.propagAnyWidgetChanged = helpers.PropagateBuffer(
            self._changedAnyWidget)
        self.propagLabels = {}
Exemplo n.º 2
0
    def __init__(self,
                 parentwidg,
                 w3af,
                 plugin,
                 save_btn,
                 rvrt_btn,
                 overwriter=None):
        super(OnlyOptions, self).__init__()
        if overwriter is None:
            overwriter = {}
        self.set_spacing(5)
        self.w3af = w3af
        self.parentwidg = parentwidg
        self.widgets_status = {}
        self.tab_widget = {}
        self.propagAnyWidgetChanged = helpers.PropagateBuffer(
            self._changedAnyWidget)
        self.propagLabels = {}
        self.saved_successfully = False

        # options
        self.options = OptionList()
        options = plugin.get_options()
        # let's use the info from the core
        coreopts = self.w3af.plugins.get_plugin_options(
            plugin.ptype, plugin.pname)
        if coreopts is None:
            coreopts = {}

        # let's get the real info
        for opt in options:
            if opt.get_name() in coreopts:
                opt.set_value(coreopts[opt.get_name()].get_value_str())
            if opt.get_name() in overwriter:
                opt.set_value(overwriter[opt.get_name()])
            self.options.append(opt)

        # buttons
        save_btn.connect("clicked", self._save_panel, plugin)
        save_btn.set_sensitive(False)
        rvrt_btn.set_sensitive(False)
        rvrt_btn.connect("clicked", self._revertPanel)
        self.save_btn = save_btn
        self.rvrt_btn = rvrt_btn

        # middle (the heart of the panel)
        if self.options:
            tabbox = gtk.HBox()
            heart = self._createNotebook()
            tabbox.pack_start(heart, expand=True)
            tabbox.show()
            self.pack_start(tabbox, expand=True, fill=False)
        self.show()
Exemplo n.º 3
0
    def __init__(self, w3af, initial_request=None):
        super(FuzzyRequests,
              self).__init__(w3af, "fuzzyreq", "w3af - Fuzzy Requests",
                             "Fuzzy_Requests")
        self.w3af = w3af
        self.historyItem = HistoryItem()
        mainhbox = gtk.HBox()

        # To store the responses
        self.responses = []

        # ---- left pane ----
        vbox = gtk.VBox()
        mainhbox.pack_start(vbox, False, False)

        # we create the buttons first, to pass them
        analyzBut = gtk.Button("Analyze")
        self.sendPlayBut = entries.SemiStockButton(
            "", gtk.STOCK_MEDIA_PLAY, "Sends the pending requests")
        self.sendStopBut = entries.SemiStockButton(
            "", gtk.STOCK_MEDIA_STOP, "Stops the request being sent")
        self.sSB_state = helpers.PropagateBuffer(
            self.sendStopBut.set_sensitive)
        self.sSB_state.change(self, False)

        # Fix content length checkbox
        self._fix_content_lengthCB = gtk.CheckButton(
            'Fix content length header')
        self._fix_content_lengthCB.set_active(True)
        self._fix_content_lengthCB.show()

        # request
        self.originalReq = RequestPart(
            self,
            w3af, [
                analyzBut.set_sensitive, self.sendPlayBut.set_sensitive,
                functools.partial(self.sSB_state.change, 'rRV')
            ],
            editable=True,
            widgname='fuzzyrequest')

        if initial_request is None:
            self.originalReq.show_raw(FUZZY_REQUEST_EXAMPLE, '')
        else:
            (initialUp, initialDn) = initial_request
            self.originalReq.show_raw(initialUp, initialDn)

        # Add the right button popup menu to the text widgets
        rawTextView = self.originalReq.get_view_by_id('HttpRawView')
        rawTextView.textView.connect("populate-popup", self._populate_popup)

        # help
        helplabel = gtk.Label()
        helplabel.set_selectable(True)
        helplabel.set_markup(FUZZY_HELP)
        self.originalReq.append_page(helplabel, gtk.Label("Syntax help"))
        helplabel.show()
        self.originalReq.show()
        vbox.pack_start(self.originalReq, True, True, padding=5)
        vbox.show()

        # the commands
        t = gtk.Table(2, 4)
        analyzBut.connect("clicked", self._analyze)
        t.attach(analyzBut, 0, 2, 0, 1)
        self.analyzefb = gtk.Label("0 requests")
        self.analyzefb.set_sensitive(False)
        t.attach(self.analyzefb, 2, 3, 0, 1)
        self.preview = gtk.CheckButton("Preview")
        t.attach(self.preview, 3, 4, 0, 1)
        self.sPB_signal = self.sendPlayBut.connect("clicked", self._send_start)
        t.attach(self.sendPlayBut, 0, 1, 1, 2)
        self.sendStopBut.connect("clicked", self._send_stop)
        t.attach(self.sendStopBut, 1, 2, 1, 2)
        self.sendfb = gtk.Label("0 ok, 0 errors")
        self.sendfb.set_sensitive(False)
        t.attach(self.sendfb, 2, 3, 1, 2)
        t.attach(self._fix_content_lengthCB, 3, 4, 1, 2)
        t.show_all()

        vbox.pack_start(t, False, False, padding=5)

        # ---- throbber pane ----
        vbox = gtk.VBox()
        self.throbber = helpers.Throbber()
        self.throbber.set_sensitive(False)
        vbox.pack_start(self.throbber, False, False)
        vbox.show()
        mainhbox.pack_start(vbox, False, False)

        # ---- right pane ----
        vbox = gtk.VBox()
        mainhbox.pack_start(vbox)

        # A label to show the id of the response
        self.title0 = gtk.Label()
        self.title0.show()
        vbox.pack_start(self.title0, False, True)

        # result itself
        self.resultReqResp = ReqResViewer(w3af,
                                          withFuzzy=False,
                                          editableRequest=False,
                                          editableResponse=False)
        self.resultReqResp.set_sensitive(False)
        vbox.pack_start(self.resultReqResp, True, True, padding=5)
        vbox.show()

        # result control
        centerbox = gtk.HBox()
        self.pagesControl = entries.PagesControl(w3af, self.page_change)
        centerbox.pack_start(self.pagesControl, True, False)
        centerbox.show()

        # cluster responses button
        image = gtk.Image()
        image.set_from_file(
            os.path.join(ROOT_PATH, 'core', 'ui', 'gui', 'data',
                         'cluster_data.png'))
        image.show()
        self.clusterButton = gtk.Button(label='Cluster responses')
        self.clusterButton.connect("clicked", self._clusterData)
        self.clusterButton.set_sensitive(False)
        self.clusterButton.set_image(image)
        self.clusterButton.show()
        centerbox.pack_start(self.clusterButton, True, False)

        # clear responses button
        self.clearButton = entries.SemiStockButton(
            'Clear Responses',
            gtk.STOCK_CLEAR,
            tooltip='Clear all HTTP responses from fuzzer window')
        self.clearButton.connect("clicked", self._clearResponses)
        self.clearButton.set_sensitive(False)
        self.clearButton.show()
        centerbox.pack_start(self.clearButton, True, False)

        vbox.pack_start(centerbox, False, False, padding=5)

        # Show all!
        self._sendPaused = True
        self.vbox.pack_start(mainhbox)
        self.vbox.show()
        mainhbox.show()
        self.show()