Nmap broadcast-wake-on-lan NSE Script


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

Script Description


The broadcast-wake-on-lan.nse script wakes a remote system up from sleep by sending a Wake-On-Lan packet.

Broadcast-wake-on-lan NSE Script Arguments


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

broadcast-wake-on-lan.address

The broadcast address to which the WoL packet is sent.

broadcast-wake-on-lan.MAC

The MAC address of the remote system to wake up

- - -
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-wake-on-lan --script-args broadcast-wake-on-lan.address=value,broadcast-wake-on-lan.MAC=value <target>

Broadcast-wake-on-lan NSE Script Example Usage


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

nmap --script broadcast-wake-on-lan --script-args broadcast-wake-on-lan.MAC='00:12:34:56:78:9A'

Broadcast-wake-on-lan NSE Script Example Output


Here's a sample output from the broadcast-wake-on-lan.nse script:

Pre-scan script results:
| broadcast-wake-on-lan:
|_  Sent WOL packet to: 10:9a:dd:a8:40:24

Broadcast-wake-on-lan 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-wake-on-lan.nse script:

Visit Nmap NSE Library for more scripts.

The broadcast-wake-on-lan.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 process MAC address


Here is a relevant code snippet related to the "Failed to process MAC address" error message:

46:	  if ( MAC:match("%x%x:%x%x:%x%x:%x%x:%x%x:%x%x") ) then
47:	    MAC_hex = MAC:gsub(":", "")
48:	  elseif( MAC:match("%x%x%-%x%x%-%x%x%-%x%x%-%x%x%-%x%x") ) then
49:	    MAC_hex = MAC:gsub("-", "")
50:	  else
51:	    return fail("Failed to process MAC address")
52:	  end
53:	
54:	  local host = { ip = address or "255.255.255.255" }
55:	  local port = { number = 9, protocol = "udp" }
56:	  local socket = nmap.new_socket("udp")

Failed to send packet


Here is a relevant code snippet related to the "Failed to send packet" error message:

58:	  -- send two packets, just in case
59:	  for i=1,2 do
60:	    local packet = createWOLPacket(MAC_hex)
61:	    local status, err = socket:sendto(host, port, packet)
62:	    if ( not(status) ) then
63:	      return fail("Failed to send packet")
64:	    end
65:	  end
66:	  return stdnse.format_output(true, ("Sent WOL packet to: %s"):format(MAC))
67:	end
68:	

Version


This page has been created based on Nmap version 7.92.

Go back to menu.