# SMB (445)

**Anonymous Login**

```
smbclient -L \\\\$IP -N
```

**Bulk enumeration**

```
crackmapexec smb 172.16.20.3-254 -u '' -p '' --shares
```

If you able to login to the machine, to retrieve all share folder in the specific hostname:

```
net view <hostname> /all
```

**Enumerate / list the shares**

```
smbclient -L //$IP/

smbmap -H $IP

crackmapexec smb $IP -u '' -p '' --shares -M spider_plus
```

**Accessing the shares**

```
smbclient //$IP/shares
# input blank password for anonymous login

smbclient //$IP/shares -U <username>%<password>

smbmap -u <username> -p <password -H $IP
```

there are some dir shares?&#x20;

<pre class="language-bash"><code class="lang-bash">crackmapexec smb &#x3C;ip> -u &#x3C;username> -p &#x3C;password> --shares

<strong>crackmapexec smb &#x3C;ip> -u &#x3C;username> -p &#x3C;password> --shares -M spider_plus
</strong><strong># check spider_plus output in the [Tools]> [json]
</strong><strong>
</strong><strong>smbmap -u &#x3C;username> -p &#x3C;password> -H $IP -r --exclude SYSVOL
</strong>smbmap -u &#x3C;username> -p &#x3C;password> -H $IP -R
</code></pre>

```bash
smbmap -R <share> -H $IP

# wanna download a file?
smbmap -R <share> -H $IP -A <just filename> -q
locate <just filename>

smbclient -U <username> //$IP/shares
smbmap -u <username> -p <password> -H $IP --download <shares>/<folder>/<file>

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hacker-mind.gitbook.io/hacker-mind/penetration-testing-notes/smb-445.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
