Example #1
0
 def test_export_GET(self):
     http_request = 'GET http://www.w3af.org/ HTTP/1.1\n' \
                    'Host: www.w3af.org\n' \
                    'Foo: bar\n' \
                    '\n'
     python_code = python_export(http_request)
     self.assertTrue(
         compiler.compile(python_code, 'python_export.tmp', 'exec'))
     self.assertEquals(python_code, EXPECTED_SIMPLE)
Example #2
0
 def test_export_GET(self):
     http_request = 'GET http://www.w3af.org/ HTTP/1.1\n' \
                    'Host: www.w3af.org\n' \
                    'Foo: bar\n' \
                    '\n'
     python_code = python_export(http_request)
     self.assertTrue(
         compiler.compile(python_code, 'python_export.tmp', 'exec'))
     self.assertEquals(python_code, EXPECTED_SIMPLE)
Example #3
0
 def test_export_POST(self):
     http_request = 'POST http://www.w3af.org/ HTTP/1.1\n' \
                    'Host: www.w3af.org\n' \
                    'Content-Length: 3\n' \
                    '\n' \
                    'a=1'
     python_code = python_export(http_request)
     self.assertTrue(
         compiler.compile(python_code, 'python_export.tmp', 'exec'))
     self.assertEquals(python_code, EXPECTED_POST)
Example #4
0
 def test_export_POST(self):
     http_request = 'POST http://www.w3af.org/ HTTP/1.1\n' \
                    'Host: www.w3af.org\n' \
                    'Content-Length: 3\n' \
                    'Content-Type: application/x-www-form-urlencoded\n' \
                    '\n' \
                    'a=1'
     python_code = python_export(http_request)
     self.assertTrue(
         compiler.compile(python_code, 'python_export.tmp', 'exec'))
     self.assertEquals(python_code, EXPECTED_POST)
Example #5
0
 def test_export_POST_repeated(self):
     http_request = 'POST http://www.w3af.org/ HTTP/1.1\n' \
                    'Host: www.w3af.org\n' \
                    'Content-Length: 7\n' \
                    'Foo: spam\n' \
                    'Foo: eggs\n' \
                    '\n' \
                    'a=1&a=2'
     python_code = python_export(http_request)
     self.assertTrue(
         compiler.compile(python_code, 'python_export.tmp', 'exec'))
     self.assertEquals(python_code, EXPECTED_POST_REPEATED)
Example #6
0
 def test_export_POST_repeated(self):
     http_request = (
         "POST http://www.w3af.org/ HTTP/1.1\n"
         "Host: www.w3af.org\n"
         "Content-Length: 7\n"
         "Foo: spam\n"
         "Foo: eggs\n"
         "\n"
         "a=1&a=2"
     )
     python_code = python_export(http_request)
     self.assertTrue(compiler.compile(python_code, "python_export.tmp", "exec"))
     self.assertEquals(python_code, EXPECTED_POST_REPEATED)
Example #7
0
 def test_export_inject(self):
     http_request = 'POST http://www.w3af.org/ HTTP/1.1\n' \
                    'Host: www.w3af.org\n' \
                    'Content-Length: 7\n' \
                    'Foo: sp"am\n' \
                    'Foo: eggs\n' \
                    '\n' \
                    'a=1&a=2"3'
     python_code = python_export(http_request)
     self.assertTrue(
         compiler.compile(python_code, 'python_export.tmp', 'exec'))
     self.assertIn('a=1&a=2%223', python_code)
     self.assertIn("sp\\\"am", python_code)
Example #8
0
 def test_export_inject(self):
     http_request = (
         "POST http://www.w3af.org/ HTTP/1.1\n"
         "Host: www.w3af.org\n"
         "Content-Length: 7\n"
         'Foo: sp"am\n'
         "Foo: eggs\n"
         "\n"
         'a=1&a=2"3'
     )
     python_code = python_export(http_request)
     self.assertTrue(compiler.compile(python_code, "python_export.tmp", "exec"))
     self.assertIn("a=1&a=2%223", python_code)
     self.assertIn('sp\\"am', python_code)
Example #9
0
 def test_export_inject(self):
     http_request = 'POST http://www.w3af.org/ HTTP/1.1\n' \
                    'Host: www.w3af.org\n' \
                    'Content-Length: 7\n' \
                    'Content-Type: application/x-www-form-urlencoded\n' \
                    'Foo: sp"am\n' \
                    'Foo: eggs\n' \
                    '\n' \
                    'a=1&a=2"3'
     python_code = python_export(http_request)
     self.assertTrue(
         compiler.compile(python_code, 'python_export.tmp', 'exec'))
     self.assertIn('a=1&a=2%223', python_code)
     self.assertIn("sp\\\"am", python_code)
Example #10
0
 def test_export_POST(self):
     http_request = "POST http://www.w3af.org/ HTTP/1.1\n" "Host: www.w3af.org\n" "Content-Length: 3\n" "\n" "a=1"
     python_code = python_export(http_request)
     self.assertTrue(compiler.compile(python_code, "python_export.tmp", "exec"))
     self.assertEquals(python_code, EXPECTED_POST)
Example #11
0
 def test_export_GET(self):
     http_request = "GET http://www.w3af.org/ HTTP/1.1\n" "Host: www.w3af.org\n" "Foo: bar\n" "\n"
     python_code = python_export(http_request)
     self.assertTrue(compiler.compile(python_code, "python_export.tmp", "exec"))
     self.assertEquals(python_code, EXPECTED_SIMPLE)