コード例 #1
0
ファイル: interpreter.py プロジェクト: 5l1v3r1/pocsuite3-1
    def command_search(self, *args, **kwargs):
        keyword = args[0]

        if not keyword:
            logger.warning(
                "Please specify search keyword. e.g. 'search wordpress'")
            return

        tb = prettytable.PrettyTable()
        tb.field_names = ["Index", "Path"]

        search_result = []
        for module in self.main_modules_dirs:
            m = re.search(keyword, module, re.I | re.S)
            if m:
                search_result.append((module, m.group(0)))

        index = 0
        for s, k in search_result:
            tb.add_row(
                [index, "{}\033[31m{}\033[0m{}".format(*s.partition(k))])
            index = index + 1

        self.last_search = [i for i, j in search_result]
        data_to_stdout(tb.get_string())
        data_to_stdout("\n")
コード例 #2
0
ファイル: interpreter.py プロジェクト: 5l1v3r1/pocsuite3-1
 def _show_ip(self, *args, **kwargs):
     ips = get_local_ip(all=True)
     tb = prettytable.PrettyTable(["Index", "IP"])
     index = 0
     for item in ips:
         tb.add_row([str(index), item])
         index += 1
     data_to_stdout("\n" + tb.get_string() + "\n")
コード例 #3
0
ファイル: interpreter.py プロジェクト: 5l1v3r1/pocsuite3-1
    def _show_options(self, *args, **kwargs):
        global_options = self.current_module.global_options
        module_options = self.current_module.options
        payload_options = self.current_module.payload_options

        tb2 = prettytable.PrettyTable(
            ["Name", "Current settings", "Type", "Descript"])
        for name, opt in global_options.items():
            value = opt.value
            if opt.require and value == "":
                value = colored("*require*", "red")
            tb2.add_row([name, value, opt.type, opt.description])
        data_to_stdout("\nTarget options:\n")
        data_to_stdout(tb2.get_string())
        data_to_stdout("\n")

        if module_options:
            tb = prettytable.PrettyTable(
                ["Name", "Current settings", "Type", "Descript"])
            # add target option
            for name, opt in module_options.items():
                value = opt.value
                if opt.require and value == "":
                    value = colored("*require*", "red")
                tb.add_row([name, value, opt.type, opt.description])
            data_to_stdout("\nModule options:\n")
            data_to_stdout(tb.get_string())
            data_to_stdout("\n")

        # exploit payload
        if payload_options:
            tb3 = prettytable.PrettyTable(
                ["Name", "Current settings", "Type", "Descript"])
            for name, opt in payload_options.items():
                value = opt.value
                if opt.require and value == "":
                    value = colored("*require*", "red")
                tb3.add_row([name, value, opt.type, opt.description])
            data_to_stdout("\nExploit payloads(using reverse tcp):\n")
            data_to_stdout(tb3.get_string())
            data_to_stdout("\n")

        data_to_stdout("\n")
コード例 #4
0
ファイル: interpreter.py プロジェクト: 5l1v3r1/pocsuite3-1
 def command_list(self, *args, **kwargs):
     # 展现所有可用的poc
     search_result = []
     tb = prettytable.PrettyTable(["Index", "Path", "Name"])
     index = 0
     for tmp_module in self.main_modules_dirs:
         found = os.path.join(paths.POCSUITE_ROOT_PATH, tmp_module + ".py")
         with open(found, encoding='utf-8') as f:
             code = f.read()
         name = get_poc_name(code)
         tb.add_row([str(index), tmp_module, name])
         search_result.append(tmp_module)
         index += 1
     data_to_stdout("\n" + tb.get_string() + "\n")
     self.last_search = search_result