Ejemplo n.º 1
0
    def test_not_match_hosted_at_regex(self):
        user_configured_json = {'hosted_at_url': '/products/.*'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(hosted_at_url=URL('http://w3af.org/another/product-132'),
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertFalse(match)
Ejemplo n.º 2
0
    def test_match_empty_user_configured_json(self):
        user_configured_json = {}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 3
0
    def test_match_hosted_at_regex(self):
        user_configured_json = {'hosted_at_url': '/products/.*'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(hosted_at_url=self.HOSTED_AT_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 4
0
    def test_match_hosted_at_regex(self):
        user_configured_json = {'hosted_at_url': '/products/.*'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(hosted_at_url=self.HOSTED_AT_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 5
0
    def test_match_action_regex(self):
        user_configured_json = {'action': '/products/comm.*'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 6
0
    def test_match_empty_user_configured_json(self):
        user_configured_json = {}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 7
0
    def test_match_action_regex(self):
        user_configured_json = {'action': '/products/comm.*'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 8
0
    def test_match_method(self):
        user_configured_json = {'method': 'get'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'],
                               method='get')

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 9
0
    def test_no_match_when_action_regex_match_and_input_not(self):
        user_configured_json = {'action': '/products/comm.*',
                                'inputs': ['foo']}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertFalse(match)
Ejemplo n.º 10
0
    def test_match_method(self):
        user_configured_json = {'method': 'get'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'],
                               method='get')

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 11
0
    def test_not_match_hosted_at_regex(self):
        user_configured_json = {'hosted_at_url': '/products/.*'}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(
            hosted_at_url=URL('http://w3af.org/another/product-132'),
            inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertFalse(match)
Ejemplo n.º 12
0
    def test_not_match_attrs(self):
        user_configured_json = {'attributes': {'class': 'impact-css'}}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'],
                               hosted_at_url=self.HOSTED_AT_URL,
                               attributes={'class': 'comment-css'})

        match = found_form_id.matches(form_matcher)

        self.assertFalse(match)
Ejemplo n.º 13
0
    def test_not_match_attrs(self):
        user_configured_json = {'attributes': {'class': 'impact-css'}}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'],
                               hosted_at_url=self.HOSTED_AT_URL,
                               attributes={'class': 'comment-css'})

        match = found_form_id.matches(form_matcher)

        self.assertFalse(match)
Ejemplo n.º 14
0
    def test_no_match_when_action_regex_match_and_input_not(self):
        user_configured_json = {
            'action': '/products/comm.*',
            'inputs': ['foo']
        }
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'])

        match = found_form_id.matches(form_matcher)

        self.assertFalse(match)
Ejemplo n.º 15
0
    def test_match_all(self):
        user_configured_json = {'hosted_at_url': '/products/.*',
                                'inputs': ['comment'],
                                'action': '/products/comments',
                                'attributes': {'class': 'comment-css'}}
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'],
                               hosted_at_url=self.HOSTED_AT_URL,
                               attributes={'class': 'comment-css'})

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)
Ejemplo n.º 16
0
    def test_match_all(self):
        user_configured_json = {
            'hosted_at_url': '/products/.*',
            'inputs': ['comment'],
            'action': '/products/comments',
            'attributes': {
                'class': 'comment-css'
            }
        }
        form_matcher = self.create_form_matcher(user_configured_json)
        found_form_id = FormID(action=self.ACTION_URL,
                               inputs=['comment', 'submit'],
                               hosted_at_url=self.HOSTED_AT_URL,
                               attributes={'class': 'comment-css'})

        match = found_form_id.matches(form_matcher)

        self.assertTrue(match)