SMB | 445, 139
Modern SMB (like SMBv2/v3) typically uses only TCP 445, while older versions (SMBv1) may use 139 and NetBIOS-related ports.
00. Basic
sudo tcpdump -s0 -n -i tun0 src $IP and port 139 -A -c 10 2>/dev/null | grep -i "samba\|s.a.m" | tr -d '.'
sudo ngrep -i -d tun0 's.?a.?m.?b.?a.*[[:digit:]]' port 139
smbclient -L //$IP
nmap -p 445,139 --script smb-protocols,smb-system-info,smb-os-discovery $IP
enum4linux -a $IP | tee enum4linux_output.txt01. SMBclient
## ------------------| Enum
smbclient //$IP
## ------------------| List all shares (Null session)
smbclient -N -L //$IP
## ------------------| List all shares with credentials
smbclient -L //$IP -U '<username>%<password>'
## ------------------| Login to the user
smbclient -U '<UserName>%<Password>' \\\\$IP\\c$
## ------------------| Connect to a specific share (interactive)
smbclient //$IP/<SHARENAME> -U '<username>%<password>'
## ------------------| Connect to a specific share with NT1 protocol (for older SMB versions)
smbclient -N //$IP/<SHARENAME> --option='client min protocol=NT1'
## ------------------| Download all files
smbclient -N //$IP/<SHARENAME> -U <USERNAME> -c "prompt OFF;recurse ON;mget *"
## ------------------| Upload file
put desktop.ini
## ------------------| List info about
## if it has ACL:Everyone:ALLOWED/OI|CI/FULL we can write/read
smbcacls -N //$IP/Department /Users
## ------------------| Connect to a specific share with other protocols
smbclient -L //$IP -U <username> -m SMB2
smbclient -L //$IP -U <username> -m SMB3
smbclient -L //$IP -U <username> -m NT102. NetExec (CrackMapExec)
03. SMBMap
04. RPCClient
Last updated
