From Cliquesoft
Jump to: navigation, search

As our project writeup specifies, this is a nice little utility script for viewing available shares offered by a Windows (or SMB/CIFS in Unix) file server as well as providing the ability to see the (matching) contents of a specified directory within a share. Not unlike our other bash-script-based software, this project relies on our clAPI framework for various functionality, so be sure this dependency is satisfied before using. It's also worth mentioning that the placement of the OPTION's must follow their respective ACTION (or parent script) which can be determined via the --help output. It might also help to read over the basics of clAPI to get a better understanding when running software from the command line.


This projects' codebase is licensed under the CPLv2 unless a valid CPLv1 license has been purchased. More information about both of these licenses can be found under the "Our Licenses" link of our homepage.


Among our standard 'help', 'version', and 'update' ACTIONs, this project also contains two others - 'install' and 'show'. The 'install' ACTION simply installs the script in the "~/.bin" directory for XiniX and "/usr/bin" for typical GNU/Linux distros. To see how easy it is to install, see the examples section.

The other ACTION, 'show', will perform most of the desired work. It's important to note that the returned information will be different based on the value provided for the --target OPTION. For simplicity and ease-of-use, if --target contains just a server name, ip address, or FQDN (e.g. --target=servername.mydomain.local, --target="", etc), the results will show all of the shares currently being offered by that server. However, if the --target value includes a share name and optional path (e.g. --target='\\servername\share', --target='\\\share\dir\path'), lssmb will display the entire contents of that directory (which can further be refined by using the --match option). Notice that when providing a share and optional path in the examples, each value was enclosed by single quotes and the server was preceeded by double back-slashes as this is the common syntax for network interaction within a Microsoft Windows OS environment. If the network share value isn't enclosed by double back-slashes, an error will occur.


In order to help the local device communicate its' access credentials to the --target server, the script provides three additional OPTION's to specify these values which are --targetUser, --targetPass, and --targetDom. Each is case-sensative and provides the username, password, and optional domain/workgroup name respectively in order to perform authentication to the server.

The final two OPTION's deal with controlling what the output contains. The --details OPTION provides more information on the results and does NOT take any values. On the other hand, the --match OPTION allows you to specify a word or phrase as its value that will be used to return any matching file or directory names contained within the --target.


Installation is a simple 2-step process...

$ cd /path/to/uncompressed/package
$ ./lssmb install

Query a server for its (detailed) list of available network shares...

$ lssmb --noprompts show --target="" --targetUser='myUsername' --targetPass='myPassword' --details

Querying the '' server...

  (i)   Showing query results  -------------------------------------[PROGRESS]--

Disk    Public          Public Share
Disk    Private         Private Data Share
Disk    demo
IPC     IPC$            IPC Service (Data NAS for home)


  (i)   Cleaning up environment: [checking] [absent] [done]

Query a server and display a basic contents list of the specified network share...

$ sudo lssmb --noprompts show --target='\\\private' --targetUser='myUsername' --targetPass='myPassword'

Querying the '' server...

  (i)   Establishing a connection: [checking] [creating] [success] [mounting] [success] [done]
  (i)   Showing query results  -------------------------------------[PROGRESS]--



  (i)   Cleaning up environment: [checking] [mounted] [unmounting] [success] [deleting] [success] [done]
  • notice the use of 'sudo' above - you may have to use it if your account doesn't have sufficient priviledges

Query a server and display detailed network share contents that match provided criteria...

$ sudo lssmb --noprompts show --target='\\\private' --targetUser='myUsername' --targetPass='myPassword' --match='mark' --details

Querying the '' server...

  (i)   Establishing a connection: [checking] [creating] [success] [mounting] [success] [done]
  (i)   Showing query results  -------------------------------------[PROGRESS]--

-rwxr-xr-x 0 root root 7138 2012-01-05 21:46 bookmarks-2012-01-05.json
-rwxr-xr-x 0 root root  397 2012-01-21 17:31 bookmarks-2012-01-21.txt
-rwxr-xr-x 0 root root 7399 2012-03-22 18:54 bookmarks-2012-03-22.json


  (i)   Cleaning up environment: [checking] [mounted] [unmounting] [success] [deleting] [success] [done]


Dave Henderson [dhenderson (at) cliquesoft (dot) org]