Ejemplo n.º 1
0
    def test_len(self):
        dl = disk_list()

        for i in xrange(0, 100):
            _ = dl.append(i)

        self.assertEqual( len(dl) == 100, True)
Ejemplo n.º 2
0
    def __init__(self, scroll_bar, active_filter, possible):
        '''
        @param scroll_bar: Gtk Vertical Scrollbar object 
        @param active_filter: the filter active at startup.
        @param possible: all filter keys
        '''
        gtk.TextView.__init__(self)
        self.set_editable(False)
        self.set_cursor_visible(False)
        self.set_wrap_mode(gtk.WRAP_WORD)
        self.textbuffer = self.get_buffer()
        self.show()
        self.messages = getQueueDiverter()
        self.all_messages = disk_list()
        self.possible = set(possible)
        self.active_filter = active_filter
        self.text_position = 0
        
        # scroll bar
        self.freeze_scrollbar = False
        scroll_bar.connect("value-changed", self.scroll_changed)        

        # colors
        self.textbuffer.create_tag("red-fg",  foreground="red")
        self.textbuffer.create_tag("blue-fg", foreground="blue")
        self.textbuffer.create_tag("brown-fg", foreground="brown")
        self.bg_colors = {
            "vulnerability": "red-fg",
            "information": "blue-fg",
            "error": "brown-fg",
        }

        gobject.timeout_add(500, self.addMessage().next)
Ejemplo n.º 3
0
    def test_getitem(self):
        dl = disk_list()

        dl.append( 'a' )
        dl.append( 1 )
        dl.append( [3,2,1] )

        self.assertEqual( dl[0] == 'a', True)
        self.assertEqual( dl[1] == 1  , True)
        self.assertEqual( dl[2] == [3,2,1], True)
Ejemplo n.º 4
0
    def test_bloom_string(self):
        dl = disk_list()

        for i in xrange(0, 1000):
            rnd = "".join(random.choice(string.letters) for i in xrange(40))
            _ = dl.append(rnd)

        self.assertEqual(rnd in dl, True)

        for i in string.letters:
            self.assertEqual(i in dl, False)

        self.assertEqual(rnd in dl, True)
Ejemplo n.º 5
0
    def test_bloom_int(self):
        dl = disk_list()

        for i in xrange(0, 1000):
            _ = dl.append(i)

        for i in xrange(0, 1000 / 2):
            r = random.randint(0, 1000 - 1)
            self.assertEqual(r in dl, True)

        for i in xrange(0, 1000 / 2):
            r = random.randint(1000, 1000 * 2)
            self.assertEqual(r in dl, False)
Ejemplo n.º 6
0
    def test_pickle(self):
        dl = disk_list()

        dl.append( 'a' )
        dl.append( 1 )
        dl.append( [3,2,1] )

        values = []
        for i in dl:
            values.append(i)
        
        self.assertEqual( values[0] == 'a', True)
        self.assertEqual( values[1] == 1, True)
        self.assertEqual( values[2] == [3,2,1], True)
Ejemplo n.º 7
0
    def __init__(self):
        baseDiscoveryPlugin.__init__(self)

        # Internal variables
        self._compiled_ignore_re = None
        self._compiled_follow_re = None
        self._brokenLinks = []
        self._fuzzableRequests = []
        self._first_run = True
        self._already_crawled = disk_list()
        self._already_filled_form = ScalableBloomFilter()

        # User configured variables
        self._ignore_regex = ""
        self._follow_regex = ".*"
        self._only_forward = False
        self._compileRE()
Ejemplo n.º 8
0
    def __init__(self):
        baseDiscoveryPlugin.__init__(self)

        # Internal variables
        self._compiled_ignore_re = None
        self._compiled_follow_re = None
        self._brokenLinks = []
        self._fuzzableRequests = []
        self._first_run = True
        # TODO: param 'text_factory' *MUST* be removed when the toolkit fully
        # supports unicode
        self._already_crawled = disk_list(text_factory=str)
        self._already_filled_form = scalable_bloomfilter()

        # User configured variables
        self._ignore_regex = ''
        self._follow_regex = '.*'
        self._only_forward = False
        self._compileRE()