Example #1
0
 def test_encode_path_case01(self):
     rhe = rnd_hex_encode()
     
     u = URL('http://www.w3af.com/a/')
     r = HTTPRequest( u )
     modified_path = rhe.modify_request( r ).url_object.get_path()
     self.assertIn(modified_path, ['/a/','/%61/'])
Example #2
0
    def test_no_modification(self):
        rhe = rnd_hex_encode()

        u = URL('http://www.w3af.com/')
        r = HTTPRequest( u )
        self.assertEqual(rhe.modify_request( r ).url_object.url_string,
                         u'http://www.w3af.com/')
Example #3
0
    def test_encode_post_data(self):
        rhe = rnd_hex_encode()

        u = URL('http://www.w3af.com/')
        r = HTTPRequest(u, data='a=b')
        modified_pdata = rhe.modify_request(r).get_data()
        self.assertIn(modified_pdata, ['a=b', '%61=b', 'a=%62', '%61=%62'])
Example #4
0
    def test_encode_post_data(self):
        rhe = rnd_hex_encode()
        
        u = URL('http://www.w3af.com/')
        r = HTTPRequest( u, data='a=b' )
        modified_pdata = rhe.modify_request( r ).get_data()
        self.assertIn(modified_pdata, ['a=b','%61=b','a=%62','%61=%62'])

        
Example #5
0
    def test_encode_path_case02(self):
        rhe = rnd_hex_encode()

        u = URL('http://www.w3af.com/aa/')

        r = HTTPRequest(u)
        modified_path = rhe.modify_request(r).url_object.get_path()
        self.assertIn(modified_path, ['/aa/', '/%61a/', '/a%61/', '/%61%61/'])

        #
        #    The plugins should not modify the original request
        #
        self.assertEqual(u.url_string, u'http://www.w3af.com/aa/')
Example #6
0
    def test_encode_path_case02(self):
        rhe = rnd_hex_encode()
        
        u = URL('http://www.w3af.com/aa/')
        
        r = HTTPRequest( u )
        modified_path = rhe.modify_request( r ).url_object.get_path()
        self.assertIn(modified_path, ['/aa/','/%61a/','/a%61/','/%61%61/'])

        #
        #    The plugins should not modify the original request
        #
        self.assertEqual(u.url_string,
                         u'http://www.w3af.com/aa/')