Skip to content

πŸ“‚ SMB - 445 ​

πŸ” Enumeration ​

bash
# Anonymous Listing
smbclient -L //TARGET_IP/ -U "" -N
smbclient //TARGET_IP/ -N

# Enum
enum4linux-ng -A TARGET_IP # Complete enumeration (Linux)
smbclient -L //TARGET_IP/ -U user   # With a user
crackmapexec smb TARGET_IP --shares # List shares (Pentest)

πŸ”‘ Connecting to SMB shares ​

bash
# Interactive connection
smbclient //TARGET_IP/SHARE -U user

# Execute an command without opening a shell
smbclient //TARGET_IP/SHARE -U user -c "ls"

# Mount SMB shares
sudo mount -t cifs //TARGET_IP/SHARE /mnt/smb -o user=user,password=pass

πŸ—‚οΈ Files and Directories ​

bash
# List files of a share
smbclient //TARGET_IP/SHARE -U user -c "ls"

# Download file
smbclient //TARGET_IP/SHARE -U user -c "get file.txt"

# Download all files into folder
smbclient //TARGET_IP/SHARE -U user -c "mget *"

# Upload file
smbclient //TARGET_IP/SHARE -U user -c "put localfile.txt"

# Read file
smbclient //TARGET_IP/SHARE -U user -c "more file.txt"