> ## Documentation Index
> Fetch the complete documentation index at: https://www.0101isnothacking.nl/llms.txt
> Use this file to discover all available pages before exploring further.

# SMB enumeration

> Active enumeration commands, dangerous settings, and useful tools for the Server Message Block protocol.

SMB (Server Message Block) runs on ports 139 and 445.

## Check version

```bash theme={null}
sudo nmap -sV -p139,445 target_ip
```

## Banner grabbing

```bash theme={null}
netcat -nv ip 139/445
```

## List shares

```bash theme={null}
netexec smb ip -u 'anonymous' -p 'anonymous' --shares
smbclient -N -L ip
```

## Connect to a share

```bash theme={null}
smbclient //IP/share -U username
smbclient -N //ip/share
rpcclient -U "" ip
```

## Download files

```bash theme={null}
mget file
```

## Automated tools

```bash theme={null}
enum4linux ip -A
```

## Steps

![SMB enumeration steps](https://mintcdn.com/non-9fcb5a21/P-t86H21MW2fT7Il/images/0da149635891.png?fit=max\&auto=format\&n=P-t86H21MW2fT7Il\&q=85\&s=a9b70d4569a063b51f7aa021c744f43b)

## Dangerous settings

| Setting | Description |
| - | - |
| `browseable = yes` | Allow listing available shares in the current share? |
| `read only = no` | Forbid the creation and modification of files? |
| `writable = yes` | Allow users to create and modify files? |
| `guest ok = yes` | Allow connecting to the service without using a password? |
| `enable privileges = yes` | Honor privileges assigned to specific SID? |
| `create mask = 0777` | What permissions must be assigned to the newly created files? |
| `directory mask = 0777` | What permissions must be assigned to the newly created directories? |

## Useful commands and tools

Lookup domain names:

```bash theme={null}
impacket-samrdump ip
```

Useful commands when using `rpcclient`:

```bash theme={null}
rpcclient -U "" ip
help
srvinfo
querydomaininfo
netshareenumall
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.