コード例 #1
0
ファイル: text.py プロジェクト: sechacking/golismero
 def generate_report(self, output_file):
     self.__show_data = not Config.audit_config.only_vulns
     if output_file and output_file.lower().endswith(".txt"):
         Logger.log_verbose("Writing text report to file: %s" % output_file)
         self.__color = False
         self.__width = 0
         self.__console = False
         with open(output_file, mode='w') as self.__fd:
             self.__write_report()
     else:
         self.__console = True
         self.__color = Console.use_colors
         self.__width = max(0, get_terminal_size()[0])
         self.__fd = sys.stdout
         self.__write_report()
コード例 #2
0
ファイル: text.py プロジェクト: 0day1day/golismero
 def generate_report(self, output_file):
     self.__show_data = not Config.audit_config.only_vulns
     if output_file and output_file.lower().endswith(".txt"):
         Logger.log_verbose("Writing text report to file: %s" % output_file)
         self.__color = False
         self.__width = 0
         self.__console = False
         with open(output_file, mode='w') as self.__fd:
             self.__write_report()
     else:
         self.__console = True
         self.__color = Console.use_colors
         self.__width = max(0, get_terminal_size()[0])
         self.__fd = sys.stdout
         self.__write_report()
コード例 #3
0
def cmdline_parser():

    # Fix the console width bug in argparse.
    try:
        os.environ["COLUMNS"] = str(get_terminal_size()[0])
    except Exception:
        pass

    # Use Bash autocompletion when available.
    try:
        from argcomplete import autocomplete
        from argcomplete.completers import ChoicesCompleter, FilesCompleter
        autocomplete_enabled = True
    except ImportError:
        autocomplete_enabled = False
    if autocomplete_enabled:

        def profiles_completer(prefix, **kwargs):
            return [
                v for v in get_available_profiles() if v.startswith(prefix)
            ]

        def plugins_completer(prefix, **kwargs):
            if ":" in prefix:
                return [
                    prefix,
                ]
            names = []
            base = get_default_plugins_folder()
            for cat in CATEGORIES:
                for (_, _, filenames) in os.walk(path.join(base, cat)):
                    for filename in filenames:
                        if filename.startswith(prefix):
                            name, ext = path.splitext(filename)
                            if ext.lower() == ".golismero":
                                names.append(name)
            return names

    parser = ArgumentParserWithBanner(fromfile_prefix_chars="@",
                                      add_help=False)

    cmd = parser.add_argument("command",
                              metavar="COMMAND",
                              help="action to perform")
    if autocomplete_enabled:
        cmd.completer = ChoicesCompleter(COMMANDS + tuple(x.lower()
                                                          for x in COMMANDS))
    parser.add_argument(
        "targets",
        metavar="TARGET",
        nargs="*",
        help="zero or more arguments, meaning depends on command")

    parser.add_argument("-h",
                        action=QuickHelpAction,
                        default=argparse.SUPPRESS,
                        help="show this help message and exit")
    parser.add_argument("--help",
                        action='help',
                        default=argparse.SUPPRESS,
                        help="show this help message and exit")

    gr_main = parser.add_argument_group("main options")
    cmd = gr_main.add_argument(
        "-f",
        "--file",
        metavar="FILE",
        action=LoadListFromFileAction,
        help="load a list of targets from a plain text file")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(directories=False)
    cmd = gr_main.add_argument("--config",
                               metavar="FILE",
                               help="global configuration file")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".conf", ),
                                       directories=False)
    cmd = gr_main.add_argument("--user-config",
                               metavar="FILE",
                               help="per-user configuration file")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".conf", ),
                                       directories=False)
    cmd = gr_main.add_argument("-p",
                               "--profile",
                               metavar="NAME",
                               help="profile to use")
    if autocomplete_enabled:
        cmd.completer = profiles_completer
    cmd = gr_main.add_argument("--ui-mode", metavar="MODE", help="UI mode")
    if autocomplete_enabled:
        cmd.completer = ChoicesCompleter(("console", "disabled"))  ##, "web"))
    gr_main.add_argument("-v",
                         "--verbose",
                         action="count",
                         help="increase output verbosity")
    gr_main.add_argument("-q",
                         "--quiet",
                         action="store_const",
                         dest="verbose",
                         const=0,
                         help="suppress text output")
    gr_main.add_argument("--color",
                         action="store_true",
                         default=None,
                         dest="color",
                         help="use colors in console output")
    gr_main.add_argument("--no-color",
                         action="store_false",
                         default=None,
                         dest="color",
                         help="suppress colors in console output")

    gr_audit = parser.add_argument_group("audit options")
    gr_audit.add_argument("--audit-name",
                          metavar="NAME",
                          help="customize the audit name")
    cmd = gr_audit.add_argument("-db",
                                "--audit-db",
                                metavar="DATABASE",
                                dest="audit_db",
                                help="specify a database filename")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".db", ),
                                       directories=False)
    gr_audit.add_argument("-nd",
                          "--no-db",
                          dest="audit_db",
                          action="store_const",
                          const=":memory:",
                          help="do not store the results in a database")
    cmd = gr_audit.add_argument(
        "-i",
        "--input",
        dest="imports",
        metavar="FILENAME",
        action="append",
        help="read results from external tools right before the audit")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".csv", ".xml",
                                                     ".nessus"),
                                       directories=False)
    gr_audit.add_argument("-ni",
                          "--no-input",
                          dest="disable_importing",
                          action="store_true",
                          default=False,
                          help="do not read results from external tools")
    gr_report = parser.add_argument_group("report options")
    cmd = gr_report.add_argument(
        "-o",
        "--output",
        dest="reports",
        metavar="FILENAME",
        action="append",
        help="write the results of the audit to this file (use - for stdout)")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".html", ".rst", ".txt"),
                                       directories=False)
    gr_report.add_argument("-no",
                           "--no-output",
                           dest="disable_reporting",
                           action="store_true",
                           default=False,
                           help="do not output the results")
    gr_report.add_argument("--full",
                           action="store_false",
                           default=None,
                           dest="only_vulns",
                           help="produce fully detailed reports")
    gr_report.add_argument("--brief",
                           action="store_true",
                           dest="only_vulns",
                           help="report only the highlights")

    gr_net = parser.add_argument_group("network options")
    gr_net.add_argument("--allow-subdomains",
                        action="store_true",
                        default=False,
                        dest="include_subdomains",
                        help="include subdomains in the target scope")
    gr_net.add_argument("--forbid-subdomains",
                        action="store_false",
                        default=None,
                        dest="include_subdomains",
                        help="do not include subdomains in the target scope")
    gr_net.add_argument("--parent",
                        action="store_true",
                        default=None,
                        dest="allow_parent",
                        help="include parent folders in the target scope")
    gr_net.add_argument(
        "-np",
        "--no-parent",
        action="store_false",
        default=None,
        dest="allow_parent",
        help="do not include parent folders in the target scope")
    cmd = gr_net.add_argument(
        "-r",
        "--depth",
        help="maximum spidering depth (use \"infinite\" for no limit)")
    if autocomplete_enabled:
        cmd.completer = ChoicesCompleter((
            "1",
            "200",
            "infinite",
        ))
    gr_net.add_argument("--follow-redirects",
                        action="store_true",
                        default=None,
                        dest="follow_redirects",
                        help="follow redirects")
    gr_net.add_argument("--no-follow-redirects",
                        action="store_false",
                        default=None,
                        dest="follow_redirects",
                        help="do not follow redirects")
    gr_net.add_argument(
        "--follow-first",
        action="store_true",
        default=None,
        dest="follow_first_redirect",
        help="always follow a redirection on the target URL itself")
    gr_net.add_argument(
        "--no-follow-first",
        action="store_false",
        default=None,
        dest="follow_first_redirect",
        help="don't treat a redirection on a target URL as a special case")
    gr_net.add_argument(
        "--max-connections",
        help="maximum number of concurrent connections per host")
    gr_net.add_argument(
        "-l",
        "--max-links",
        type=int,
        default=None,
        help="maximum number of links to analyze (0 => infinite)")
    gr_net.add_argument("-pu",
                        "--proxy-user",
                        metavar="USER",
                        help="HTTP proxy username")
    gr_net.add_argument("-pp",
                        "--proxy-pass",
                        metavar="PASS",
                        help="HTTP proxy password")
    gr_net.add_argument("-pa",
                        "--proxy-addr",
                        metavar="ADDRESS",
                        help="HTTP proxy address")
    gr_net.add_argument("-pn",
                        "--proxy-port",
                        metavar="PORT",
                        help="HTTP proxy port number")
    gr_net.add_argument("--cookie",
                        metavar="COOKIE",
                        help="set cookie for requests")
    gr_net.add_argument("--user-agent",
                        metavar="USER_AGENT",
                        help="set a custom user agent or 'random' value")
    cmd = gr_net.add_argument("--cookie-file",
                              metavar="FILE",
                              action=ReadValueFromFileAction,
                              dest="cookie",
                              help="load a cookie from file")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(directories=False)
    gr_net.add_argument("--persistent-cache",
                        action="store_true",
                        dest="use_cache_db",
                        default=True,
                        help="use a persistent network cache [default]")
    gr_net.add_argument("--volatile-cache",
                        action="store_false",
                        dest="use_cache_db",
                        help="use a volatile network cache")

    gr_plugins = parser.add_argument_group("plugin options")
    cmd = gr_plugins.add_argument("-a",
                                  "--plugin-arg",
                                  metavar="PLUGIN:KEY=VALUE",
                                  action=SetPluginArgumentAction,
                                  dest="raw_plugin_args",
                                  help="pass an argument to a plugin")
    if autocomplete_enabled:
        cmd.completer = plugins_completer
    cmd = gr_plugins.add_argument("-e",
                                  "--enable-plugin",
                                  metavar="PLUGIN",
                                  action=EnablePluginAction,
                                  default=[],
                                  dest="plugin_load_overrides",
                                  help="enable a plugin")
    if autocomplete_enabled:
        cmd.completer = plugins_completer
    cmd = gr_plugins.add_argument("-d",
                                  "--disable-plugin",
                                  metavar="PLUGIN",
                                  action=DisablePluginAction,
                                  dest="plugin_load_overrides",
                                  help="disable a plugin")
    if autocomplete_enabled:
        cmd.completer = plugins_completer
    gr_plugins.add_argument(
        "--max-concurrent",
        metavar="N",
        type=int,
        default=None,
        help="maximum number of plugins to run concurrently")
    gr_plugins.add_argument(
        "--plugin-timeout",
        metavar="N",
        type=float,
        default=None,
        help="timeout in seconds for the execution of a plugin")
    cmd = gr_plugins.add_argument("--plugins-folder",
                                  metavar="PATH",
                                  help="customize the location of the plugins")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(directories=True)

    if autocomplete_enabled:
        autocomplete(parser)

    quick_help = (
        ################################################################################
        "\n"
        "  SCAN:\n"
        "    Perform a vulnerability scan on the given targets. Optionally import\n"
        "    results from other tools and write a report. The arguments that follow may\n"
        "    be domain names, IP addresses or web pages.\n"
        "\n"
        "  RESCAN:\n"
        "    Same as SCAN, but previously run tests are repeated. If the database is\n"
        "    new, this command is identical to SCAN.\n"
        "\n"
        "  PROFILES:\n"
        "    Show a list of available config profiles. This command takes no arguments.\n"
        "\n"
        "  PLUGINS:\n"
        "    Show a list of available plugins. This command takes no arguments.\n"
        "\n"
        "  INFO:\n"
        "    Show detailed information on a given plugin. The arguments that follow are\n"
        "    the plugin IDs. You can use glob-style wildcards.\n"
        "\n"
        "  REPORT:\n"
        "    Write a report from an earlier scan. This command takes no arguments.\n"
        "    To specify output files use the -o switch.\n"
        "\n"
        "  IMPORT:\n"
        "    Import results from other tools and optionally write a report, but don't\n"
        "    scan the targets. This command takes no arguments. To specify input files\n"
        "    use the -i switch.\n"
        "\n"
        "  DUMP:\n"
        "    Dump the database from an earlier scan in SQL format. This command takes no\n"
        "    arguments. To specify output files use the -o switch.\n"
        "\n"
        "  LOAD:\n"
        "    Load a database dump from an earlier scan in SQL format. This command takes\n"
        "    no arguments. To specify input files use the -i switch.\n"
        "\n"
        "  UPDATE:\n"
        "    Update GoLismero to the latest version. Requires Git to be installed and\n"
        "    available in the PATH. This command takes no arguments.\n"
        "\n"
        "examples:\n"
        "\n"
        "  scan a website and show the results on screen:\n"
        "    %(prog)s scan http://www.example.com\n"
        "\n"
        "  grab Nmap results, scan all hosts found and write an HTML report:\n"
        "    %(prog)s scan -i nmap_output.xml -o report.html\n"
        "\n"
        "  grab results from OpenVAS and show them on screen, but don't scan anything:\n"
        "    %(prog)s import -i openvas_output.xml\n"
        "\n"
        "  show a list of all available configuration profiles:\n"
        "    %(prog)s profiles\n"
        "\n"
        "  show a list of all available plugins:\n"
        "    %(prog)s plugins\n"
        "\n"
        "  show information on all bruteforcer plugins:\n"
        "    %(prog)s info brute_*\n"
        "\n"
        "  dump the database from a previous scan:\n"
        "    %(prog)s dump -db example.db -o dump.sql\n"
        "\n"
        ################################################################################
    )

    parser.usage = parser.format_usage()[7:] + \
                   "\navailable commands:\n" + quick_help
    parser.quick_help = (
        "usage: %(prog)s COMMAND [TARGETS...] [--options]\n" \
        + quick_help) % {"prog": parser.prog}

    return parser
