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")
def set_color(message, bold=False): if isinstance(message, bytes): message = message.decode(UNICODE_ENCODING) ret = message if message and getattr(LOGGER_HANDLER, "is_tty", False): # colorizing handler if bold: ret = colored(message, color=None, on_color=None, attrs=("bold",)) return ret
def _show_info(self, *args, **kwargs): fields = ["name", "VulID", "version", "author", "vulDate", "createDate", "updateDate", "references", "appPowerLink", "appName", "appVersion", "vulType", "desc"] msg = "" for field in fields: value = getattr(self.current_module, field, None) if value: value = str(value).strip() # for name highlight if field == "name": value = colored(value, "green") msg = msg + "%-20s %-10s\n" % (field, value) data_to_stdout("\n") data_to_stdout(msg) data_to_stdout("\n")