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


Python console_ui.ConsoleUI类代码示例

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


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

示例1: test_save_load_misc_settings

    def test_save_load_misc_settings(self):
        # Save the settings
        commands_to_run = ['misc-settings set msf_location /etc/',
                           'profiles save_as %s' % self.get_profile_name(),
                           'exit']

        expected = ('Profile saved.',)

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.startswith_expected_in_output(expected)
        self.assertTrue(assert_result, msg)
        
        self._assert_exists(self.get_profile_name())
        
        # Clean the mocked stdout
        self._mock_stdout.clear()
        
        # Load the settings
        commands_to_run = ['profiles',
                           'use %s' % self.get_profile_name(),
                           'back',
                           'misc-settings view',
                           'exit']

        expected = ('/etc/',)

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.all_expected_substring_in_output(expected)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:33,代码来源:test_profiles.py

示例2: test_menu_browse_target

    def test_menu_browse_target(self):
        commands_to_run = ['target', 'back', 'exit']

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        expected = ('w3af>>> ', 'w3af/config:target>>> ')
        assert_result, msg = self.all_expected_in_output(expected)
        self.assertTrue(assert_result, msg)
开发者ID:3rdDegree,项目名称:w3af,代码行数:9,代码来源:test_basic.py

示例3: test_menu_set_option_auto_save

    def test_menu_set_option_auto_save(self):
        commands_to_run = ['target set target http://moth/',
                           'target view',
                           'exit']

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        expected_start_with = ('| target ',
                               'The configuration has been saved.')
        assert_result, msg = self.startswith_expected_in_output(expected_start_with)
        self.assertTrue(assert_result, msg)
开发者ID:3rdDegree,项目名称:w3af,代码行数:12,代码来源:test_basic.py

示例4: test_load_profile_not_exists

    def test_load_profile_not_exists(self):
        commands_to_run = ['profiles',
                           'help',
                           'use do_not_exist',
                           'exit']

        expected = ('The profile "do_not_exist.pw3af" wasn\'t found.',)

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.startswith_expected_in_output(expected)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:13,代码来源:test_profiles.py

示例5: test_save_as_profile_no_param

    def test_save_as_profile_no_param(self):
        commands_to_run = ['profiles',
                           'use OWASP_TOP10',
                           'save_as',
                           'exit']

        expected = ('Parameter missing, please see the help',)

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.startswith_expected_in_output(expected)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:13,代码来源:test_profiles.py

示例6: test_menu_set_option_invalid_case01

    def test_menu_set_option_invalid_case01(self):
        # Invalid port
        commands_to_run = ['target', 'set target http://moth:301801/', 'view',
                           'back', 'exit']

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        expected_start_with = ('Invalid URL configured by user,',
                               # Because nothing was really saved and the
                               # config is empty, this will succeed
                               'The configuration has been saved.')
        assert_result, msg = self.startswith_expected_in_output(expected_start_with)
        self.assertTrue(assert_result, msg)
开发者ID:3rdDegree,项目名称:w3af,代码行数:14,代码来源:test_basic.py

示例7: TestAcceptDisclaimer

class TestAcceptDisclaimer(unittest.TestCase):

    def setUp(self):
        self.console_ui = ConsoleUI(do_upd=False)

    class dummy_true(Mock):
        accepted_disclaimer = True

    class dummy_false(Mock):
        accepted_disclaimer = False

    @patch('w3af.core.ui.console.console_ui.StartUpConfig', new_callable=dummy_false)
    @patch('__builtin__.raw_input', return_value='')
    def test_not_saved_not_accepted(self, mocked_startup_cfg, mocked_input):
        self.assertFalse(self.console_ui.accept_disclaimer())

    @patch('w3af.core.ui.console.console_ui.StartUpConfig', new_callable=dummy_false)
    @patch('__builtin__.raw_input', return_value='y')
    def test_not_saved_accepted(self, mocked_startup_cfg, mocked_input):
        self.assertTrue(self.console_ui.accept_disclaimer())

    @patch('w3af.core.ui.console.console_ui.StartUpConfig', new_callable=dummy_true)
    def test_saved(self, mocked_startup_cfg):
        self.assertTrue(self.console_ui.accept_disclaimer())
开发者ID:0x554simon,项目名称:w3af,代码行数:24,代码来源:test_accept_disclaimer.py

示例8: test_save_as_profile

    def test_save_as_profile(self):
        commands_to_run = ['profiles',
                           'use OWASP_TOP10',
                           'save_as unittest',
                           'exit']

        expected = ('Profile saved.',)

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.startswith_expected_in_output(expected)
        self.assertTrue(assert_result, msg)
        
        self._assert_exists('unittest')
开发者ID:3rdDegree,项目名称:w3af,代码行数:15,代码来源:test_profiles.py

示例9: test_menu_simple_save

    def test_menu_simple_save(self):
        commands_to_run = ['plugins crawl config dir_file_bruter',
                           'set file_wordlist /etc/passwd',
                           'save',
                           'view',
                           'back',
                           'exit']

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        expected_start_with = (' /etc/passwd   ',
                               'The configuration has been saved.')
        assert_result, msg = self.all_expected_substring_in_output(expected_start_with)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:15,代码来源:test_save.py

示例10: test_menu_plugin_desc

    def test_menu_plugin_desc(self):
        commands_to_run = ['plugins',
                           'infrastructure desc zone_h',
                           'back',
                           'exit']

        expected = ('This plugin searches the zone-h.org',
                    'result. The information stored in',
                    'previous defacements to the target website.')

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.startswith_expected_in_output(expected)
        self.assertTrue(assert_result, msg)
开发者ID:3rdDegree,项目名称:w3af,代码行数:15,代码来源:test_basic.py

示例11: test_menu_save_with_dependencies_error

    def test_menu_save_with_dependencies_error(self):
        commands_to_run = ['plugins audit config rfi',
                           'set use_w3af_site false',
                           'set listen_address abc',
                           'save',
                           'view',
                           'back',
                           'exit']

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        expected_start_with = ('Identified an error with the user-defined settings',)
        assert_result, msg = self.startswith_expected_in_output(expected_start_with)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:15,代码来源:test_save.py

示例12: test_menu_set_option_case01

    def test_menu_set_option_case01(self):
        commands_to_run = ['target', 'set target http://moth/', 'save', 'view',
                           'back', 'exit']

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        expected = ('w3af>>> ', 'w3af/config:target>>> ',
                    'The configuration has been saved.\r\n')
        assert_result, msg = self.all_expected_in_output(expected)
        self.assertTrue(assert_result, msg)
        
        expected_start_with = ('| http://moth/',)
        assert_result, msg = self.all_expected_substring_in_output(expected_start_with)
        self.assertTrue(assert_result, msg)
开发者ID:3rdDegree,项目名称:w3af,代码行数:15,代码来源:test_basic.py

示例13: test_load_profile_exists

    def test_load_profile_exists(self):
        commands_to_run = ['profiles',
                           'help',
                           'use OWASP_TOP10',
                           'exit']

        expected = (
            'The plugins configured by the scan profile have been enabled',
            'Please set the target URL',
            ' | Use a profile.')

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.all_expected_substring_in_output(expected)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:16,代码来源:test_profiles.py

示例14: test_load_profile_by_filepath

    def test_load_profile_by_filepath(self):
        tmp_profile = tempfile.NamedTemporaryFile(suffix='.pw3af')
        commands_to_run = ['profiles',
                           'help',
                           'use ' + tmp_profile.name,
                           'exit']

        expected = (
            'The plugins configured by the scan profile have been enabled',
            'Please set the target URL',
            ' | Use a profile.')

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        assert_result, msg = self.all_expected_substring_in_output(expected)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:17,代码来源:test_profiles.py

示例15: test_menu_save_with_dependencies_success

    def test_menu_save_with_dependencies_success(self):
        commands_to_run = ['plugins audit config rfi',
                           'set use_w3af_site false',
                           'set listen_address 127.0.0.1',
                           'set listen_port 8081',
                           'save',
                           'view',
                           'back',
                           'exit']

        self.console = ConsoleUI(commands=commands_to_run, do_upd=False)
        self.console.sh()

        expected_start_with = ('127.0.0.1',
                               '8081')
        assert_result, msg = self.all_expected_substring_in_output(expected_start_with)
        self.assertTrue(assert_result, msg)
开发者ID:0x554simon,项目名称:w3af,代码行数:17,代码来源:test_save.py


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