Beispiel #1
0
    def test_reflection_context_text(self):
        template = 'AAAA%sAAAA'

        channel = Channel({
            'url':
            'http://127.0.0.1:15001/reflect/mako?tpl=%s&inj=*' % template
        })
        Mako(channel).detect()
        del channel.data['os']
        self.assertEqual(channel.data, self.expected_data)
Beispiel #2
0
    def test_header_reflection(self):

        template = '%s'

        channel = Channel({
            'url': 'http://127.0.0.1:15001/header/mako',
            'headers': ['User-Agent: *']
        })
        Mako(channel).detect()
        del channel.data['os']
        self.assertEqual(channel.data, self.expected_data)
Beispiel #3
0
    def test_post_reflection(self):

        template = '%s'

        channel = Channel({
            'url': 'http://127.0.0.1:15001/post/mako',
            'post_data': ['inj=*']
        })
        Mako(channel).detect()
        del channel.data['os']
        self.assertEqual(channel.data, self.expected_data)
Beispiel #4
0
    def test_post_reflection(self):

        template = '%s'

        channel = Channel({
            'url': 'http://127.0.0.1:15001/post/mako',
            'force_level': [0, 0],
            'data': 'inj=*&othervar=1'
        })
        Mako(channel).detect()
        del channel.data['os']
        self.assertEqual(channel.data, self.expected_data)
Beispiel #5
0
    def test_reflection_limit(self):
        template = '%s'

        channel = Channel({
            'url':
            'http://127.0.0.1:15001/limit/mako?tpl=%s&inj=*' % template
        })

        Mako(channel).detect()

        expected_data = {'render_tag': self.expected_data['render_tag']}

        self.assertEqual(channel.data, expected_data)
Beispiel #6
0
    def test_reflection_context_code(self):
        template = '${%s}'

        channel = Channel({
            'url':
            'http://127.0.0.1:15001/reflect/mako?tpl=%s&inj=*' % template
        })
        Mako(channel).detect()

        expected_data = self.expected_data.copy()
        expected_data.update({'prefix': '}', 'suffix': '${'})

        del channel.data['os']
        self.assertEqual(channel.data, expected_data)
Beispiel #7
0
    def test_reflection_limit(self):
        template = '%s'

        channel = Channel({
            'url':
            'http://127.0.0.1:15001/limit/mako?tpl=%s&inj=*&limit=20' %
            template,
            'injection_tag':
            '*'
        })

        Mako(channel).detect()

        expected_data = {
            'unreliable_render': self.expected_data['render'],
            'unreliable': 'Mako'
        }

        self.assertEqual(channel.data, expected_data)