Ejemplo n.º 1
0
    def test_add_httpPostDataRequest(self):
        ds = disk_set()
        
        uri = url_object('http://w3af.org/?id=2')
        pdr1 = httpPostDataRequest(uri, method='GET', headers={'Referer': 'http://w3af.org/'})

        uri = url_object('http://w3af.org/?id=3')
        pdr2 = httpPostDataRequest(uri, method='GET', headers={'Referer': 'http://w3af.com/'})
        
        uri = url_object('http://w3af.org/?id=7')
        pdr3 = httpPostDataRequest(uri, method='FOO', headers={'Referer': 'http://w3af.com/'})
        
        ds.add( pdr1 )
        ds.add( pdr2 )
        ds.add( pdr2 )
        ds.add( pdr1 )
        
        self.assertEqual( ds[0] , pdr1)
        self.assertEqual( ds[1] , pdr2)
        self.assertFalse( pdr3 in ds )
        self.assertTrue( pdr2 in ds )
        self.assertEqual( len(ds) , 2)
        
        # This forces an internal change in the URL object
        pdr2.getURL().url_string
        self.assertTrue( pdr2 in ds )
Ejemplo n.º 2
0
    def __init__(self):
        baseDiscoveryPlugin.__init__(self)

        # Internal variables
        self._compiled_ignore_re = None
        self._compiled_follow_re = None
        self._broken_links = disk_set()
        self._fuzzable_reqs = disk_set()
        self._first_run = True
        self._known_variants = variant_db()
        self._already_filled_form = scalable_bloomfilter()

        # User configured variables
        self._ignore_regex = ''
        self._follow_regex = '.*'
        self._only_forward = False
        self._compileRE()
Ejemplo n.º 3
0
 def test_add(self):
     ds = disk_set()
     ds.add(1)
     ds.add(2)
     ds.add(3)
     ds.add(1)
     
     self.assertEqual( list(ds), [1,2,3])
Ejemplo n.º 4
0
    def test_add_urlobject(self):
        ds = disk_set()

        ds.add( url_object('http://w3af.org/?id=2') )
        ds.add( url_object('http://w3af.org/?id=3') )
        ds.add( url_object('http://w3af.org/?id=3') )
        
        self.assertEqual( ds[0] , url_object('http://w3af.org/?id=2'))
        self.assertEqual( ds[1] , url_object('http://w3af.org/?id=3'))
        self.assertEqual( len(ds) , 2)
        self.assertFalse( url_object('http://w3af.org/?id=4') in ds )
        self.assertTrue( url_object('http://w3af.org/?id=2') in ds )
Ejemplo n.º 5
0
 def test_update(self):
     ds = disk_set()
     ds.add(1)
     ds.update([2,3,1])
     
     self.assertEqual( list(ds), [1,2,3])