The Microsoft Server Message Block protocol was often used with NetBIOS over TCP/IP (NBT) over UDP, using port numbers 137 and 138, and TCP port numbers 137 and 139.

Find version

Find SMB version using metasploit:

Msfconsole;use scanner/smb/smb_version

Using nmap scripts:

nmap --script=smb-enum* --script-args=unsafe=1 -T5

Discover shares

smbmap:

smbmap -H [ip]

or

****smbmap -H [ip] -d [domain] -u [user] -p [password]

smbclient:

smbclient //IP/Share

Or

smbclient -L //$TARGET

Nmap:

nmap --script smb-enum-shares -p139,445 -T4 -Pn

Connect to share

smbmap: