예제 #1
0
 def _populate_popup(self, textview, menu):
     menu.append(gtk.SeparatorMenuItem())
     # Enc/Dec
     encdec = gtk.MenuItem(_('Send selected text to Encode/Decode tool'))
     encdec.connect("activate", self._send2enc)
     menu.append(encdec)
     # Syntax menu
     syntaxMenu = gtk.Menu()
     for i in self.get_languages():
         langItem = gtk.MenuItem(i)
         langItem.connect("activate", self._activate_lang, i)
         syntaxMenu.append(langItem)
     opc = gtk.MenuItem(_("Syntax highlighting"))
     opc.set_submenu(syntaxMenu)
     menu.append(opc)
     # Strings payloads
     payloadMenu = gtk.Menu()
     for i in self.get_string_payloads():
         payloadItem = gtk.MenuItem(i[:50] + ' ...')
         payloadItem.connect("activate", self._insert_payload, i)
         payloadMenu.append(payloadItem)
     opc = gtk.MenuItem(_("String payloads"))
     opc.set_submenu(payloadMenu)
     menu.append(opc)
     menu.show_all()
     Searchable._populate_popup(self, textview, menu)
예제 #2
0
    def __init__(self):
        gtk.VBox.__init__(self)

        # up row buttons
        upbox = gtk.HBox()
        self.filters = {}

        def make_but(label, signal, initial):
            but = gtk.CheckButton(label)
            but.set_active(initial)
            but.connect("clicked", self.type_filter, signal)
            self.filters[signal] = initial
            upbox.pack_start(but, False, False)

        make_but(_("Vulnerabilities"), "vulnerability", True)
        make_but(_("Information"), "information", True)
        make_but(_("Error"), "error", True)

        search = entries.SemiStockButton(_("Search"), gtk.STOCK_FIND,
                                         _("Search in the text"))

        upbox.pack_end(search, False, False)
        upbox.show_all()
        self.pack_start(upbox, expand=False, fill=False)

        # the scrolling lines
        sw_mess = gtk.ScrolledWindow()
        sw_mess.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        newfilter = [k for k, v in self.filters.items() if v]
        self.sclines = _LineScroller(sw_mess.get_vscrollbar(), newfilter,
                                     self.filters.keys())
        sw_mess.add(self.sclines)
        sw_mess.show()
        self.pack_start(sw_mess, expand=True, fill=True)

        Searchable.__init__(self, self.sclines)
        search.connect("clicked", self.show_search)
        self.show()
        self.queue_draw()
예제 #3
0
    def __init__(self, w3af):
        gtk.VBox.__init__(self)
        self.is_request = True
        self.w3af = w3af
        # Create the textview where the text is going to be shown
        self.textView = gtksourceview.View(gtksourceview.Buffer())
        # User controlled options
        self.textView.set_highlight_current_line(False)
        self.textView.set_show_line_numbers(False)
        # Other options
        # Font
        self.set_wrap(True)
        self.textView.set_border_width(5)
        fontDesc = pango.FontDescription('monospace')
        if fontDesc:
            self.textView.modify_font(fontDesc)
        
        # Syntax highlight
        self._lang_man = gtksourceview.LanguageManager()
        spath = self._lang_man.get_search_path()
        spath.append('core' + os.path.sep + 'ui' + os.path.sep + 'gui')
        self._lang_man.set_search_path(spath)
        self.set_language('http')
        #b.set_highlight_syntax(True)

        self.reset_bg_color()
        for sev in SEVERITY_TO_COLOR:
            self.textView.get_buffer(
            ).create_tag(sev, background=SEVERITY_TO_COLOR[sev])
        self.textView.show()
        # Scroll where the textView goes
        sw1 = gtk.ScrolledWindow()
        sw1.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        sw1.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw1.add(self.textView)
        sw1.show()
        self.pack_start(sw1, expand=True, fill=True)
        # Create the search widget
        Searchable.__init__(self, self.textView, small=True)
예제 #4
0
    def __init__(self):
        gtk.VBox.__init__(self)

        # up row buttons
        upbox = gtk.HBox()
        self.filters = {}

        def make_but(label, signal, initial):
            but = gtk.CheckButton(label)
            but.set_active(initial)
            but.connect("clicked", self.type_filter, signal)
            self.filters[signal] = initial
            upbox.pack_start(but, False, False)
            
        make_but(_("Vulnerabilities"), "vulnerability", True)
        make_but(_("Information"), "information", True)
        make_but(_("Error"), "error", True)
        
        search = entries.SemiStockButton(_("Search"), gtk.STOCK_FIND,
                                         _("Search in the text"))
        
        upbox.pack_end(search, False, False)
        upbox.show_all()
        self.pack_start(upbox, expand=False, fill=False)

        # the scrolling lines
        sw_mess = gtk.ScrolledWindow()
        sw_mess.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        newfilter = [k for k, v in self.filters.items() if v]
        self.sclines = _LineScroller(sw_mess.get_vscrollbar(),
                                     newfilter, self.filters.keys())
        sw_mess.add(self.sclines)
        sw_mess.show()
        self.pack_start(sw_mess, expand=True, fill=True)

        Searchable.__init__(self, self.sclines)
        search.connect("clicked", self.show_search)
        self.show()
        self.queue_draw()