Esempio n. 1
0
    def __init__(self):
        simple_base_window.__init__(self)
        trac_bug_report.__init__(self, 'No traceback available on user bug report.')

        # We got here because of the user going to the Help menu and
        # then clicking on "Report a bug"
        self.autogen = False
        
        # Set generic window settings
        self.set_modal(True)
        self.set_title('Report bug to developers')
        
        self.vbox = gtk.VBox()
        self.vbox.set_border_width(10)
        
        # the label for the rest of the message
        self.label = gtk.Label()
        self.label.set_line_wrap(True)
        label_text =  _('<b>You can contribute</b> with the w3af project by submitting')
        label_text += _(' a bug report to our system using this window.')
        label_text += _(' It\'s a simple <i>two step process</i>.\n\n')
        label_text += _('w3af will only send the text you enter and the version information to')
        label_text += _(' Trac, no personal or confidential information is collected.\n')
        self.label.set_markup(label_text)
        self.label.show()
        
        hbox = gtk.HBox()
        icon = gtk.Image()
        icon.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_DIALOG)
        hbox.pack_start(icon, True, True, 30)
        hbox.pack_start(self.label, True, True)
        
        self.vbox.pack_start(hbox, True, True)
        
        # the buttons
        self.hbox = gtk.HBox()
        self.butt_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
        self.butt_cancel.connect("clicked", self._handle_cancel)
        self.hbox.pack_start(self.butt_cancel, True, False)

        self.butt_send = gtk.Button(stock=gtk.STOCK_OK)
        self.butt_send.connect("clicked", self.report_bug)
        self.hbox.pack_start(self.butt_send, True, False)
        
        self.vbox.pack_start(self.hbox, True, False)
        
        #self.resize(400,450)
        self.add(self.vbox)
        self.show_all()
        
        # This is a quick fix to get around the problem generated by "set_selectable"
        # that selects the text by default
        self.label.select_region(0, 0)
Esempio n. 2
0
    def __init__(self, title, tback, fname, plugins):
        # Before doing anything else, cleanup the report to remove any
        # user information that might be present.
        tback = cleanup_bug_report(tback)
        
        simple_base_window.__init__(self)
        trac_bug_report.__init__(self, tback, fname, plugins)
        
        # We got here because of an autogenerated bug, not because of the user
        # going to the Help menu and then clicking on "Report a bug"
        self.autogen = True
        
        # Set generic window settings
        self.set_modal(True)
        self.set_title(title)
        
        self.vbox = gtk.VBox()
        self.vbox.set_border_width(10)
        
        # the label for the title
        self.title_label = gtk.Label()
        self.title_label.set_line_wrap(True)
        label_text = _('<b>An unhandled exception was raised</b>')
        self.title_label.set_markup(label_text)
        self.title_label.show()
        
        # A gtk.TextView for the exception
        frame = gtk.Frame('Traceback')
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        
        self.text_view = gtk.TextView()
        self.text_view.set_size_request(150, 250) 
        self.text_view.set_editable(False)
        self.text_view.set_wrap_mode(gtk.WRAP_CHAR)

        buffer = self.text_view.get_buffer()
        buffer.set_text(tback)
        
        sw.add(self.text_view)
        frame.add(sw)
        
        # the label for the rest of the message
        self.label = gtk.Label()
        self.label.set_line_wrap(True)
        label_text = _("<i>All this info is in a file called '%s' for later")
        label_text += _(' review.</i>\n\nIf you wish, <b>you can contribute')
        label_text += _('</b> to the w3af project and submit this bug to our')
        label_text += _(' bug tracking system from within this window. It is')
        label_text += _(' a simple <i>two step process</i>.\n\n')
        label_text += _('w3af will only send the exception traceback and the')
        label_text += _(' version information to Trac, no personal or ')
        label_text += _(' confidential information is collected.')
        self.label.set_markup( label_text % fname )
        self.label.show()
        
        self.vbox.pack_start(self.title_label, True, True, 10)
        self.vbox.pack_start(frame, True, True)
        self.vbox.pack_start(self.label, True, True, 10)
        
        # the buttons
        self.hbox = gtk.HBox()
        
        self.butt_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
        self.butt_cancel.connect("clicked", self._handle_cancel)
        self.hbox.pack_start(self.butt_cancel, True, False)

        self.butt_send = gtk.Button(stock=gtk.STOCK_OK)
        self.butt_send.connect("clicked", self.report_bug)
        self.hbox.pack_start(self.butt_send, True, False)
        
        self.vbox.pack_start(self.hbox, True, False, 10)
                
        #self.resize(400,450)
        self.add(self.vbox)
        self.show_all()
        
        # This is a quick fix to get around the problem generated by "set_selectable"
        # that selects the text by default
        self.label.select_region(0, 0)
