3 tools that work together to simplify reconaissance of Windows File Shares
One of the most time consuming tasks as a red teamer is diving into filesystems and shares, attempting to identify any potentially sensitive information. SMBCrunch allows a red teamer to quickly identify Windows File Shares in a network, performs a recursive directory listing of the provided shares, and can even grab a file from the remote share if it looks like a juicy target.
There are three (3) different tools that work together. Read all three sections below to get an idea of how they work together.
Given a file (or gnmap file), SMBHunt finds all the Windows File Shares associated with the servers provided (if gnmap file is provided, it looks at servers with port 445 open). If no credentials are supplied to perform the check, it will check for null session shares.
Warning: If your user has access to one share on the server, the script will show all shares hosted by that server. If a share is listed in this output, it does not mean you have access to that share. Use the next tool for that.
This script does warn you if the credentials you supply fail to avoid locking out domain accounts. "-f" switch overrides this protection.
This script only checks a server using one credential. This is by design since the server will respond with a full list of shares if the user has access to only one share on the system
./SMBHunt.pl [-a ] -i [-o ]
./SMBHunt.pl -a 'testdomain\john:hunter2' -i portscan445.gnmap -o shares_found.txt
User credentials to test. Usernames are accepted in the form of 'Domain\Username:Password' ('Domain\' is optional) If no account is given, script checks for null session shares
A file of systems separated by a new line, or a gnmap file of a portscan containing port 445. Each server with port 445 open will be checked for SMB shares
Print results to a file
Forces the script to continue even if the domain credential may be incorrect.
Do not show IPC shares (IPC$)
Do not show hidden shares (C$, IPC$, ADMIN$, etc)
SMBList will take the output file from "SMBHunt.pl" (or a file of shares separated by a newline in the format of "\server\share") and will perform a recursive directory listing of those shares using the credentials provided. SMBList will attempt to authenticate to the share until a valid credential is found from the list provided. It will then store the directory listings in a subfolder specified.
This makes the file listing extremely easy to grep through!
** The best result file to use is: /ALLCOMBINEDRESULTS.txt **
./SMBList.pl -c -s -o
./SMBList.pl -c credentials_found.txt -s shares_found.txt -o share_listing -m 150
A single credential or file of credentails to test. Credentials are accepted in the form of 'Domain\Username:Password' separated by a new line (if providing a file)
A single share or file of shares to test against. Each credential will be tested for authorization until a valid one is found. Shares should be in the form "\server\share", separated by a new line (if providing a file)
A new directory will be created named this. For protection of output, the script cannot be run with this directory existing. It must be a directory that does not exist!
The maximum amonut of time spent dumping any one share, in seconds. Default is 300 seconds (5 minutes)
Never remove a share from the list if it errors and never remove a credential if it gets a logon failed message. If you are using this flag, make sure you know what you are doing! You might lock out accounts if you aren't careful!
Don't include credentials in the output. WARNING: If you use this switch, you cannot use the output with the next tool, "SMBGrab.pl".
File listings from SMBList.pl can be pipped into this utility to grab the files wanted from the shares. The original listing from SMBList.pl should be "grepped" before passing to this script, otherwise all files will be downloaded (which is the equivalent of copying the entire share and is bad)
This script requires SMBList.pl be pipped in to it. Look at "Example Usage" below
./SMBGrab.pl [-s ]
grep -i 'password.txt' share_listing/ALL_COMBINED_RESULTS.TXT | ./SMBGrab.pl -s savedfiles
If no arguments are supplied, the file is retrieved from the share and displayed to the user. It is not saved.
A directory to save all the grabbed files to. If this directory does not exist, it will be created. Using this argument saves the files but prevents the files from being printed to the screen
Read all files pipped in. Without this switch, the script protects against accidentally downloading massive amounts of files by limiting the input to 100 files.
This will preserve the files to their original form. If this switch is not used, a note will be made at the bottom of each file containing information about the file metadata (read/write times, file location in the Share, etc)
Display a help menu
Feel free to contact me with any changes or feature request! * https://twitter.com/raikiasec * [email protected]