def thg_show(self, content):
        """
        Display module information

        Eg:
            show info
            show options
            show missing
        """
        if not self.module_instance:
            raise ModuleNotUseException()

        if content == "info":
            info = self.module_instance.get_info
            info_table = []
            self.poutput("Module info:")
            for item in info.keys():
                info_table.append([item + ":", info.get(item)])
            self.poutput(
                tabulate(info_table, colalign=("right",), tablefmt="plain"))

        if content == "options" or content == "info":
            options = self.module_instance.options.get_options()
            default_options_instance = BaseOption()
            options_table = []
            for option in options:
                options_table_row = []
                for field in default_options_instance.__dict__.keys():
                    options_table_row.append(getattr(option, field))
                options_table.append(options_table_row)

            self.poutput("Module options:")
            self.poutput(
                tabulate(
                    options_table,
                    headers=default_options_instance.__dict__.keys(),
                )
            )

        if content == "missing":
            missing_options = self.module_instance.get_missing_options()
            if len(missing_options) == 0:
                self.poutput("No option missing!")
                return None

            default_options_instance = BaseOption()
            missing_options_table = []
            for option in missing_options:
                options_table_row = []
                for field in default_options_instance.__dict__.keys():
                    options_table_row.append(getattr(option, field))
                missing_options_table.append(options_table_row)
            self.poutput("Missing Module options:")
            self.poutput(
                tabulate(
                    missing_options_table,
                    headers=default_options_instance.__dict__.keys(),
                )
            )
Beispiel #2
0
 def register_query_target(self, query="darkcode", pages=20):
     """adicionar metodo query, para busca de informações"""
     self.target_type = "query"
     self.register_options([
         BaseOption(name="query",
                    required=True,
                    description="query para busca de dados ",
                    value=query),
         BaseOption(name="pages",
                    required=True,
                    description="numero maximo de páginas a se buscar",
                    value=pages)
     ])
Beispiel #3
0
 def __init__(self):
     super(Exploit, self).__init__()
     self.update_info({
         "name":
         "teste THG nome",
         "description":
         "teste THG descricao",
         "author": ["teste THG autor"],
         "references": [
             "xxxxx1",
             "xxxxx2",
             "xxxxx3",
             "xxxxx4",
         ],
         "disclosure_date":
         "teste THG data",
         "service_name":
         "teste THG nome servico",
         "service_version":
         "teste THG autor versao",
     })
     self.register_http_target()
     self.register_options([
         BaseOption(name="teste",
                    required=True,
                    description="teste",
                    value="teste")
     ])
Beispiel #4
0
 def register_http_target(self, timeout_value=5, threads_value=1):
     """adiciona o os principais metodos do
      modulo nesse caso metodos classico de uma conexão http"""
     self.target_type = "http"
     self.register_options([
         BaseOption(name="URL",
                    required=True,
                    description="The url to be tested"),
         BaseOption(name="TIMEOUT",
                    required=True,
                    description="Connection timeout",
                    value=timeout_value),
         BaseOption(name="THREADS",
                    required=True,
                    description="The number of threads",
                    value=threads_value)
     ])
Beispiel #5
0
 def register_crawler_target(self,
                             enableUl=None,
                             storeDB=None,
                             maxUriLimit=None,
                             sleepTime=None,
                             takeTimeout=None,
                             readTimeout=None,
                             threadNum=None,
                             dontCrawl=None,
                             url=None):
     self.target_type = "crawler"
     self.register_options([
         BaseOption(name='url',
                    required=True,
                    description='target url',
                    value=url),
         BaseOption(name='EnableUl',
                    required=False,
                    description="Enable maximum number of request per URI",
                    value=enableUl),
         BaseOption(name='StoreDB',
                    required=False,
                    description="Store requests in database",
                    value=storeDB),
         BaseOption(name='MaxUriLimit',
                    required=False,
                    description="Number max. request per URI",
                    value=maxUriLimit),
         BaseOption(name='SleepTime',
                    required=False,
                    description="Sleep time (secs) between requests",
                    value=sleepTime),
         BaseOption(name='TakeTimeout',
                    required=False,
                    description="Timeout for loop ending",
                    value=takeTimeout),
         BaseOption(name='ReadTimeout',
                    required=False,
                    description="Read timeout (-1 forever)",
                    value=readTimeout),
         BaseOption(name='ThreadNum',
                    required=False,
                    description="Threads number",
                    value=threadNum),
         BaseOption(name='DontCrawl',
                    required=False,
                    description="Filestypes not to crawl",
                    value=dontCrawl)
     ])
Beispiel #6
0
 def register_social_target(self, url="https://www.darkcode0x00.com.br"):
     self.target_type = "social"
     """adicionar metodo url  para busca de redes sociais """
     self.target_type = "url"
     self.register_options([
         BaseOption(name="url",
                    required=True,
                    description="url para busca de dados  ",
                    value=url),
     ])
Beispiel #7
0
 def register_tcp_target(self,
                         port_value=None,
                         timeout_value=5,
                         threads_value=1):
     """adiciona o os principais metodos
     do modulo nesse caso metodos classico de uma conexão tcp"""
     self.target_type = "tcp"
     self.register_options([
         BaseOption(name="HOST",
                    required=True,
                    description="The IP address to be tested"),
         BaseOption(name="PORT",
                    required=True,
                    description="The port to be tested",
                    value=port_value),
         BaseOption(name="TIMEOUT",
                    required=True,
                    description="Connection timeout",
                    value=timeout_value),
         BaseOption(name="THREADS",
                    required=True,
                    description="The number of threads",
                    value=threads_value)
     ])