Nmap broadcast-ospf2-discover NSE Script


This page contains detailed information about how to use the broadcast-ospf2-discover 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-ospf2-discover.nse
Script categories: broadcast, discovery, safe
Target service / protocol: -
Target network port(s): -
List of CVEs: -

Script Description


Discover IPv4 networks using Open Shortest Path First version 2(OSPFv2) protocol.

The script works by listening for OSPF Hello packets from the 224.0.0.5 multicast address. The script then replies and attempts to create a neighbor relationship, in order to discover network database.

If no interface was provided as a script argument or through the -e option, the script will fail unless a single interface is present on the system.

Broadcast-ospf2-discover NSE Script Arguments


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

broadcast-ospf2-discover.interface

Interface to send on (overrides -e). Mandatory if not using -e and multiple interfaces are present.

broadcast-ospf2-discover.md5_key

MD5 digest key to use if message digest authentication is disclosed.

broadcast-ospf2-discover.router_id

Router ID to use. Defaults to 0.0.0.1

broadcast-ospf2-discover.timeout

Time in seconds that the script waits for hello from other routers. Defaults to 10 seconds, matching OSPFv2 default value for hello interval.

max-newtargets

Sets the number of the maximum allowed new targets. If set to 0 or less then there is no limit. The default value is 0.

newtargets

If specified, lets NSE scripts add new targets.

- - -
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=broadcast-ospf2-discover --script-args broadcast-ospf2-discover.interface=value,broadcast-ospf2-discover.md5_key=value <target>

Broadcast-ospf2-discover NSE Script Example Usage


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

nmap --script=broadcast-ospf2-discover

nmap --script=broadcast-ospf2-discover -e wlan0

Broadcast-ospf2-discover NSE Script Example Output


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

Pre-scan script results:
| broadcast-ospf2-discover:
|   Area ID: 0.0.0.0
|   External Routes
|     192.168.24.0/24
|_  Use the newtargets script-arg to add the results as targets

Broadcast-ospf2-discover 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


  • Emiliano Ticci

References


See Also


Related NSE scripts to the broadcast-ospf2-discover.nse script:

Visit Nmap NSE Library for more scripts.

The broadcast-ospf2-discover.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.

Argument md5_key must be present when message digest authentication is disclosed.


Here is a relevant code snippet related to the "Argument md5_key must be present when message digest authentication is disclosed." error message:

325:	        ospfDumpHello(ospf_hello)
326:	
327:	        -- Additional checks required for message digest authentication
328:	        if ospf_hello.header.auth_type == 0x02 then
329:	          if not md5_key then
330:	            return fail("Argument md5_key must be present when message digest authentication is disclosed.")
331:	          elseif not have_ssl then
332:	            return fail("Cannot handle message digest authentication unless openssl is compiled in.")
333:	          end
334:	        end
335:	

Cannot handle message digest authentication unless openssl is compiled in.


Here is a relevant code snippet related to the "Cannot handle message digest authentication unless openssl is compiled in." error message:

327:	        -- Additional checks required for message digest authentication
328:	        if ospf_hello.header.auth_type == 0x02 then
329:	          if not md5_key then
330:	            return fail("Argument md5_key must be present when message digest authentication is disclosed.")
331:	          elseif not have_ssl then
332:	            return fail("Cannot handle message digest authentication unless openssl is compiled in.")
333:	          end
334:	        end
335:	
336:	        ospfReplyHello(interface, ospf_hello)
337:	        start = nmap.clock_ms()

Failed to retrieve %s interface information.


Here is a relevant code snippet related to the "Failed to retrieve %s interface information." error message:

401:	  -- Determine interface to use
402:	  interface  = interface or nmap.get_interface()
403:	  if interface then
404:	    interface = nmap.get_interface_info(interface)
405:	    if not interface then
406:	      return fail(("Failed to retrieve %s interface information."):format(interface))
407:	    end
408:	    stdnse.print_debug("Will use %s interface.", interface.shortname)
409:	  else
410:	    local interface_list = nmap.list_interfaces()
411:	    local interface_good = {}

Source interface not found.


Here is a relevant code snippet related to the "Source interface not found." error message:

419:	    end
420:	    if #interface_good == 1 then
421:	      interface = interface_good[1]
422:	      stdnse.print_debug("Will use %s interface.", interface.shortname)
423:	    elseif #interface_good == 0 then
424:	      return fail("Source interface not found.")
425:	    else
426:	      return fail("Ambiguous source interface, please specify it with -e or interface parameter.")
427:	    end
428:	  end
429:	

Ambiguous source interface, please specify it with -e or interface parameter.


Here is a relevant code snippet related to the "Ambiguous source interface, please specify it with -e or interface parameter." error message:

421:	      interface = interface_good[1]
422:	      stdnse.print_debug("Will use %s interface.", interface.shortname)
423:	    elseif #interface_good == 0 then
424:	      return fail("Source interface not found.")
425:	    else
426:	      return fail("Ambiguous source interface, please specify it with -e or interface parameter.")
427:	    end
428:	  end
429:	
430:	  return ospfListen(interface, timeout)
431:	end

Version


This page has been created based on Nmap version 7.92.

Go back to menu.