示例#1
0
    def test_mutant_smart_fill_simple(self):
        original_form = Form()
        original_form.add_input([("name", "username"), ("value", "")])
        original_form.add_input([("name", "address"), ("value", "")])

        freq = HTTPPostDataRequest(self.url, dc=original_form)

        filled_form = mutant_smart_fill(freq, original_form, "username", 0, self.fuzzer_config)

        self.assertEqual(id(original_form), id(filled_form))
        self.assertEqual(filled_form["username"], [""])
        self.assertEqual(filled_form["address"], ["Bonsai Street 123"])
示例#2
0
    def test_mutant_smart_fill_simple(self):
        original_form = Form()
        original_form.add_input([("name", "username"), ("value", "")])
        original_form.add_input([("name", "address"), ("value", "")])

        freq = HTTPPostDataRequest(self.url, dc=original_form)

        filled_form = mutant_smart_fill(freq, original_form, 'username', 0,
                                        self.fuzzer_config)

        self.assertEqual(id(original_form), id(filled_form))
        self.assertEqual(filled_form['username'], [
            '',
        ])
        self.assertEqual(filled_form['address'], [
            'Bonsai Street 123',
        ])
示例#3
0
    def test_mutant_smart_fill_with_file(self):
        original_form = Form()
        original_form.add_input([("name", "username"), ("value", "")])
        original_form.add_input([("name", "address"), ("value", "")])
        original_form.add_file_input([("name", "file"), ("type", "file")])

        freq = HTTPPostDataRequest(self.url, dc=original_form)

        filled_form = mutant_smart_fill(freq, original_form, "username", 0, self.fuzzer_config)

        self.assertEqual(id(original_form), id(filled_form))
        self.assertEqual(filled_form["username"], [""])
        self.assertEqual(filled_form["address"], ["Bonsai Street 123"])

        str_file = filled_form["file"][0]
        self.assertEqual(str_file.name[-4:], ".gif")
        self.assertIn("GIF", str_file)
示例#4
0
    def test_mutant_smart_fill_with_file(self):
        original_form = Form()
        original_form.add_input([("name", "username"), ("value", "")])
        original_form.add_input([("name", "address"), ("value", "")])
        original_form.add_file_input([("name", "file"), ("type", "file")])

        freq = HTTPPostDataRequest(self.url, dc=original_form)

        filled_form = mutant_smart_fill(freq, original_form, 'username', 0,
                                        self.fuzzer_config)

        self.assertEqual(id(original_form), id(filled_form))
        self.assertEqual(filled_form['username'], [
            '',
        ])
        self.assertEqual(filled_form['address'], [
            'Bonsai Street 123',
        ])

        str_file = filled_form['file'][0]
        self.assertEqual(str_file.name[-4:], '.gif')
        self.assertIn('GIF', str_file)