Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)