Nmap afp-ls NSE Script
This page contains detailed information about how to use the afp-ls NSE script. For list of all NSE scripts, visit the Nmap NSE Library.
Select: |
---|
Script Overview
Script source code: https://github.com/nmap/nmap/tree/master/scripts/afp-ls.nse
Script categories: discovery, safe
Target service / protocol: afp
Target network port(s): 548
List of CVEs: -
Script Description
The afp-ls.nse script attempts to get useful information about files from AFP volumes.
The output is intended to resemble the output of ls
.
Afp-ls NSE Script Arguments
This is a full list of arguments supported by the afp-ls.nse script:
afp.passwordThe password to use for authentication.
afp.usernameThe username to use for authentication.
ls.checksum(boolean) Download each file and calculate a SHA1 checksum. Although this is a module argument, the implementation is done in each script and is currently only supported by smb-ls and http-ls
ls.empty(boolean) Report empty volumes (with no information or error)
ls.errors(boolean) Report errors
ls.human(boolean) Show file sizes in human-readable format with K, M, G, T, P suffixes. Some services return human-readable sizes natively; in these cases, the size is reported as given.
ls.maxdepthThe maximum depth to recurse into a directory. If less than 0 (e.g. -1) then recursion is unlimited. (default: 0, no recursion).
ls.maxfilesThe maximum number of files to return. Set to 0 or less to disable this limit. (default: 10).
- - -
To use these script arguments, add them to the Nmap command line using the --script-args arg1=value,[arg2=value,..]
syntax. For example:
nmap --script=afp-ls --script-args afp.password=value,afp.username=value <target>
Afp-ls NSE Script Example Usage
Here's an example of how to use the afp-ls.nse script:
nmap -sS -sV -p 548 --script=afp-ls target
Afp-ls NSE Script Example Output
Here's a sample output from the afp-ls.nse script:
PORT STATE SERVICE
548/tcp open afp syn-ack
| afp-ls:
| Information retrieved as patrik
| Volume Macintosh HD
| maxfiles limit reached (10)
| PERMISSION UID GID SIZE TIME FILENAME
| -rw-r--r-- 501 80 15364 2010-06-13 17:52 .DS_Store
| ---------- 0 80 0 2009-10-05 07:42 .file
| drwx------ 501 20 0 2009-11-04 17:28 .fseventsd
| -rw------- 0 0 393216 2010-06-14 01:49 .hotfiles.btree
| drwx------ 0 80 0 2009-11-04 18:19 .Spotlight-V100
| d-wx-wx-wx 0 80 0 2009-11-04 18:25 .Trashes
| drwxr-xr-x 0 0 0 2009-05-18 21:29 .vol
| drwxrwxr-x 0 80 0 2009-04-28 00:06 Applications
| drwxr-xr-x 0 0 0 2009-05-18 21:43 bin
| drwxr-xr-x 501 80 0 2010-08-10 22:55 bundles
|
| Volume Patrik Karlsson's Public Folder
| PERMISSION UID GID SIZE TIME FILENAME
| -rw------- 501 20 6148 2010-12-27 23:45 .DS_Store
| -rw-r--r-- 501 20 0 2007-07-24 21:17 .localized
| drwx-wx-wx 501 20 0 2009-06-19 04:01 Drop Box
|
| Volume patrik
| maxfiles limit reached (10)
| PERMISSION UID GID SIZE TIME FILENAME
| -rw------- 501 20 11281 2010-06-14 22:51 .bash_history
| -rw-r--r-- 501 20 33 2011-01-19 20:11 .bashrc
| -rw------- 501 20 3 2007-07-24 21:17 .CFUserTextEncoding
| drwx------ 501 20 0 2010-09-12 14:52 .config
| drwx------ 501 20 0 2010-09-12 12:29 .cups
| -rw-r--r-- 501 20 15364 2010-06-13 18:34 .DS_Store
| drwxr-xr-x 501 20 0 2010-09-12 14:13 .fontconfig
| -rw------- 501 20 102 2010-06-14 01:46 .lesshst
| -rw-r--r-- 501 20 241 2010-06-14 01:45 .profile
| -rw------- 501 20 218 2010-09-12 16:35 .recently-used.xbel
|_
Afp-ls NSE Script Example XML Output
Here's a sample XML output from the afp-ls.nse script produced by providing the -oX <file>
Nmap option:
<table key="volumes">
<table>
<elem key="volume">Storage01</elem>
<table key="files">
<table>
<elem key="permission">drwx------</elem>
<elem key="uid">0</elem>
<elem key="gid">100</elem>
<elem key="size">0</elem>
<elem key="time">2015-06-26 17:17</elem>
<elem key="filename">Backups</elem>
</table>
<table>
<elem key="permission">drwxr-xr-x</elem>
<elem key="uid">0</elem>
<elem key="gid">37</elem>
<elem key="size">0</elem>
<elem key="time">2015-06-19 06:36</elem>
<elem key="filename">Network Trash Folder</elem>
</table>
<table>
<elem key="permission">drwxr-xr-x</elem>
<elem key="uid">0</elem>
<elem key="gid">37</elem>
<elem key="size">0</elem>
<elem key="time">2015-06-19 06:36</elem>
<elem key="filename">Temporary Items</elem>
</table>
</table>
</table>
</table>
<table key="info">
<elem>information retrieved as nil</elem>
</table>
<table key="total">
<elem key="files">3</elem>
<elem key="bytes">0</elem>
</table>
Author
- Patrik Karlsson
References
- https://nmap.org/nsedoc/scripts/afp-ls.html
- https://github.com/nmap/nmap/tree/master/scripts/afp-ls.nse
See Also
Related NSE scripts to the afp-ls.nse script:
Visit Nmap NSE Library for more scripts.
The afp-ls.nse script may fail with the following error messages. Check for the possible causes by using the code snippets highlighted below found in the script source code. This can often times help in identifying the root cause of the problem.
Login failed
Here is a relevant code snippet related to the "Login failed" error message:
136: else
137: status, response = afpHelper:Login()
138: end
139:
140: if ( not status ) then
141: stdnse.debug1("Login failed")
142: stdnse.debug3("Login error: %s", response)
143: return
144: end
145:
146: local vols
Login error: %s
Here is a relevant code snippet related to the "Login error: %s" error message:
137: status, response = afpHelper:Login()
138: end
139:
140: if ( not status ) then
141: stdnse.debug1("Login failed")
142: stdnse.debug3("Login error: %s", response)
143: return
144: end
145:
146: local vols
147: status, vols = afpHelper:ListShares()
ERROR: Failed to list the contents of %s
Here is a relevant code snippet related to the "ERROR: Failed to list the contents of %s" error message:
148:
149: if status then
150: for _, vol in ipairs( vols ) do
151: local status, tbl = afpHelper:Dir( vol )
152: if ( not(status) ) then
153: ls.report_error(output, ("ERROR: Failed to list the contents of %s"):format(vol))
154: else
155: ls.new_vol(output, vol, true)
156: for _, item in ipairs(tbl[1]) do
157: if item and item.name then
158: if not (item.privs and item.create) then
ERROR: Failed to retrieve file details for %/%s
Here is a relevant code snippet related to the "ERROR: Failed to retrieve file details for %/%s" error message:
154: else
155: ls.new_vol(output, vol, true)
156: for _, item in ipairs(tbl[1]) do
157: if item and item.name then
158: if not (item.privs and item.create) then
159: ls.report_error(output, ("ERROR: Failed to retrieve file details for %/%s"):format(vol, item.name))
160: else
161: local continue = ls.add_file(output, {
162: item.privs, item.uid, item.gid,
163: item.fsize, item.create, item.name
164: })
Version
This page has been created based on Nmap version 7.92.
Go back to menu.