Exemplo n.º 1
0
 def test_one_input_no_action(self):
     doc = '<form><input type="text" name="test"></input></form>'
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form('http://test/', doc)
     self.assertEqual({"test": "abcdefgh"},
                      tutil.gen_to_dict(form.get_parameters()))
     self.assertEqual("http://test/", form.action)
Exemplo n.º 2
0
 def test_form_with_textarea(self):
     doc = '<form action="action">' + \
           '<textarea name="test" placeholder="random" /></form>'
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form('http://test/', doc)
     self.assertEqual({"test": "random"}, dict(form.get_parameters()))
     self.assertEqual("http://test/action", form.action)
Exemplo n.º 3
0
 def test_one_input_with_action(self):
     doc = '<form action="test"><input type="text" name="test">' \
           '</input></form>'
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form('http://test/', doc)
     self.assertEqual({"test": "abcdefgh"}, dict(form.get_parameters()))
     self.assertEqual("http://test/test", form.action)
Exemplo n.º 4
0
 def test_form_with_textarea(self):
     doc = '<form action="action">' + \
           '<textarea name="test" placeholder="random" /></form>'
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form('http://test/', doc)
     self.assertEqual({"test": "random"},
                      tutil.gen_to_dict(form.get_parameters()))
     self.assertEqual("http://test/action", form.action)
Exemplo n.º 5
0
 def test_serveral_inputs_with_action(self):
     doc = '<form action="action"><input type="text" name="test"> ' \
           '</input><input type="submit" name="click"></input></form>'
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form('http://test/', doc)
     self.assertEqual({"test": "abcdefgh", "click": ""},
                      tutil.gen_to_dict(form.get_parameters()))
     self.assertEqual("http://test/action", form.action)
Exemplo n.º 6
0
 def test_serveral_inputs_with_action(self):
     doc = '<form action="action"><input type="text" name="test"> ' \
           '</input><input type="submit" name="click"></input></form>'
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form('http://test/', doc)
     self.assertEqual({
         "test": "abcdefgh",
         "click": ""
     }, dict(form.get_parameters()))
     self.assertEqual("http://test/action", form.action)
Exemplo n.º 7
0
    def test_form_post_send(self):
        assert_function = self.assertNotEqual

        class StaticSite(object):
            def download_page(self, url, parameters=None, remember_visited=None):
                assert_function(parameters, None)

        doc = '<form method="post"><input type="text" name="test" ' + 'value="random"></input></form>'
        doc = ET.fromstring(doc)
        form = webvulnscan.form.Form("http://test/", doc)
        parameters = dict(form.get_parameters())
        form.send(StaticSite(), parameters)
Exemplo n.º 8
0
    def test_form_post_send(self):
        assert_function = self.assertNotEqual

        class StaticSite(object):
            def download_page(self,
                              url,
                              parameters=None,
                              remember_visited=None):
                assert_function(parameters, None)

        doc = '<form method="post"><input type="text" name="test" ' + \
              'value="random"></input></form>'
        doc = ET.fromstring(doc)
        form = webvulnscan.form.Form('http://test/', doc)
        parameters = dict(form.get_parameters())
        form.send(StaticSite(), parameters)
Exemplo n.º 9
0
 def test_serveral_inputs_no_action(self):
     doc = '<form><input type="text" name="test"></input>' '<input type="submit" name="click"></input></form>'
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form("http://test/", doc)
     self.assertEqual({"test": "abcdefgh", "click": ""}, dict(form.get_parameters()))
     self.assertEqual("http://test/", form.action)
Exemplo n.º 10
0
 def test_one_input_with_action(self):
     doc = '<form action="test"><input type="text" name="test">' "</input></form>"
     doc = ET.fromstring(doc)
     form = webvulnscan.form.Form("http://test/", doc)
     self.assertEqual({"test": "abcdefgh"}, dict(form.get_parameters()))
     self.assertEqual("http://test/test", form.action)