Nmap broadcast-listener NSE Script


This page contains detailed information about how to use the broadcast-listener NSE script. For list of all NSE scripts, visit the Nmap NSE Library.

Select:
Overview
Error Messages

Script Overview


Script source code: https://github.com/nmap/nmap/tree/master/scripts/broadcast-listener.nse
Script categories: broadcast, safe
Target service / protocol: -
Target network port(s): -
List of CVEs: -

Script Description


The broadcast-listener.nse script sniffs the network for incoming broadcast communication and attempts to decode the received packets. It supports protocols like CDP, HSRP, Spotify, DropBox, DHCP, ARP and a few more. See packetdecoders.lua for more information.

The script attempts to sniff all ethernet based interfaces with an IPv4 address unless a specific interface was given using the -e argument to Nmap.

Broadcast-listener NSE Script Arguments


This is a full list of arguments supported by the broadcast-listener.nse script:

broadcast-listener.timeout

Specifies the amount of seconds to sniff the network interface. (default 30s)

- - -
To use this script argument, add it to Nmap command line like in this example:

nmap --script=broadcast-listener --script-args broadcast-listener.timeout=value <target>

Broadcast-listener NSE Script Example Usage


Here's an example of how to use the broadcast-listener.nse script:

nmap --script broadcast-listener

nmap --script broadcast-listener -e eth0

Broadcast-listener NSE Script Example Output


Here's a sample output from the broadcast-listener.nse script:

| broadcast-listener:
|   udp
|       Netbios
|         ip           query
|         192.168.0.60 \x01\x02__MSBROWSE__\x02\x01
|       DHCP
|         srv ip       cli ip       mask             gw           dns
|         192.168.0.1  192.168.0.5  255.255.255.0    192.168.0.1  192.168.0.18, 192.168.0.19
|       DropBox
|         displayname  ip            port   version  host_int  namespaces
|         39000860     192.168.0.107 17500  1.8      39000860  28814673, 29981099
|       HSRP
|         ip             version  op     state   prio  group  secret  virtual ip
|         192.168.0.254  0        Hello  Active  110   1      cisco   192.168.0.253
|   ether
|       CDP
|         ip  id      platform       version
|         ?   Router  cisco 7206VXR  12.3(23)
|       ARP Request
|         sender ip     sender mac         target ip
|         192.168.0.101 00:04:30:26:DA:C8  192.168.0.60
|_        192.168.0.1   90:24:1D:C8:B9:AE  192.168.0.60

Broadcast-listener NSE Script Example XML Output


There is no sample XML output for this module. However, by providing the -oX <file> option, Nmap will produce a XML output and save it in the file.xml file.

Author


  • Patrik Karlsson

References


See Also


Related NSE scripts to the broadcast-listener.nse script:

Visit Nmap NSE Library for more scripts.

The broadcast-listener.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.

Failed to load decoder definition (%s)


Here is a relevant code snippet related to the "Failed to load decoder definition (%s)" error message:

102:	loadDecoders = function(fname)
103:	  -- resolve the full, absolute, path
104:	  local abs_fname = nmap.fetchfile(fname)
105:	
106:	  if ( not(abs_fname) ) then
107:	    return false, ("Failed to load decoder definition (%s)"):format(fname)
108:	  end
109:	
110:	  local env = setmetatable({Decoders = {}}, {__index = _G});
111:	  local file = loadfile(abs_fname, "t", env)
112:	  if(not(file)) then

Couldn't load decoder file:


Here is a relevant code snippet related to the "Couldn't load decoder file: " error message:

109:	
110:	  local env = setmetatable({Decoders = {}}, {__index = _G});
111:	  local file = loadfile(abs_fname, "t", env)
112:	  if(not(file)) then
113:	    stdnse.debug1("Couldn't load decoder file: %s", fname)
114:	    return false, "Couldn't load decoder file: " .. fname
115:	  end
116:	
117:	  file()
118:	
119:	  local d = env.Decoders

Failed to load decoders


Here is a relevant code snippet related to the "Failed to load decoders" error message:

117:	  file()
118:	
119:	  local d = env.Decoders
120:	
121:	  if ( d ) then return true, d end
122:	  return false, "Failed to load decoders"
123:	end
124:	
125:	---
126:	-- Starts sniffing the selected interface for packets with a destination that
127:	-- is not explicitly ours (broadcast, multicast etc.)

The IP address of the interface could not be determined


Here is a relevant code snippet related to the "The IP address of the interface could not be determined" error message:

235:	  -- was an interface supplied using the -e argument?
236:	  if ( iface ) then
237:	    local iinfo, err = nmap.get_interface_info(iface)
238:	
239:	    if ( not(iinfo.address) ) then
240:	      return fail("The IP address of the interface could not be determined")
241:	    end
242:	
243:	    interfaces = { { name = iface, address = iinfo.address } }
244:	  else
245:	    -- no interface was supplied, attempt autodiscovery

Could not determine any valid interfaces


Here is a relevant code snippet related to the "Could not determine any valid interfaces" error message:

246:	    interfaces = getInterfaces("ethernet", "up")
247:	  end
248:	
249:	  -- make sure we have at least one interface to start sniffing
250:	  if ( #interfaces == 0 ) then
251:	    return fail("Could not determine any valid interfaces")
252:	  end
253:	
254:	  -- load the decoders from file
255:	  local status, Decoders = loadDecoders(DECODERFILE)
256:	  if ( not(status) ) then return fail(Decoders) end

Version


This page has been created based on Nmap version 7.92.

Go back to menu.