コード例 #4
0
ファイル: golismero.py プロジェクト: 0day1day/golismero
def cmdline_parser():

    # Fix the console width bug in argparse.
    try:
        os.environ["COLUMNS"] = str(get_terminal_size()[0])
    except Exception:
        pass

    # Use Bash autocompletion when available.
    try:
        from argcomplete import autocomplete
        from argcomplete.completers import ChoicesCompleter, FilesCompleter
        autocomplete_enabled = True
    except ImportError:
        autocomplete_enabled = False

    if autocomplete_enabled:
        def profiles_completer(prefix, **kwargs):
            return (v for v in get_available_profiles() if v.startswith(prefix))
        def plugins_completer(prefix, **kwargs):
            if ":" in prefix:
                return (prefix,)
            names = []
            base = get_default_plugins_folder()
            for cat in PluginManager.CATEGORIES:
                for (_, _, filenames) in os.walk(path.join(base, cat)):
                    for filename in filenames:
                        if filename.startswith(prefix):
                            name, ext = path.splitext(filename)
                            if ext.lower() == ".golismero":
                                names.append(name)
            return names

    parser = CustomArgumentParser(fromfile_prefix_chars="@")

    cmd = parser.add_argument("command", metavar="COMMAND", help="action to perform")
    if autocomplete_enabled:
        cmd.completer = ChoicesCompleter(COMMANDS + tuple(x.lower() for x in COMMANDS))
    parser.add_argument("targets", metavar="TARGET", nargs="*", help="zero or more arguments, meaning depends on command")

    gr_main = parser.add_argument_group("main options")
    cmd = gr_main.add_argument("-f", "--file", metavar="FILE", action=LoadListFromFileAction, help="load a list of targets from a plain text file")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(directories=False)
    cmd = gr_main.add_argument("--config", metavar="FILE", help="global configuration file")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".conf",), directories=False)
    cmd = gr_main.add_argument("-p", "--profile", metavar="NAME", help="profile to use")
    if autocomplete_enabled:
        cmd.completer = profiles_completer
    cmd = gr_main.add_argument("--ui-mode", metavar="MODE", help="UI mode")
    if autocomplete_enabled:
        cmd.completer = ChoicesCompleter(("console", "disabled")) ##, "web"))
    gr_main.add_argument("-v", "--verbose", action="count", help="increase output verbosity")
    gr_main.add_argument("-q", "--quiet", action="store_const", dest="verbose", const=0, help="suppress text output")
    gr_main.add_argument("--color", action="store_true", default=None, dest="color", help="use colors in console output")
    gr_main.add_argument("--no-color", action="store_false", default=None, dest="color", help="suppress colors in console output")

    gr_audit = parser.add_argument_group("audit options")
    gr_audit.add_argument("--audit-name", metavar="NAME", help="customize the audit name")
    cmd = gr_audit.add_argument("-db", "--audit-db", metavar="DATABASE", dest="audit_db", help="specify a database connection string")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".db",), directories=False)
    gr_audit.add_argument("-nd", "--no-db", dest="audit_db", action="store_const", const="memory://", help="do not store the results in a database")
    cmd = gr_audit.add_argument("-i", "--input", dest="imports", metavar="FILENAME", action="append", help="read results from external tools right before the audit")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".csv", ".xml"), directories=False)
    gr_audit.add_argument("-ni", "--no-input", dest="disable_importing", action="store_true", default=False, help="do not read results from external tools")
    gr_report = parser.add_argument_group("report options")
    cmd = gr_report.add_argument("-o", "--output", dest="reports", metavar="FILENAME", action="append", help="write the results of the audit to this file (use - for stdout)")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(allowednames=(".html", ".rst", ".txt"), directories=False)
    gr_report.add_argument("-no", "--no-output", dest="disable_reporting", action="store_true", default=False, help="do not output the results")
    gr_report.add_argument("--full", action="store_false", default=None, dest="only_vulns", help="produce fully detailed reports")
    gr_report.add_argument("--brief", action="store_true", dest="only_vulns", help="report only the highlights")

    gr_net = parser.add_argument_group("network options")
    gr_net.add_argument("--max-connections", help="maximum number of concurrent connections per host")
    gr_net.add_argument("--allow-subdomains", action="store_true", default=None, dest="include_subdomains", help="include subdomains in the target scope")
    gr_net.add_argument("--forbid-subdomains", action="store_false", default=None, dest="include_subdomains", help="do not include subdomains in the target scope")
    ##gr_net.add_argument("--subdomain-regex", metavar="REGEX", help="filter subdomains using a regular expression")
    cmd = gr_net.add_argument("-r", "--depth", help="maximum spidering depth (use \"infinite\" for no limit)")
    if autocomplete_enabled:
        cmd.completer = ChoicesCompleter(("infinite",))
    gr_net.add_argument("-l", "--max-links", type=int, default=None, help="maximum number of links to analyze (0 => infinite)")
    gr_net.add_argument("--follow-redirects", action="store_true", default=None, dest="follow_redirects", help="follow redirects")
    gr_net.add_argument("--no-follow-redirects", action="store_false", default=None, dest="follow_redirects", help="do not follow redirects")
    gr_net.add_argument("--follow-first", action="store_true", default=None, dest="follow_first_redirect", help="always follow a redirection on the target URL itself")
    gr_net.add_argument("--no-follow-first", action="store_false", default=None, dest="follow_first_redirect", help="don't treat a redirection on a target URL as a special case")
    gr_net.add_argument("-pu","--proxy-user", metavar="USER", help="HTTP proxy username")
    gr_net.add_argument("-pp","--proxy-pass", metavar="PASS", help="HTTP proxy password")
    gr_net.add_argument("-pa","--proxy-addr", metavar="ADDRESS:PORT", help="HTTP proxy address in format: address:port")
    gr_net.add_argument("--cookie", metavar="COOKIE", help="set cookie for requests")
    cmd = gr_net.add_argument("--cookie-file", metavar="FILE", action=ReadValueFromFileAction, dest="cookie", help="load a cookie from file")
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(directories=False)
    gr_net.add_argument("--persistent-cache", action="store_true", dest="use_cache_db", default=True, help="use a persistent network cache [default]")
    gr_net.add_argument("--volatile-cache", action="store_false", dest="use_cache_db", help="use a volatile network cache")

    gr_plugins = parser.add_argument_group("plugin options")
    cmd = gr_plugins.add_argument("-a", "--plugin-arg", metavar="PLUGIN:KEY=VALUE", action=SetPluginArgumentAction, dest="plugin_args", help="pass an argument to a plugin")
    if autocomplete_enabled:
        cmd.completer = plugins_completer
    cmd = gr_plugins.add_argument("-e", "--enable-plugin", metavar="PLUGIN", action=EnablePluginAction, default=[], dest="plugin_load_overrides", help="enable a plugin")
    if autocomplete_enabled:
        cmd.completer = plugins_completer
    cmd = gr_plugins.add_argument("-d", "--disable-plugin", metavar="PLUGIN", action=DisablePluginAction, dest="plugin_load_overrides", help="disable a plugin")
    if autocomplete_enabled:
        cmd.completer = plugins_completer
    gr_plugins.add_argument("--max-concurrent", metavar="N", type=int, default=None, help="maximum number of plugins to run concurrently")
    cmd = gr_plugins.add_argument("--plugins-folder", metavar="PATH", help="customize the location of the plugins" )
    if autocomplete_enabled:
        cmd.completer = FilesCompleter(directories=True)

    if autocomplete_enabled:
        autocomplete(parser)

    parser.usage = parser.format_usage()[7:] + (
        ################################################################################
        "\n"
        "available commands:\n"
        "\n"
        "  SCAN:\n"
        "    Perform a vulnerability scan on the given targets. Optionally import\n"
        "    results from other tools and write a report. The arguments that follow may\n"
        "    be domain names, IP addresses or web pages.\n"
        "\n"
        "  PROFILES:\n"
        "    Show a list of available config profiles. This command takes no arguments.\n"
        "\n"
        "  PLUGINS:\n"
        "    Show a list of available plugins. This command takes no arguments.\n"
        "\n"
        "  INFO:\n"
        "    Show detailed information on a given plugin. The arguments that follow are\n"
        "    the plugin IDs. You can use glob-style wildcards.\n"
        "\n"
        "  REPORT:\n"
        "    Write a report from an earlier scan. This command takes no arguments.\n"
        "    To specify output files use the -o switch.\n"
        "\n"
        "  IMPORT:\n"
        "    Import results from other tools and optionally write a report, but don't\n"
        "    scan the targets. This command takes no arguments. To specify input files\n"
        "    use the -i switch.\n"
        "\n"
        "  DUMP:\n"
        "    Dump the database from an earlier scan in SQL format. This command takes no\n"
        "    arguments. To specify output files use the -o switch.\n"
        "\n"
        "  UPDATE:\n"
        "    Update GoLismero to the latest version. Requires Git to be installed and\n"
        "    available in the PATH. This command takes no arguments.\n"
        "\n"
        "examples:\n"
        "\n"
        "  scan a website and show the results on screen:\n"
        "    %(prog)s scan http://www.example.com\n"
        "\n"
        "  grab Nmap results, scan all hosts found and write an HTML report:\n"
        "    %(prog)s scan -i nmap_output.xml -o report.html\n"
        "\n"
        "  grab results from OpenVAS and show them on screen, but don't scan anything:\n"
        "    %(prog)s import -i openvas_output.xml\n"
        "\n"
        "  show a list of all available configuration profiles:\n"
        "    %(prog)s profiles\n"
        "\n"
        "  show a list of all available plugins:\n"
        "    %(prog)s plugins\n"
        "\n"
        "  show information on all bruteforcer plugins:\n"
        "    %(prog)s info brute_*\n"
        "\n"
        "  dump the database from a previous scan:\n"
        "    %(prog)s dump -db example.db -o dump.sql\n"
        "\n"
        ################################################################################
    )

    return parser
