▸py55 lines · 2613 chars
Summary (under 1500 chars):
- What it is: Dirhunt CLI (Python) to find web directories without bruteforce. Accepts one or more URLs or domains; can load URLs from files via absolute or relative paths.
- Core flow: sets up a Crawler with many options, processes targets, supports resuming a previous run via a resume file, and prints results. If a resume file exists, it may resume or raise IncompatibleVersionError.
- Key options (short/long):
- -t/--threads: int
- -x/--exclude-flags: exclude results with these flags
- -i/--include-flags: include only results with these flags
- -e/--interesting-extensions: default: php, zip, sh, asp, csv, log
- -f/--interesting-files: default: access_log, error_log, error, logs, dump
- -k/--interesting-keywords
- --stdout-flags: subset of stdout to show
- --progress-enabled/--progress-disabled
- --timeout
- --max-depth
- --not-follow-subdomains
- --exclude-sources
- -p/--proxies
- -d/--delay
- --not-allow-redirects
- --limit
- --to-file: Path to create a JSON report
- -u/--user-agent
- -c/--cookie and -h/--header: key:value pairs (multiple)
- --version: prints version info and checks for newer PyPI release
- Mutually exclusive: --exclude-flags and --include-flags cannot be used together.
- Startup/UX messages:
- If no URLs: prints a help/usage hint: “•_•) OOPS! Add urls to analyze... Need help? Then use dirhunt --help”
- On resume: prints “Resuming the previous program execution...”
- On resume mismatch: prints the IncompatibleVersionError message
- Outputs:
- Normal results shown on stdout; if stdout is not a tty, uses stdout-flavored output via output_urls
- If --to-file is set, creates a JSON report
- If a resume file exists and no --to-file, it may delete the resume file after finishing
- Internal/related items:
- STATUS_CODES, INTERESTING_EXTS, INTERESTING_FILES, STDOUT_FLAGS
- latest_release(package) uses PyPI to fetch latest version for dirhunt and suggests upgrading with: sudo pip install -U dirhunt
- Uses force_url, read_file_lines, value_is_file_path, etc.
- Dependencies: dirhunt.crawler.Crawler, dirhunt.exceptions, dirhunt.output, dirhunt.sources, colorama
- Availability logic:
- Excludes sources via names from SOURCE_CLASSES
- Exclude/include flag ranges can expand via flags_range
- Command entry points:
- hunt(...) is the Click command
- main() wraps hunt with catch()
- Notable behavior: help text indicates one or more domain/URL targets; supports reading URLs from files; prints installation path, Python version, and current path in version output.