Debian Codegraph @

README.md

raw
1 <img src="static/logo.png#gh-light-mode-only" alt="dirsearch logo (light)" width="675px">
2 <img src="static/logo-dark.png#gh-dark-mode-only" alt="dirsearch logo (dark)" width="675px">
3
4 dirsearch - Web path discovery
5 =========
6
7 ![Build](https://img.shields.io/badge/Built%20with-Python-Blue)
8 ![License](https://img.shields.io/badge/license-GNU_General_Public_License-_red.svg)
9 ![Stars](https://img.shields.io/github/stars/maurosoria/dirsearch.svg)
10 [![Release](https://img.shields.io/github/release/maurosoria/dirsearch.svg)](https://github.com/maurosoria/dirsearch/releases)
11 [![Sponsors](https://img.shields.io/github/sponsors/maurosoria)](https://github.com/sponsors/maurosoria)
12 [![Discord](https://img.shields.io/discord/992276296669339678.svg?logo=discord)](https://discord.gg/2N22ZdAJRj)
13 [![Twitter](https://img.shields.io/twitter/follow/_dirsearch?label=Follow)](https://twitter.com/_dirsearch)
14
15
16 > An advanced web path brute-forcer
17
18 **dirsearch** is being actively developed by [@maurosoria](https://twitter.com/_maurosoria) and [@shelld3v](https://twitter.com/shells3c_)
19
20 *Reach to our [Discord server](https://discord.gg/2N22ZdAJRj) to communicate with the team at best*
21
22
23 Table of Contents
24 ------------
25 - [Supported Platforms](#supported-platforms)
26 - [Installation & Usage](#installation--usage)
27 - [Standalone Binaries](#standalone-binaries)
28 - [Wordlists](#wordlists-important)
29 - [Options](#options)
30 - [Configuration](#configuration)
31 - [How to use](#how-to-use)
32 - [Session Management](#session-management)
33 - [Support Docker](#support-docker)
34 - [Building from Source](#building-from-source)
35 - [CI/CD & GitHub Workflows](#cicd--github-workflows)
36 - [References](#references)
37 - [Tips](#tips)
38 - [Contribution](#contribution)
39 - [License](#license)
40
41
42 Supported Platforms
43 ------------
44
45 dirsearch runs on multiple platforms and can be used either via Python or standalone binaries:
46
47 | Platform | Python | Standalone Binary |
48 |----------|--------|-------------------|
49 | **Linux** (x86_64) | Python 3.9+ | `dirsearch-linux-amd64` |
50 | **Windows** (x64) | Python 3.9+ | `dirsearch-windows-x64.exe` |
51 | **macOS** (Intel) | Python 3.9+ | `dirsearch-macos-intel` |
52 | **macOS** (Apple Silicon) | Python 3.9+ | `dirsearch-macos-silicon` |
53
54 Standalone binaries are self-contained executables that don't require Python installation.
55
56
57 Installation & Usage
58 ------------
59
60 **Requirement: python 3.9 or higher**
61
62 Choose one of these installation options:
63
64 - Install with **git**: `git clone https://github.com/maurosoria/dirsearch.git --depth 1` (**RECOMMENDED**)
65 - Install with ZIP file: [Download here](https://github.com/maurosoria/dirsearch/archive/master.zip)
66 - Install with Docker: `docker build -t "dirsearch:v0.4.3" .` (more information can be found [here](https://github.com/maurosoria/dirsearch#support-docker))
67 - Install with PyPi: `pip3 install dirsearch` or `pip install dirsearch`
68 - Install with Kali Linux: `sudo apt-get install dirsearch` (deprecated)
69
70
71 Standalone Binaries
72 ------------
73
74 Pre-built standalone binaries are available for all major platforms. These don't require Python to be installed.
75
76 **Download from [Releases](https://github.com/maurosoria/dirsearch/releases)**
77
78 | Platform | Binary Name | Architecture |
79 |----------|-------------|--------------|
80 | Linux | `dirsearch-linux-amd64` | x86_64 |
81 | Windows | `dirsearch-windows-x64.exe` | x64 |
82 | macOS Intel | `dirsearch-macos-intel` | x86_64 |
83 | macOS Apple Silicon | `dirsearch-macos-silicon` | ARM64 |
84
85 **Usage:**
86 ```sh
87 # Linux/macOS - make executable first
88 chmod +x dirsearch-linux-amd64
89 ./dirsearch-linux-amd64 -u https://target
90
91 # Windows
92 dirsearch-windows-x64.exe -u https://target
93 ```
94
95 **Note:** Standalone binaries include bundled `db/` wordlists and `config.ini`. Session files are stored in `$HOME/.dirsearch/sessions/` when using bundled builds.
96
97
98 Wordlists (IMPORTANT)
99 ---------------
100 **Summary:**
101 - Wordlist is a text file, each line is a path.
102 - About extensions, unlike other tools, dirsearch only replaces the `%EXT%` keyword with extensions from **-e** flag.
103 - For wordlists without `%EXT%` (like [SecLists](https://github.com/danielmiessler/SecLists)), **-f | --force-extensions** switch is required to append extensions to every word in wordlist, as well as the `/`.
104 - To apply your extensions to wordlist entries that have extensions already, use **-O** | **--overwrite-extensions** (Note: some extensions are excluded from being overwritted such as *.log*, *.json*, *.xml*, ... or media extensions like *.jpg*, *.png*)
105 - To use multiple wordlists, you can separate your wordlists with commas. Example: `wordlist1.txt,wordlist2.txt`.
106 - Bundled wordlist categories live in `db/categories/` and can be selected with **--wordlist-categories**. Available: `extensions`, `conf`, `vcs`, `backups`, `db`, `logs`, `keys`, `web`, `common` (use `all` to include everything).
107
108 <details>
109 <summary><strong>Wordlist Examples (click to expand)</strong></summary>
110
111 **Examples:**
112
113 - *Normal extensions*:
114 ```
115 index.%EXT%
116 ```
117
118 Passing **asp** and **aspx** as extensions will generate the following dictionary:
119
120 ```
121 index
122 index.asp
123 index.aspx
124 ```
125
126 - *Force extensions*:
127 ```
128 admin
129 ```
130
131 Passing **php** and **html** as extensions with **-f**/**--force-extensions** flag will generate the following dictionary:
132
133 ```
134 admin
135 admin.php
136 admin.html
137 admin/
138 ```
139
140 - *Overwrite extensions*:
141 ```
142 login.html
143 ```
144
145 Passing **jsp** and **jspa** as extensions with **-O**/**--overwrite-extensions** flag will generate the following dictionary:
146
147 ```
148 login.html
149 login.jsp
150 login.jspa
151 ```
152
153 </details>
154
155
156 Options
157 -------
158
159 <details>
160 <summary><strong>Full Options List (click to expand)</strong></summary>
161
162 ```
163 Usage: dirsearch.py [-u|--url] target [-e|--extensions] extensions [options]
164
165 Options:
166 --version show program's version number and exit
167 -h, --help show this help message and exit
168
169 Mandatory:
170 -u URL, --url=URL Target URL(s), can use multiple flags
171 -l PATH, --urls-file=PATH
172 URL list file
173 --stdin Read URL(s) from STDIN
174 --cidr=CIDR Target CIDR
175 --raw=PATH Load raw HTTP request from file (use '--scheme' flag
176 to set the scheme)
177 --nmap-report=PATH Load targets from nmap report (Ensure the inclusion of
178 the -sV flag during nmap scan for comprehensive
179 results)
180 -s SESSION_FILE, --session=SESSION_FILE
181 Session file
182 Note: legacy .pickle/.pkl sessions are no longer supported.
183 --config=PATH Path to configuration file (Default:
184 'DIRSEARCH_CONFIG' environment variable, otherwise
185 'config.ini')
186
187 Dictionary Settings:
188 -w WORDLISTS, --wordlists=WORDLISTS
189 Wordlist files or directories contain wordlists
190 (separated by commas)
191 --wordlist-categories=CATEGORIES
192 Comma-separated wordlist category names (e.g.
193 common,conf,web). Use 'all' to include all bundled
194 categories
195 -e EXTENSIONS, --extensions=EXTENSIONS
196 Extension list separated by commas (e.g. php,asp)
197 -f, --force-extensions
198 Add extensions to the end of every wordlist entry. By
199 default dirsearch only replaces the %EXT% keyword with
200 extensions
201 -O, --overwrite-extensions
202 Overwrite other extensions in the wordlist with your
203 extensions (selected via `-e`)
204 --exclude-extensions=EXTENSIONS
205 Exclude extension list separated by commas (e.g.
206 asp,jsp)
207 --remove-extensions
208 Remove extensions in all paths (e.g. admin.php ->
209 admin)
210 --prefixes=PREFIXES
211 Add custom prefixes to all wordlist entries (separated
212 by commas)
213 --suffixes=SUFFIXES
214 Add custom suffixes to all wordlist entries, ignore
215 directories (separated by commas)
216 -U, --uppercase Uppercase wordlist
217 -L, --lowercase Lowercase wordlist
218 -C, --capital Capital wordlist
219
220 General Settings:
221 -t THREADS, --threads=THREADS
222 Number of threads
223 --list-sessions List resumable sessions and exit
224 --sessions-dir=PATH Directory to search for resumable sessions (default:
225 dirsearch path /sessions, or $HOME/.dirsearch/sessions
226 when bundled)
227 --async Enable asynchronous mode
228 -r, --recursive Brute-force recursively
229 --deep-recursive Perform recursive scan on every directory depth (e.g.
230 api/users -> api/)
231 --force-recursive Do recursive brute-force for every found path, not
232 only directories
233 -R DEPTH, --max-recursion-depth=DEPTH
234 Maximum recursion depth
235 --recursion-status=CODES
236 Valid status codes to perform recursive scan, support
237 ranges (separated by commas)
238 --subdirs=SUBDIRS Scan sub-directories of the given URL[s] (separated by
239 commas)
240 --exclude-subdirs=SUBDIRS
241 Exclude the following subdirectories during recursive
242 scan (separated by commas)
243 -i CODES, --include-status=CODES
244 Include status codes, separated by commas, support
245 ranges (e.g. 200,300-399)
246 -x CODES, --exclude-status=CODES
247 Exclude status codes, separated by commas, support
248 ranges (e.g. 301,500-599)
249 --exclude-sizes=SIZES
250 Exclude responses by sizes, separated by commas (e.g.
251 0B,4KB)
252 --exclude-text=TEXTS
253 Exclude responses by text, can use multiple flags
254 --exclude-regex=REGEX
255 Exclude responses by regular expression
256 --exclude-redirect=STRING
257 Exclude responses if this regex (or text) matches
258 redirect URL (e.g. '/index.html')
259 --exclude-response=PATH
260 Exclude responses similar to response of this page,
261 path as input (e.g. 404.html)
262 --skip-on-status=CODES
263 Skip target whenever hit one of these status codes,
264 separated by commas, support ranges
265 --min-response-size=LENGTH
266 Minimum response length
267 --max-response-size=LENGTH
268 Maximum response length
269 --max-time=SECONDS Maximum runtime for the scan
270 --exit-on-error Exit whenever an error occurs
271
272 Request Settings:
273 -m METHOD, --http-method=METHOD
274 HTTP method (default: GET)
275 -d DATA, --data=DATA
276 HTTP request data
277 --data-file=PATH File contains HTTP request data
278 -H HEADERS, --header=HEADERS
279 HTTP request header, can use multiple flags
280 --headers-file=PATH
281 File contains HTTP request headers
282 -F, --follow-redirects
283 Follow HTTP redirects
284 --random-agent Choose a random User-Agent for each request
285 --auth=CREDENTIAL Authentication credential (e.g. user:password or
286 bearer token)
287 --auth-type=TYPE Authentication type (basic, digest, bearer, ntlm, jwt)
288 --cert-file=PATH File contains client-side certificate
289 --key-file=PATH File contains client-side certificate private key
290 (unencrypted)
291 --user-agent=USER_AGENT
292 --cookie=COOKIE
293
294 Connection Settings:
295 --timeout=TIMEOUT Connection timeout
296 --delay=DELAY Delay between requests
297 -p PROXY, --proxy=PROXY
298 Proxy URL (HTTP/SOCKS), can use multiple flags
299 --proxies-file=PATH
300 File contains proxy servers
301 --proxy-auth=CREDENTIAL
302 Proxy authentication credential
303 --replay-proxy=PROXY
304 Proxy to replay with found paths
305 --tor Use Tor network as proxy
306 --scheme=SCHEME Scheme for raw request or if there is no scheme in the
307 URL (Default: auto-detect)
308 --max-rate=RATE Max requests per second
309 --retries=RETRIES Number of retries for failed requests
310 --ip=IP Server IP address
311 --interface=NETWORK_INTERFACE
312 Network interface to use
313
314 Advanced Settings:
315 --crawl Crawl for new paths in responses
316
317 View Settings:
318 --full-url Full URLs in the output (enabled automatically in
319 quiet mode)
320 --redirects-history
321 Show redirects history
322 --no-color No colored output
323 -q, --quiet-mode Quiet mode
324
325 Output Settings:
326 -o PATH/URL, --output=PATH/URL
327 Output file or MySQL/PostgreSQL URL (Format:
328 scheme://[username:password@]host[:port]/database-
329 name)
330 --format=FORMAT Report format (Available: simple, plain, json, xml,
331 md, csv, html, sqlite, mysql, postgresql)
332 --log=PATH Log file
333 ```
334
335 </details>
336
337
338 Configuration
339 ---------------
340
341 <details>
342 <summary><strong>Configuration File Reference (click to expand)</strong></summary>
343
344 By default, `config.ini` inside your dirsearch directory is used as the configuration file but you can select another file via `--config` flag or `DIRSEARCH_CONFIG` environment variable.
345
346 ```ini
347 # If you want to edit dirsearch default configurations, you can
348 # edit values in this file. Everything after `#` is a comment
349 # and won't be applied
350
351 [general]
352 threads = 25
353 async = False
354 recursive = False
355 deep-recursive = False
356 force-recursive = False
357 recursion-status = 200-399,401,403
358 max-recursion-depth = 0
359 exclude-subdirs = %%ff/,.;/,..;/,;/,./,../,%%2e/,%%2e%%2e/
360 random-user-agents = False
361 max-time = 0
362 exit-on-error = False
363 # subdirs = /,api/
364 # include-status = 200-299,401
365 # exclude-status = 400,500-999
366 # exclude-sizes = 0b,123gb
367 # exclude-text = "Not found"
368 # exclude-regex = "^403$"
369 # exclude-redirect = "*/error.html"
370 # exclude-response = 404.html
371 # skip-on-status = 429,999
372
373 [dictionary]
374 default-extensions = php,aspx,jsp,html,js
375 force-extensions = False
376 overwrite-extensions = False
377 lowercase = False
378 uppercase = False
379 capitalization = False
380 # exclude-extensions = old,log
381 # prefixes = .,admin
382 # suffixes = ~,.bak
383 # wordlists = /path/to/wordlist1.txt,/path/to/wordlist2.txt
384
385 [request]
386 http-method = get
387 follow-redirects = False
388 # headers-file = /path/to/headers.txt
389 # user-agent = MyUserAgent
390 # cookie = SESSIONID=123
391
392 [connection]
393 timeout = 7.5
394 delay = 0
395 max-rate = 0
396 max-retries = 1
397 ## By disabling `scheme` variable, dirsearch will automatically identify the URI scheme
398 # scheme = http
399 # proxy = localhost:8080
400 # proxy-file = /path/to/proxies.txt
401 # replay-proxy = localhost:8000
402
403 [advanced]
404 crawl = False
405
406 [view]
407 full-url = False
408 quiet-mode = False
409 color = True
410 show-redirects-history = False
411
412 [output]
413 ## Support: plain, simple, json, xml, md, csv, html, sqlite
414 report-format = plain
415 autosave-report = True
416 autosave-report-folder = reports/
417 # log-file = /path/to/dirsearch.log
418 # log-file-size = 50000000
419 ```
420
421 </details>
422
423
424 How to use
425 ---------------
426
427 [![Dirsearch demo](https://asciinema.org/a/380112.svg)](https://asciinema.org/a/380112)
428
429 Some examples for how to use dirsearch - those are the most common arguments. If you need all, just use the **-h** argument.
430
431 ### Simple usage
432 ```
433 python3 dirsearch.py -u https://target
434 ```
435
436 ```
437 python3 dirsearch.py -e php,html,js -u https://target
438 ```
439
440 ```
441 python3 dirsearch.py -e php,html,js -u https://target -w /path/to/wordlist
442 ```
443
444 <details>
445 <summary><strong>More Usage Examples (click to expand)</strong></summary>
446
447 ---
448 ### Pausing progress
449 dirsearch allows you to pause the scanning progress with CTRL+C, from here, you can save the progress (and continue later), skip the current target, or skip the current sub-directory.
450
451 <img src="static/pause.png" alt="Pausing dirsearch" width="475px">
452
453 ----
454 ### Recursion
455 - Recursive brute-force is brute-forcing continuously the after of found directories. For example, if dirsearch finds `admin/`, it will brute-force `admin/*` (`*` is where it brute forces). To enable this feature, use **-r** (or **--recursive**) flag
456
457 ```
458 python3 dirsearch.py -e php,html,js -u https://target -r
459 ```
460 - You can set the max recursion depth with **--max-recursion-depth**, and status codes to recurse with **--recursion-status**
461
462 ```
463 python3 dirsearch.py -e php,html,js -u https://target -r --max-recursion-depth 3 --recursion-status 200-399
464 ```
465 - There are 2 more options: **--force-recursive** and **--deep-recursive**
466 - **Force recursive**: Brute force recursively all found paths, not just paths end with `/`
467 - **Deep recursive**: Recursive brute-force all depths of a path (`a/b/c` => add `a/`, `a/b/`)
468
469 - If there are sub-directories that you do not want to brute-force recursively, use `--exclude-subdirs`
470
471 ```
472 python3 dirsearch.py -e php,html,js -u https://target -r --exclude-subdirs image/,media/,css/
473 ```
474
475 ----
476 ### Threads
477 The thread number (**-t | --threads**) reflects the number of separated brute force processes. And so the bigger the thread number is, the faster dirsearch runs. By default, the number of threads is 25, but you can increase it if you want to speed up the progress.
478
479 In spite of that, the speed still depends a lot on the response time of the server. And as a warning, we advise you to keep the threads number not too big because it can cause DoS (Denial of Service).
480
481 ```
482 python3 dirsearch.py -e php,htm,js,bak,zip,tgz,txt -u https://target -t 20
483 ```
484
485 ----
486 ### Asynchronous
487 You can switch to asynchronous mode by `--async`, let dirsearch use coroutines instead of threads to handle concurrent requests.
488
489 In theory, asynchronous mode offers better performance and lower CPU usage since it doesn't require switching between different thread contexts. Additionally, pressing CTRL+C will immediately pause progress without needing to wait for threads to suspend.
490
491 ----
492 ### Prefixes / Suffixes
493 - **--prefixes**: Add custom prefixes to all entries
494
495 ```
496 python3 dirsearch.py -e php -u https://target --prefixes .,admin,_
497 ```
498 Wordlist:
499
500 ```
501 tools
502 ```
503 Generated with prefixes:
504
505 ```
506 tools
507 .tools
508 admintools
509 _tools
510 ```
511
512 - **--suffixes**: Add custom suffixes to all entries
513
514 ```
515 python3 dirsearch.py -e php -u https://target --suffixes ~
516 ```
517 Wordlist:
518
519 ```
520 index.php
521 internal
522 ```
523 Generated with suffixes:
524
525 ```
526 index.php
527 internal
528 index.php~
529 internal~
530 ```
531
532 ----
533 ### Blacklist
534 Inside the `db/` folder, there are several "blacklist files". Paths in those files will be filtered from the scan result if they have the same status as mentioned in the filename.
535
536 Example: If you add `admin.php` into `db/403_blacklist.txt`, whenever you do a scan that `admin.php` returns 403, it will be filtered from the result.
537
538 ----
539 ### Filters
540 Use **-i | --include-status** and **-x | --exclude-status** to select allowed and not allowed response status-codes
541
542 For more advanced filters: **--exclude-sizes**, **--exclude-texts**, **--exclude-regexps**, **--exclude-redirects** and **--exclude-response**
543
544 ```
545 python3 dirsearch.py -e php,html,js -u https://target --exclude-sizes 1B,243KB
546 ```
547
548 ```
549 python3 dirsearch.py -e php,html,js -u https://target --exclude-texts "403 Forbidden"
550 ```
551
552 ```
553 python3 dirsearch.py -e php,html,js -u https://target --exclude-regexps "^Error$"
554 ```
555
556 ```
557 python3 dirsearch.py -e php,html,js -u https://target --exclude-redirects "https://(.*).okta.com/*"
558 ```
559
560 ```
561 python3 dirsearch.py -e php,html,js -u https://target --exclude-response /error.html
562 ```
563
564 ----
565 ### Raw request
566 dirsearch allows you to import the raw request from a file. The content would be something looked like this:
567
568 ```http
569 GET /admin HTTP/1.1
570 Host: admin.example.com
571 Cache-Control: max-age=0
572 Accept: */*
573 ```
574
575 Since there is no way for dirsearch to know what the URI scheme is, you need to set it using the `--scheme` flag. By default, dirsearch automatically detects the scheme.
576
577 ----
578 ### Wordlist formats
579 Supported wordlist formats: uppercase, lowercase, capitalization
580
581 #### Lowercase:
582
583 ```
584 admin
585 index.html
586 ```
587 #### Uppercase:
588
589 ```
590 ADMIN
591 INDEX.HTML
592 ```
593 #### Capital:
594
595 ```
596 Admin
597 Index.html
598 ```
599
600 ----
601 ### Exclude extensions
602 Use **-X | --exclude-extensions** with an extension list will remove all paths in the wordlist that contains the given extensions
603
604 `python3 dirsearch.py -u https://target -X jsp`
605
606 Wordlist:
607
608 ```
609 admin.php
610 test.jsp
611 ```
612 After:
613
614 ```
615 admin.php
616 ```
617
618 ----
619 ### Scan sub-directories
620 - From an URL, you can scan a list of sub-directories with **--subdirs**.
621
622 ```
623 python3 dirsearch.py -e php,html,js -u https://target --subdirs /,admin/,folder/
624 ```
625
626 ----
627 ### Proxies
628 dirsearch supports SOCKS and HTTP proxy, with two options: a proxy server or a list of proxy servers.
629
630 ```
631 python3 dirsearch.py -e php,html,js -u https://target --proxy 127.0.0.1:8080
632 ```
633
634 ```
635 python3 dirsearch.py -e php,html,js -u https://target --proxy socks5://10.10.0.1:8080
636 ```
637
638 ```
639 python3 dirsearch.py -e php,html,js -u https://target --proxylist proxyservers.txt
640 ```
641
642 ----
643 ### Reports
644 Supported report formats: **simple**, **plain**, **json**, **xml**, **md**, **csv**, **html**, **sqlite**, **mysql**, **postgresql**
645
646 ```
647 python3 dirsearch.py -e php -l URLs.txt --format plain -o report.txt
648 ```
649
650 ```
651 python3 dirsearch.py -e php -u https://target --format html -o target.json
652 ```
653
654 ----
655 ### More example commands
656 ```
657 cat urls.txt | python3 dirsearch.py --stdin
658 ```
659
660 ```
661 python3 dirsearch.py -u https://target --max-time 360
662 ```
663
664 ```
665 python3 dirsearch.py -u https://target --auth admin:pass --auth-type basic
666 ```
667
668 ```
669 python3 dirsearch.py -u https://target --header-list rate-limit-bypasses.txt
670 ```
671
672 **There are more to discover, try yourself!**
673
674 </details>
675
676
677 Session Management
678 ---------------
679
680 dirsearch supports saving and resuming scan sessions, allowing you to pause a long-running scan and continue it later.
681
682 ### Session Format
683
684 Sessions are stored in **JSON format** (directory-based structure) for human readability and easy inspection. Legacy `.pickle`/`.pkl` session files are no longer supported.
685
686 **Session directory structure:**
687 ```
688 session_name/
689 ├── meta.json # Version, timestamps, output history
690 ├── controller.json # Scan state (URLs, directories, progress)
691 ├── dictionary.json # Wordlist state and position
692 └── options.json # Command-line options used
693 ```
694
695 ### Saving a Session
696
697 When you pause a scan with **CTRL+C**, you'll be prompted to save the session:
698
699 ```
700 python3 dirsearch.py -u https://target -e php
701 # Press CTRL+C during scan
702 # Select "save" and provide a session name
703 ```
704
705 ### Resuming a Session
706
707 Resume a saved session with the **-s** / **--session** flag:
708
709 ```
710 python3 dirsearch.py -s sessions/my_session
711 ```
712
713 ### Listing Available Sessions
714
715 View all resumable sessions with **--list-sessions**:
716
717 ```
718 python3 dirsearch.py --list-sessions
719 ```
720
721 This displays:
722 - Session path
723 - Target URL
724 - Remaining targets and directories
725 - Jobs processed
726 - Error count
727 - Last modified time
728
729 ### Custom Sessions Directory
730
731 Specify a custom directory to search for sessions:
732
733 ```
734 python3 dirsearch.py --list-sessions --sessions-dir /path/to/sessions
735 ```
736
737 **Default session locations:**
738 - **Source install:** `<dirsearch>/sessions/`
739 - **Bundled binary:** `$HOME/.dirsearch/sessions/`
740
741 ### Output History
742
743 Sessions maintain a history of previous scan outputs, allowing you to review results from interrupted scans. Each resume appends to the output history with timestamps.
744
745
746 Support Docker
747 ---------------
748
749 <details>
750 <summary><strong>Docker Installation & Usage (click to expand)</strong></summary>
751
752 ### Install Docker Linux
753 Install Docker
754
755 ```sh
756 curl -fsSL https://get.docker.com | bash
757 ```
758
759 > To use docker you need superuser power
760
761 ### Build Image dirsearch
762 To create image
763
764 ```sh
765 docker build -t "dirsearch:v0.4.3" .
766 ```
767
768 > **dirsearch** is the name of the image and **v0.4.3** is the version
769
770 ### Using dirsearch
771 For using
772 ```sh
773 docker run -it --rm "dirsearch:v0.4.3" -u target -e php,html,js,zip
774 ```
775
776 </details>
777
778
779 Building from Source
780 ---------------
781
782 You can build standalone executables using PyInstaller. This creates a single binary file that includes all dependencies.
783
784 ### Requirements
785
786 - Python 3.9+
787 - PyInstaller 6.3.0+
788 - All dependencies from `requirements.txt`
789
790 ### Quick Build
791
792 ```sh
793 # Install dependencies
794 pip install -r requirements.txt
795 pip install pyinstaller==6.3.0
796
797 # Build using the spec file
798 pyinstaller pyinstaller/dirsearch.spec
799
800 # Binary will be in dist/dirsearch
801 ./dist/dirsearch --version
802 ```
803
804 ### Manual Build (Linux/macOS)
805
806 ```sh
807 pyinstaller \
808 --onefile \
809 --name dirsearch \
810 --paths=. \
811 --collect-submodules=lib \
812 --add-data "db:db" \
813 --add-data "config.ini:." \
814 --add-data "lib/report:lib/report" \
815 --hidden-import=requests \
816 --hidden-import=httpx \
817 --hidden-import=urllib3 \
818 --hidden-import=jinja2 \
819 --hidden-import=colorama \
820 --strip \
821 --clean \
822 dirsearch.py
823 ```
824
825 ### Manual Build (Windows)
826
827 ```powershell
828 pyinstaller `
829 --onefile `
830 --name dirsearch `
831 --paths=. `
832 --collect-submodules=lib `
833 --add-data "db;db" `
834 --add-data "config.ini;." `
835 --add-data "lib/report;lib/report" `
836 --hidden-import=requests `
837 --hidden-import=httpx `
838 --hidden-import=urllib3 `
839 --hidden-import=jinja2 `
840 --hidden-import=colorama `
841 --clean `
842 dirsearch.py
843 ```
844
845 **Note:** Windows uses `;` instead of `:` as the path separator in `--add-data`.
846
847 ### Build Output
848
849 After building:
850 - **Linux/macOS:** `dist/dirsearch`
851 - **Windows:** `dist/dirsearch.exe`
852
853 The binary includes:
854 - All Python dependencies
855 - `db/` directory (wordlists, blacklists)
856 - `config.ini` (default configuration)
857 - `lib/report/` (Jinja2 templates for reports)
858
859
860 CI/CD & GitHub Workflows
861 ---------------
862
863 dirsearch uses GitHub Actions for continuous integration and automated builds.
864
865 ### Available Workflows
866
867 | Workflow | Trigger | Description |
868 |----------|---------|-------------|
869 | **Inspection** (CI) | Push, PR | Runs tests, linting, and codespell on Python 3.9/3.11 across Ubuntu and Windows |
870 | **PyInstaller Linux** | Manual, Workflow call | Builds `dirsearch-linux-amd64` binary |
871 | **PyInstaller Windows** | Manual, Workflow call | Builds `dirsearch-windows-x64.exe` binary |
872 | **PyInstaller macOS Intel** | Manual, Workflow call | Builds `dirsearch-macos-intel` binary |
873 | **PyInstaller macOS Silicon** | Manual, Workflow call | Builds `dirsearch-macos-silicon` binary |
874 | **PyInstaller Draft Release** | Manual | Builds all platforms and creates a draft GitHub release |
875 | **Docker Image** | Push, PR | Builds and tests Docker image |
876 | **CodeQL Analysis** | Push, PR, Schedule | Security scanning with GitHub CodeQL |
877 | **Semgrep Analysis** | Push, PR | Static analysis with Semgrep |
878
879 ### Running Workflows Manually
880
881 PyInstaller builds can be triggered manually from the GitHub Actions tab:
882
883 1. Go to **Actions** > Select workflow (e.g., "PyInstaller Linux")
884 2. Click **Run workflow**
885 3. Download artifacts from the completed run
886
887 ### Creating a Release
888
889 To create a new release with all platform binaries:
890
891 1. Go to **Actions** > **PyInstaller Draft Release**
892 2. Click **Run workflow**
893 3. Enter the tag (e.g., `v0.4.4`)
894 4. Select target branch
895 5. Optionally mark as prerelease
896 6. Review and publish the draft release
897
898 ### Build Matrix
899
900 The CI workflow tests on:
901 - **Python versions:** 3.9, 3.11
902 - **Operating systems:** Ubuntu (latest), Windows (latest)
903
904
905 References
906 ---------------
907
908 <details>
909 <summary><strong>Articles & Tutorials (click to expand)</strong></summary>
910
911 - [Comprehensive Guide on Dirsearch](https://www.hackingarticles.in/comprehensive-guide-on-dirsearch/) by Shubham Sharma
912 - [Comprehensive Guide on Dirsearch Part 2](https://www.hackingarticles.in/comprehensive-guide-on-dirsearch-part-2/) by Shubham Sharma
913 - [How to Find Hidden Web Directories with Dirsearch](https://www.geeksforgeeks.org/how-to-find-hidden-web-directories-with-dirsearch/) by GeeksforGeeks
914 - [GUÍA COMPLETA SOBRE EL USO DE DIRSEARCH](https://esgeeks.com/guia-completa-uso-dirsearch/?feed_id=5703&_unique_id=6076249cc271f) by ESGEEKS
915 - [How to use Dirsearch to detect web directories](https://www.ehacking.net/2020/01/how-to-find-hidden-web-directories-using-dirsearch.html) by EHacking
916 - [dirsearch how to](https://vk9-sec.com/dirsearch-how-to/) by VK9 Security
917 - [Find Hidden Web Directories with Dirsearch](https://null-byte.wonderhowto.com/how-to/find-hidden-web-directories-with-dirsearch-0201615/) by Wonder How To
918 - [Brute force directories and files in webservers using dirsearch](https://upadhyayraj.medium.com/brute-force-directories-and-files-in-webservers-using-dirsearch-613e4a7fa8d5) by Raj Upadhyay
919 - [Live Bug Bounty Recon Session on Yahoo (Amass, crts.sh, dirsearch) w/ @TheDawgyg](https://www.youtube.com/watch?v=u4dUnJ1U0T4) by Nahamsec
920 - [Dirsearch to find Hidden Web Directories](https://medium.com/@irfaanshakeel/dirsearch-to-find-hidden-web-directories-d0357fbe47b0) by Irfan Shakeel
921 - [Getting access to 25000 employees details](https://medium.com/@ehsahil/getting-access-to-25k-employees-details-c085d18b73f0) by Sahil Ahamad
922 - [Best Tools For Directory Bruteforcing](https://secnhack.in/multiple-ways-to-find-hidden-directory-on-web-server/) by Shubham Goyal
923 - [Discover hidden files & directories on a webserver - dirsearch full tutorial](https://www.youtube.com/watch?v=jVxs5at0gxg) by CYBER BYTES
924
925 </details>
926
927
928 Tips
929 ---------------
930 - The server has requests limit? That's bad, but feel free to bypass it, by randomizing proxy with `--proxy-list`
931 - Want to find out config files or backups? Try `--suffixes ~` and `--prefixes .`
932 - Want to find only folders/directories? Why not combine `--remove-extensions` and `--suffixes /`!
933 - The mix of `--cidr`, `-F`, `-q` and will reduce most of noises + false negatives when brute-forcing with a CIDR
934 - Scan a list of URLs, but don't want to see a 429 flood? `--skip-on-status 429` will help you to skip a target whenever it returns 429
935 - The server contains large files that slow down the scan? You *might* want to use `HEAD` HTTP method instead of `GET`
936 - Brute-forcing CIDR is slow? Probably you forgot to reduce request timeout and request retries. Suggest: `--timeout 3 --retries 1`
937
938
939 Contribution
940 ---------------
941 We have been receiving a lot of helps from many people around the world to improve this tool. Thanks so much to everyone who have helped us so far!
942 See [CONTRIBUTORS.md](https://github.com/maurosoria/dirsearch/blob/master/CONTRIBUTORS.md) to know who they are.
943
944 #### Pull requests and feature requests are welcomed
945
946
947 License
948 ---------------
949 Copyright (C) Mauro Soria ([email protected])
950
951 License: GNU General Public License, version 2