コード例 #5
0
ファイル: golismero.py プロジェクト: damarsan/golismero
def cmdline_parser():

    # Fix the console width bug in argparse.
    try:
        os.environ["COLUMNS"] = str(get_terminal_size()[0])
    except Exception:
        pass

    parser = CustomArgumentParser(fromfile_prefix_chars="@")
    parser.add_argument("targets", metavar="TARGET", nargs="*", help="one or more target web sites")

    gr_main = parser.add_argument_group("main options")
    gr_main.add_argument("-f", "--file", metavar="FILE", action=LoadListFromFileAction, help="load a list of targets from a plain text file")
    gr_main.add_argument("--config", metavar="FILE", help="global configuration file")
    gr_main.add_argument("-p", "--profile", metavar="NAME", help="profile to use")
    gr_main.add_argument("--profile-list", action="store_true", default=False, help="list available profiles and quit")
    gr_main.add_argument("--ui-mode", metavar="MODE", help="UI mode")
    gr_main.add_argument("-v", "--verbose", action="count", help="increase output verbosity")
    gr_main.add_argument("-q", "--quiet", action="store_const", dest="verbose", const=0, help="suppress text output")
    gr_main.add_argument("--color", action="store_true", default=None, dest="colorize", help="use colors in console output")
    gr_main.add_argument("--no-color", action="store_false", default=None, dest="colorize", help="suppress colors in console output")