Esempio n. 3
0
    def __init__(self, title ):
        simple_base_window.__init__(self)
        
        exception_list = exception_handler.get_all_exceptions()
        scan_id = exception_handler.get_scan_id()
        
        trac_multi_bug_report.__init__(self, exception_list, scan_id )
        
        # We got here because of an autogenerated bug, not because of the user
        # going to the Help menu and then clicking on "Report a bug"
        self.autogen = True
        
        # Set generic window settings
        self.set_modal(True)
        self.set_title(title)
        
        self.vbox = gtk.VBox()
        self.vbox.set_border_width(10)
        
        # the label for the title
        self.title_label = gtk.Label()
        self.title_label.set_line_wrap(True)
        label_text = _('<b>The following exceptions were raised and handled</b>')
        self.title_label.set_markup(label_text)
        self.title_label.show()
        
        # A gtk.TextView for the exception
        frame = gtk.Frame('Handled exceptions')
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.set_size_request(200, 280)
        
        # Create the TreeStore to display all exceptions
        self.treestore = gtk.TreeStore(str, str)

        for edata in exception_list:
            where = edata.get_where()
            exception = str(edata.exception)
            tdata = [ where,
                      exception]
            self.treestore.append(None, tdata)

        # create the TreeView using treestore
        self.treeview = gtk.TreeView(self.treestore)

        # First column that holds the icon and the location
        tvcol = gtk.TreeViewColumn('Location')
        
        cell = gtk.CellRendererPixbuf()
        pb = self.treeview.render_icon(gtk.STOCK_DND, gtk.ICON_SIZE_SMALL_TOOLBAR, None)
        cell.set_property('pixbuf', pb)
        tvcol.pack_start(cell, expand=False)
        
        cell = gtk.CellRendererText()
        tvcol.pack_start(cell, expand=False)
        tvcol.add_attribute(cell, "text", 0)
        self.treeview.append_column(tvcol)
        
        # Second column that holds the exception
        tvcol = gtk.TreeViewColumn('Exception')
        cell = gtk.CellRendererText()
        tvcol.pack_start(cell, expand=True)
        tvcol.add_attribute(cell, "text", 1)
        self.treeview.append_column(tvcol)
        
        sw.add(self.treeview)
        frame.add(sw)
        
        # the label for the rest of the message
        self.label = gtk.Label()
        self.label.set_line_wrap(True)
        label_text = _("<i>All these exceptions were stored in '%s' for your later")
        label_text += _(' review.</i>\n\nReporting these is recommended and will')
        label_text += _(' help us improve w3af. <b>You can contribute</b> to the')
        label_text += _(' w3af project and submit these exceptions to our')
        label_text += _(' bug tracking system from within this window only using')
        label_text += _(' <i>two clicks</i>.\n\n')
        label_text += _('w3af will only send the exception traceback and the')
        label_text += _(' version information to Trac, no personal or ')
        label_text += _(' confidential information is collected.')
        self.label.set_markup( label_text % gettempdir() )
        self.label.show()
        
        self.vbox.pack_start(self.title_label, True, True, 10)
        self.vbox.pack_start(frame, True, True)
        self.vbox.pack_start(self.label, True, True, 10)
        
        # the buttons
        self.hbox = gtk.HBox()
        
        self.butt_cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
        self.butt_cancel.connect("clicked", self._handle_cancel)
        self.hbox.pack_start(self.butt_cancel, True, False)

        self.butt_send = gtk.Button(stock=gtk.STOCK_OK)
        self.butt_send.connect("clicked", self.report_bug)
        self.hbox.pack_start(self.butt_send, True, False)
        
        self.vbox.pack_start(self.hbox, True, False, 10)
        
        #self.resize(400,450)
        self.add(self.vbox)
        self.show_all()
        
        # This is a quick fix to get around the problem generated by "set_selectable"
        # that selects the text by default
        self.label.select_region(0, 0)