> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/internal-and-external-network-sec/enumeration/web-enumeration/tools/fuzzing/dirsearch.md).

# dirsearch

`dirsearch` is a simple command-line tool designed to brute-force directories and files on web servers. Discover hidden files, directories, and endpoints that are not publicly listed.

It supports multithreading, recursive scanning, custom wordlists, and user-agent randomization. It's especially useful for reconnaissance and information gathering during web application testing.

***

#### Syntax

```bash
python3 dirsearch.py -u <URL> [options]
```

***

#### Examples:-

* **Scan a target with the default wordlist**

```bash
python3 dirsearch.py -u http://example.com
```

* **Use a custom wordlist**

```bash
python3 dirsearch.py -u http://example.com -w /path/to/wordlist.txt
```

* **Scan using specific extensions**

```bash
python3 dirsearch.py -u http://example.com -e php,html,js
```

* **Enable recursive scanning**

```bash
python3 dirsearch.py -u http://example.com -r
```

* **Set the number of threads to 50**

```bash
python3 dirsearch.py -u http://example.com -t 50
```

* **Scan with a custom user-agent**

```bash
python3 dirsearch.py -u http://example.com --user-agent "Mozilla/5.0 CustomAgent"
```

* **Output results to a file**

```bash
python3 dirsearch.py -u http://example.com -o output.txt
```

* **Scan multiple targets from a list**

```bash
python3 dirsearch.py -L urls.txt
```

* **Change HTTP method to POST**

```bash
python3 dirsearch.py -u http://example.com --http-method POST
```
