예제 #1
0
    def parseConfig(self):
        config = DefaultConfigParser()
        configPath = FileUtils.build_path(self.script_path, "default.conf")
        config.read(configPath)

        # Mandatory
        self.defaultExtensions = config.safe_get("mandatory",
                                                 "default-extensions", str())
        self.excludeExtensions = config.safe_get("mandatory",
                                                 "exclude-extensions", None)
        self.forceExtensions = config.safe_getboolean("mandatory",
                                                      "force-extensions",
                                                      False)

        # General
        self.threadsCount = config.safe_getint("general", "threads", 30,
                                               list(range(1, 300)))
        self.includeStatusCodes = config.safe_get("general", "include-status",
                                                  None)
        self.excludeStatusCodes = config.safe_get("general", "exclude-status",
                                                  None)
        self.excludeSizes = config.safe_get("general", "exclude-sizes", None)
        self.excludeTexts = config.safe_get("general", "exclude-texts", None)
        self.excludeRegexps = config.safe_get("general", "exclude-regexps",
                                              None)
        self.excludeRedirects = config.safe_get("general", "exclude-redirects",
                                                None)
        self.excludeContent = config.safe_get("general", "exclude-content", "")
        self.recursive = config.safe_getboolean("general", "recursive", False)
        self.deep_recursive = config.safe_getboolean("general",
                                                     "deep-recursive", False)
        self.force_recursive = config.safe_getboolean("general",
                                                      "force-recursive", False)
        self.recursion_depth = config.safe_getint("general", "recursion-depth",
                                                  0)
        self.recursionStatusCodes = config.safe_get("general",
                                                    "recursion-status", None)
        self.excludeSubdirs = config.safe_get("general", "exclude-subdirs",
                                              None)
        self.skip_on_status = config.safe_get("general", "skip-on-status",
                                              None)
        self.maxtime = config.safe_getint("general", "max-time", 0)
        self.full_url = config.safe_getboolean("general", "full-url", False)
        self.color = config.safe_getboolean("general", "color", True)
        self.quiet = config.safe_getboolean("general", "quiet-mode", False)

        # Reports
        self.outputLocation = config.safe_get("reports",
                                              "report-output-folder", None)
        self.autosaveReport = config.safe_getboolean("reports",
                                                     "autosave-report", False)
        self.logsLocation = config.safe_get("reports", "logs-location", None)
        self.outputFormat = config.safe_get(
            "reports", "report-format", "plain",
            ["plain", "simple", "json", "xml", "md", "csv", "html"])

        # Dictionary
        self.wordlist = config.safe_get(
            "dictionary",
            "wordlist",
            FileUtils.build_path(self.script_path, "db", "dicc.txt"),
        )
        self.prefixes = config.safe_get("dictionary", "prefixes", None)
        self.suffixes = config.safe_get("dictionary", "suffixes", None)
        self.lowercase = config.safe_getboolean("dictionary", "lowercase",
                                                False)
        self.uppercase = config.safe_getboolean("dictionary", "uppercase",
                                                False)
        self.capitalization = config.safe_getboolean("dictionary",
                                                     "capitalization", False)

        # Request
        self.httpmethod = config.safe_get("request", "httpmethod", "get")
        self.headerList = config.safe_get("request", "headers-file", None)
        self.redirect = config.safe_getboolean("request", "follow-redirects",
                                               False)
        self.useragent = config.safe_get("request", "user-agent", None)
        self.useRandomAgents = config.safe_get("request", "random-user-agents",
                                               False)
        self.cookie = config.safe_get("request", "cookie", None)

        # Connection
        self.delay = config.safe_getfloat("connection", "delay", 0)
        self.timeout = config.safe_getint("connection", "timeout", 10)
        self.maxRetries = config.safe_getint("connection", "retries", 2)
        self.maxrate = config.safe_getint("connection", "max-rate", 0)
        self.proxy = config.safe_get("connection", "proxy", None)
        self.proxylist = config.safe_get("connection", "proxy-list", None)
        self.scheme = config.safe_get("connection", "scheme", "http",
                                      ["http", "https"])
        self.replay_proxy = config.safe_get("connection", "replay-proxy", None)
        self.requestByHostname = config.safe_getboolean(
            "connection", "request-by-hostname", False)
        self.exit_on_error = config.safe_getboolean("connection",
                                                    "exit-on-error", False)
예제 #2
0
    def parseConfig(self):
        config = DefaultConfigParser()
        configPath = FileUtils.build_path(self.script_path, "default.conf")
        config.read(configPath)

        # General
        self.threadsCount = config.safe_getint("general", "threads", 20,
                                               list(range(1, 300)))

        self.includeStatusCodes = config.safe_get("general", "include-status",
                                                  None)
        self.excludeStatusCodes = config.safe_get("general", "exclude-status",
                                                  None)
        self.excludeSizes = config.safe_get("general", "exclude-sizes", None)
        self.excludeTexts = config.safe_get("general", "exclude-texts", None)
        self.excludeRegexps = config.safe_get("general", "exclude-regexps",
                                              None)
        self.redirect = config.safe_getboolean("general", "follow-redirects",
                                               False)
        self.recursive = config.safe_getboolean("general", "recursive", False)
        self.recursive_level_max = config.safe_getint("general",
                                                      "recursive-level-max", 0)
        self.headerList = config.safe_get("general", "headers-file", None)
        self.testFailPath = config.safe_get("general", "calibration-path",
                                            "").strip()
        self.saveHome = config.safe_getboolean("general", "save-logs-home",
                                               False)
        self.defaultExtensions = config.safe_get("general",
                                                 "default-extensions", str())
        self.excludeSubdirs = config.safe_get("general", "exclude-subdirs",
                                              None)
        self.useRandomAgents = config.safe_get("general", "random-user-agents",
                                               False)
        self.useragent = config.safe_get("general", "user-agent", None)
        self.full_url = config.safe_getboolean("general", "full-url", False)
        self.color = config.safe_getboolean("general", "color", True)
        self.quiet = config.safe_getboolean("general", "quiet-mode", False)

        # Reports
        self.autoSave = config.safe_getboolean("reports", "autosave-report",
                                               False)
        self.autoSaveFormat = config.safe_get(
            "reports", "autosave-report-format", "txt",
            ["txt", "simple", "json", "xml", "md", "csv"])

        # Dictionary
        self.wordlist = config.safe_get(
            "dictionary",
            "wordlist",
            FileUtils.build_path(self.script_path, "db", "dicc.txt"),
        )
        self.prefixes = config.safe_get("dictionary", "prefixes", None)
        self.suffixes = config.safe_get("dictionary", "suffixes", None)
        self.lowercase = config.safe_getboolean("dictionary", "lowercase",
                                                False)
        self.uppercase = config.safe_getboolean("dictionary", "uppercase",
                                                False)
        self.capitalization = config.safe_getboolean("dictionary",
                                                     "capitalization", False)
        self.forceExtensions = config.safe_getboolean("dictionary",
                                                      "force-extensions",
                                                      False)

        # Connection
        self.delay = config.safe_getfloat("connection", "delay", 0)
        self.timeout = config.safe_getint("connection", "timeout", 10)
        self.maxRetries = config.safe_getint("connection", "max-retries", 3)
        self.proxy = config.safe_get("connection", "proxy", None)
        self.proxylist = config.safe_get("connection", "proxy-list", None)
        self.matches_proxy = config.safe_get("connection", "matches-proxy",
                                             None)
        self.httpmethod = config.safe_get("connection", "httpmethod", "get", [
            "get", "head", "post", "put", "patch", "delete", "trace",
            "options", "debug", "connect"
        ])
        self.requestByHostname = config.safe_getboolean(
            "connection", "request-by-hostname", False)
        self.exit_on_error = config.safe_getboolean("connection",
                                                    "exit-on-error", False)
        self.debug = config.safe_getboolean("connection", "debug", False)
예제 #3
0
    def parseConfig(self):
        config = DefaultConfigParser()
        configPath = FileUtils.build_path(self.script_path, "default.conf")
        config.read(configPath)

        # General
        self.threadsCount = config.safe_getint("general", "threads", 20,
                                               list(range(1, 200)))

        self.includeStatusCodes = config.safe_get("general", "include-status",
                                                  None)

        self.excludeStatusCodes = config.safe_get("general", "exclude-status",
                                                  None)
        self.excludeTexts = config.safe_get("general", "exclude-texts", None)
        self.redirect = config.safe_getboolean("general", "follow-redirects",
                                               False)
        self.recursive = config.safe_getboolean("general", "recursive", False)
        self.recursive_level_max = config.safe_getint("general",
                                                      "recursive-level-max", 1)
        self.suppressEmpty = config.safe_getboolean("general",
                                                    "suppress-empty", False)
        self.testFailPath = config.safe_get("general", "scanner-fail-path",
                                            "").strip()
        self.saveHome = config.safe_getboolean("general", "save-logs-home",
                                               False)
        self.defaultExtensions = config.safe_get(
            "general", "default-extensions", "php,asp,aspx,jsp,html,htm,js")
        self.excludeSubdirs = config.safe_get("general", "exclude-subdirs",
                                              None)
        self.full_url = config.safe_getboolean("general", "full_url", False)

        # Reports
        self.autoSave = config.safe_getboolean("reports", "autosave-report",
                                               False)
        self.autoSaveFormat = config.safe_get("reports",
                                              "autosave-report-format",
                                              "plain",
                                              ["plain", "json", "simple"])
        # Dictionary
        self.wordlist = config.safe_get(
            "dictionary",
            "wordlist",
            FileUtils.build_path(self.script_path, "db", "dicc.txt"),
        )
        self.prefixes = config.safe_get("dictionary", "prefixes", None)
        self.suffixes = config.safe_get("dictionary", "suffixes", None)
        self.lowercase = config.safe_getboolean("dictionary", "lowercase",
                                                False)
        self.uppercase = config.safe_getboolean("dictionary", "uppercase",
                                                False)
        self.capitalization = config.safe_getboolean("dictionary",
                                                     "capitalization", False)
        self.forceExtensions = config.safe_getboolean("dictionary",
                                                      "force-extensions",
                                                      False)
        self.noDotExtensions = config.safe_getboolean("dictionary",
                                                      "no-dot-extensions",
                                                      False)

        # Connection
        self.useRandomAgents = config.safe_get("connection",
                                               "random-user-agents", False)
        self.useragent = config.safe_get("connection", "user-agent", None)
        self.delay = config.safe_getfloat("connection", "delay", 0)
        self.timeout = config.safe_getint("connection", "timeout", 10)
        self.maxRetries = config.safe_getint("connection", "max-retries", 3)
        self.proxy = config.safe_get("connection", "http-proxy", None)
        self.proxylist = config.safe_get("connection", "http-proxy-list", None)
        self.httpmethod = config.safe_get("connection", "httpmethod", "get", [
            "get", "head", "post", "put", "patch", "delete", "trace",
            "options", "debug"
        ])
        self.requestByHostname = config.safe_getboolean(
            "connection", "request-by-hostname", False)
        self.stop = config.safe_getboolean("connection", "stop-on-error",
                                           False)