Simple SMB Scanner with a single line of shell

Need a simple smb scanner to search windows shares on a network?

Here a very simple script, made with nmap, smbclient and some shell commands.


Obviously, the scanner uses the same syntax used by nmap:

./smbscanner 192.168.0.*


Just nmap and smbclient, on Ubuntu/Debian:

sudo apt install nmap smbclient

Some highlights

I have used the -oG option in nmap:

-oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,
and Grepable format, respectively, to the given filename.

after, with grep, cut and uniq i have obtained a list of unique ip with the 445 port opened.

Finally, with xargs i’ve passed the ip list to smbclient with -L option:

-L| — list
This option allows you to look at what services are available on a server.

Related posts

  1. Quick mount of iOS Apps documents on Linux, using iFuse and bash
  2. i3: how to make a pretty lock screen with a small bash script
  3. Full Disk Encryption: tools and setup suggestion for personal data protection
  4. The “distroless” approach to Docker containers
  5. Flan Scan: a lightweight network vulnerability scanner by Cloudflare