Skip to main content

list SMB shares

Project description

smbls

This is a simple Impacket-based tool to check a set of credentials against many Windows hosts and get permission for SMB shares.

For the input, you give it a list of IPs/hostnames and a set of credentials, which are the domain, username, and either password or LM/NTLM hashes. The output is a JSON array of host information, including errors, SMB metadata, and information about each share, including whether the account has read access.

There are already many ways to do this. This tool was written to perform in large, heterogeneous networks where existing tools ended up being slow or unreliable in practice. It performs well in this environment because:

  • It's reliable due to comprehensive error checking and simple code
  • It's very fast due to parallelization
  • The output is JSON

The main limitation is that it does not check whether a share is writeable or not, because the known way to do that requires attempting to write to it.

Install

pip install smbls

Alternatively, you can just drop smbls/__init__.py as smbls.py on a box with python3.9+ and Impacket installed and run that.

Usage

Create targets file:
$ printf '10.0.0.1\n10.0.0.2\n...' > targets.txt
Or for CIDR notation, consider
$ nmap -sL -n 10.0.0.0/24 | awk '/scan report for/{print $5}' > targets.txt

For a single-user scan:
$ smbls -c exampledomain/exampleuser:examplepassword targets.txt -o out.json

Or for a multi-user scan:
1. create creds file:
$ echo 'exampledomain/exampleuser:examplepassword' > creds.txt
$ echo 'localhost/exampleuser#aad3b435b51404eeaad3b435b51404ee:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' >> creds.txt
2. run scan:
$ smbls -C creds.txt targets.txt -O example_dir

Output parsing

Here are some shell-based examples.

Get list of targets with admin access:

jq -r '.[]|select(.admin)|.info.getServerDNSHostName' out.json

Get list of share names:

jq -r '.[].shares[]?|.name' out.json | sort -iu

Find hosts with given share name:

# Search for D drives
jq -r 'path(..|select(.name?==$name))[0]' out.json --arg name D

List hosts with corresponding readable shares:

jq -r '.[] | select(.shares) | {ip: (.info.getRemoteHost), host: (.info.getServerDNSHostName), readshares: [.shares[] | select(.access != "") | {name: .name, type: .type, remark: .remark}]} | select(.readshares != [])' out.json

List hosts that failed auth:

jq -r 'path(.[]|select(.errtype == "auth"))[0]' out.json

List hosts that had a connection error (to remove them from future scans):

jq -r 'path(.[]|select(.errtype == "conn"))[0]' out.json

Get results for hosts that succeeded auth:

jq -r '.[]|select(.errtype == "")' out.json

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smbls-1.0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

smbls-1.0.1-py39.py310-none-any.whl (6.5 kB view details)

Uploaded Python 3.10 Python 3.9

File details

Details for the file smbls-1.0.1.tar.gz.

File metadata

  • Download URL: smbls-1.0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for smbls-1.0.1.tar.gz
Algorithm Hash digest
SHA256 09b449a40f161227467ee9de732774381a6be132facf1d02f6c27d0a35363601
MD5 84d20af505c289b4292ca784cfc0f406
BLAKE2b-256 e76f4322f0ab6441a66492cffd47162f971eb4ef973d49d8459663938bb9de92

See more details on using hashes here.

File details

Details for the file smbls-1.0.1-py39.py310-none-any.whl.

File metadata

  • Download URL: smbls-1.0.1-py39.py310-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3.10, Python 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for smbls-1.0.1-py39.py310-none-any.whl
Algorithm Hash digest
SHA256 b7f627d914a041de19cee3ad5fa10e1b103f911d416c764245d0d9439665afcc
MD5 0b26150067cafd89fd52cee5a2332287
BLAKE2b-256 b71085e33f40e4694c691b47c9df1755c83c33a48589b98bd9ee8bae3c801005

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page