• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python console_ui.ConsoleUI类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_SQL_scan

    def test_SQL_scan(self):
        target = get_moth_http("/audit/sql_injection/where_string_single_qs.py")
        qs = "?uname=pablo"
        commands_to_run = [
            "plugins",
            "output console,text_file",
            "output config text_file",
            "set output_file %s" % self.OUTPUT_FILE,
            "set http_output_file %s" % self.OUTPUT_HTTP_FILE,
            "set verbose True",
            "back",
            "output config console",
            "set verbose False",
            "back",
            "audit sqli",
            "crawl web_spider",
            "crawl config web_spider",
            "set only_forward True",
            "back",
            "grep path_disclosure",
            "back",
            "target",
            "set target %s%s" % (target, qs),
            "back",
            "start",
            "exit",
        ]

        expected = (
            "SQL injection in ",
            "A SQL error was found in the response supplied by ",
            "Found 1 URLs and 1 different injections points",
            "Scan finished",
        )

        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)

        found_errors = self.error_in_output(["No such file or directory", "Exception"])

        self.assertFalse(found_errors)
开发者ID:ZionOps,项目名称:w3af,代码行数:44,代码来源:test_scan_run.py


示例17: test_menu_simple_save_with_view

    def test_menu_simple_save_with_view(self):
        """
        Reproduces the issue at https://github.com/andresriancho/w3af/issues/474
        where a "view" call overwrites any previously set value with the default
        """
        commands_to_run = ['plugins crawl config dir_file_bruter',
                           'set file_wordlist /etc/passwd',
                           'view',
                           'back',
                           'plugins crawl config dir_file_bruter',
                           '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,代码行数:21,代码来源:test_save.py


示例18: test_save_as_self_contained_profile

    def test_save_as_self_contained_profile(self):
        commands_to_run = ['profiles',
                           'use OWASP_TOP10',
                           'save_as %s self-contained' % 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)

        # The profile is now self contained
        p = profile(self.get_profile_name())
        self.assertIn('caFileName = base64://',
                      file(p.profile_file_name).read())

        # Before it wasn't
        p = profile('OWASP_TOP10')
        self.assertIn('caFileName = %ROOT_PATH%',
                      file(p.profile_file_name).read())
开发者ID:0x554simon,项目名称:w3af,代码行数:23,代码来源:test_profiles.py


示例19: test_SQL_scan

    def test_SQL_scan(self):
        target = get_moth_http('/audit/sql_injection/where_string_single_qs.py')
        target_path = get_moth_http('/audit/sql_injection/')
        qs = '?uname=pablo'
        commands_to_run = ['plugins',
                           'output console,text_file',
                           'output config text_file',
                           'set output_file %s' % self.OUTPUT_FILE,
                           'set http_output_file %s' % self.OUTPUT_HTTP_FILE,
                           'set verbose True', 'back',
                           'output config console',
                           'set verbose False', 'back',
                           'audit sqli',
                           'crawl web_spider',
                           'crawl config web_spider',
                           'set only_forward True', 'back',
                           'grep path_disclosure',
                           'back',
                           'target',
                           'set target %s%s' % (target, qs), 'back',
                           'start',
                           'exit']

        expected = ('SQL injection in ',
                    'A SQL error was found in the response supplied by ',
                    'New URL found by web_spider plugin: "%s"' % target_path)

        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)

        found_errors = self.error_in_output(['No such file or directory',
                                             'Exception'])

        self.assertFalse(found_errors)
开发者ID:3rdDegree,项目名称:w3af,代码行数:37,代码来源:test_scan_run.py


示例20: test_use_self_contained_profile

    def test_use_self_contained_profile(self):
        """
        Makes sure that we're able to use a self-contained profile and that
        it's transparent for the plugin code.
        """
        #
        #   Make the profile self-contained and load it
        #
        commands_to_run = ['profiles',
                           'use OWASP_TOP10',
                           'save_as %s self-contained' % self.get_profile_name(),
                           'back',
                           'profiles',
                           'use %s' % self.get_profile_name(),
                           'back',
                           'plugins audit config ssl_certificate',
                           'view',
                           'exit']

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

        #
        # Extract the temp file from the plugin configuration and read it
        #
        for line in self._mock_stdout.messages:
            match = re.search('(/tmp/w3af-.*-sc\.dat)', line)
            if not match:
                continue

            filename = match.group(0)

            self.assertIn('Bundle of CA Root Certificates',
                          file(filename).read())
            break
        else:
            self.assertTrue(False, 'No self contained file found')
开发者ID:0x554simon,项目名称:w3af,代码行数:37,代码来源:test_profiles.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tables.table函数代码示例发布时间:2022-05-26
下一篇:
Python upper_daemon.UpperDaemon类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap