Script smb-ls

Script types: hostrule
Categories: discovery, safe

Script Summary

Attempts to retrieve useful information about files shared on SMB volumes. The output is intended to resemble the output of the UNIX ls command.

Script Arguments


the path, relative to the share to list the contents from (default: root of the share)


the search pattern to execute (default: *)


(or smb-ls.shares) the share (or a colon-separated list of shares) to connect to (default: use shares found by smb-enum-shares)


download each file and calculate a checksum (default: false)

ls.checksum, ls.empty, ls.errors, ls.human, ls.maxdepth, ls.maxfiles

See the documentation for the ls library.

randomseed, smbbasic, smbport, smbsign

See the documentation for the smb library.

smbdomain, smbhash, smbnoguest, smbpassword, smbtype, smbusername

See the documentation for the smbauth library.

Example Usage

nmap -p 445 <ip> --script smb-ls --script-args 'share=c$,path=\temp'
nmap -p 445 <ip> --script smb-enum-shares,smb-ls

Script Output

Host script results:
| smb-ls:
|   Volume \\\c$\
|   SIZE   TIME                 FILENAME
|   0      2007-12-02 00:20:09  AUTOEXEC.BAT
|   0      2007-12-02 00:20:09  CONFIG.SYS
|   <DIR>  2007-12-02 00:53:39  Documents and Settings
|   <DIR>  2009-09-08 13:26:10  e5a6b742d36facb19c5192852c43
|   <DIR>  2008-12-01 02:06:29  Inetpub
|   94720  2007-02-18 00:31:38  msizap.exe
|   <DIR>  2007-12-02 00:55:01  Program Files
|   <DIR>  2008-12-01 02:05:52  temp
|   <DIR>  2011-12-16 14:40:18  usr
|   <DIR>  2007-12-02 00:42:40  WINDOWS
|   <DIR>  2007-12-02 00:22:38  wmpub



  • Patrik Karlsson

License: Same as Nmap--See