##    gr_main.add_argument("--forward-io", metavar="ADDRESS:PORT", help="forward all input and output to the given TCP address and port")

    gr_audit = parser.add_argument_group("audit options")
    gr_audit.add_argument("--audit-name", metavar="NAME", help="customize the audit name")
    gr_audit.add_argument("-db", "--audit-db", metavar="DATABASE", dest="audit_db", help="specify a database connection string")
    gr_audit.add_argument("-nd", "--no-db", dest="audit_db", action="store_const", const="memory://", help="do not store the results in a database")
    gr_audit.add_argument("-i", "--input", dest="imports", metavar="FILENAME", action="append", help="read results from external tools right before the audit")
    gr_audit.add_argument("-ni", "--no-input", dest="disable_importing", action="store_true", default=False, help="do not read results from external tools")

    gr_report = parser.add_argument_group("report options")
    gr_report.add_argument("-o", "--output", dest="reports", metavar="FILENAME", action="append", help="write the results of the audit to this file (use - for stdout)")
    gr_report.add_argument("-no", "--no-output", dest="disable_reporting", action="store_true", default=False, help="do not output the results")
    gr_report.add_argument("--only-vulns", action="store_true", default=None, dest="only_vulns", help="display only the vulnerabilities, instead of all the resources found")

    gr_net = parser.add_argument_group("network options")
    gr_net.add_argument("--max-connections", help="maximum number of concurrent connections per host")
    gr_net.add_argument("--allow-subdomains", action="store_true", default=None, dest="include_subdomains", help="include subdomains in the target scope")
    gr_net.add_argument("--forbid-subdomains", action="store_false", default=None, dest="include_subdomains", help="do not include subdomains in the target scope")
    gr_net.add_argument("--subdomain-regex", metavar="REGEX", help="filter subdomains using a regular expression")
    gr_net.add_argument("-r", "--depth", help="maximum spidering depth (use \"infinite\" for no limit)")
    gr_net.add_argument("-l", "--max-links", type=int, default=None, help="maximum number of links to analyze (0 => infinite)")
    gr_net.add_argument("--follow-redirects", action="store_true", default=None, dest="follow_redirects", help="follow redirects")
    gr_net.add_argument("--no-follow-redirects", action="store_false", default=None, dest="follow_redirects", help="do not follow redirects")
    gr_net.add_argument("--follow-first", action="store_true", default=None, dest="follow_first_redirect", help="always follow a redirection on the target URL itself")
    gr_net.add_argument("--no-follow-first", action="store_false", default=None, dest="follow_first_redirect", help="don't treat a redirection on a target URL as a special case")
    gr_net.add_argument("-pu","--proxy-user", metavar="USER", help="HTTP proxy username")
    gr_net.add_argument("-pp","--proxy-pass", metavar="PASS", help="HTTP proxy password")
    gr_net.add_argument("-pa","--proxy-addr", metavar="ADDRESS:PORT", help="HTTP proxy address in format: address:port")
    gr_net.add_argument("--cookie", metavar="COOKIE", help="set cookie for requests")
    gr_net.add_argument("--cookie-file", metavar="FILE", action=ReadValueFromFileAction, dest="cookie", help="load a cookie from file")
    gr_net.add_argument("--persistent-cache", action="store_true", dest="use_cache_db", default=True, help="use a persistent network cache [default]")
    gr_net.add_argument("--volatile-cache", action="store_false", dest="use_cache_db", help="use a volatile network cache")

    gr_plugins = parser.add_argument_group("plugin options")
    gr_plugins.add_argument("-a", "--plugin-arg", metavar="PLUGIN:KEY=VALUE", action=SetPluginArgumentAction, dest="plugin_args", help="pass an argument to a plugin")
    gr_plugins.add_argument("-e", "--enable-plugin", metavar="NAME", action=EnablePluginAction, default=[], dest="plugin_load_overrides", help="enable a plugin")
    gr_plugins.add_argument("-d", "--disable-plugin", metavar="NAME", action=DisablePluginAction, dest="plugin_load_overrides", help="disable a plugin")
    gr_plugins.add_argument("--max-process", metavar="N", type=int, default=None, help="maximum number of plugins to run concurrently")
    gr_plugins.add_argument("--plugins-folder", metavar="PATH", help="customize the location of the plugins" )
    gr_plugins.add_argument("--plugin-list", action="store_true", default=False, help="list available plugins and quit")
    gr_plugins.add_argument("--plugin-info", metavar="NAME", dest="plugin_name", help="show plugin info and quit")

    return parser