Nmap targets-ipv6-map4to6 NSE Script


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

Script Description


The targets-ipv6-map4to6.nse script runs in the pre-scanning phase to map IPv4 addresses onto IPv6 networks and add them to the scan queue.

The technique is more general than what is technically termed "IPv4-mapped IPv6 addresses." The lower 4 bytes of the IPv6 network address are replaced with the 4 bytes of IPv4 address. When the IPv6 network is ::ffff:0:0/96, then the script generates IPv4-mapped IPv6 addresses. When the network is ::/96, then it generates IPv4-compatible IPv6 addresses.

Targets-ipv6-map4to6 NSE Script Arguments


This is a full list of arguments supported by the targets-ipv6-map4to6.nse script:

targets-ipv6-map4to6.IPv4Hosts

This must have at least one IPv4 Host for the script be able to work (Ex. 192.168.1.1 or { 192.168.1.1, 192.168.2.2 } ) or Subnet Addresses ( 192.168.1.0/24 or { 192.168.1.0/24, 192.168.2.0/24 } )

targets-ipv6-subnet

Table/single IPv6 address with prefix (Ex. 2001:db8:c0ca::/48 or { 2001:db8:c0ca::/48, 2001:db8:FEA::/48 })

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=targets-ipv6-map4to6 --script-args targets-ipv6-map4to6.IPv4Hosts=value,targets-ipv6-subnet=value <target>

Targets-ipv6-map4to6 NSE Script Example Usage


Here's an example of how to use the targets-ipv6-map4to6.nse script:

nmap -6 --script targets-ipv6-map4to6 --script-args newtargets,targets-ipv6-map4to6.IPv4Hosts={192.168.1.0/24},targets-ipv6-subnet={2001:db8:c0ca::/64}

Targets-ipv6-map4to6 NSE Script Example Output


Here's a sample output from the targets-ipv6-map4to6.nse script:

Pre-scan script results:
| targets-ipv6-map4to6:
|   node count: 256
|   addresses:
|_    2001:db8:c0ca:0:0:0:c0a8:100/120

Targets-ipv6-map4to6 NSE Script Example XML Output


Here's a sample XML output from the targets-ipv6-map4to6.nse script produced by providing the -oX <file> Nmap option:

 <elem key="node count">256</elem>
 <table key="addresses">
   <elem>2001:db8:c0ca:0:0:0:c0a8:100/120</elem>
 </table>

Author


  • Ral Armando Fuentes Samaniego

References


See Also


Related NSE scripts to the targets-ipv6-map4to6.nse script:

Visit Nmap NSE Library for more scripts.

The targets-ipv6-map4to6.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.

Error adding node %s: %s


Here is a relevant code snippet related to the "Error adding node %s: %s" error message:

130:	      local bool
131:	      bool, sError = target.add(IPAux)
132:	      if bool then
133:	        iTotal = iTotal + 2^(128 - prefix)
134:	      else
135:	        stdnse.debug1("Error adding node %s: %s", IPAux, sError)
136:	      end
137:	    else
138:	      iTotal = iTotal + 2^(128 - prefix)
139:	    end
140:	

ERROR: One IPv6 subnet wasn't translated


Here is a relevant code snippet related to the "ERROR: One IPv6 subnet wasn't translated" error message:

168:	  -- http://seclists.org/nmap-dev/2013/q4/285
169:	  for _, IPv6_Subnet in ipairs(IPv6User) do
170:	    stdnse.debug1("Processing %s", IPv6_Subnet)
171:	    local IPv6Host, sError = From_4_to_6(IPv6_Subnet, IPv4Sub, tSalida.addrs)
172:	    if sError ~= nil then
173:	      stdnse.debug1( "ERROR: One IPv6 subnet wasn't translated")
174:	      errors[#errors+1] = sError
175:	    end
176:	    if IPv6Host then
177:	      -- We need to concatenate the new nodes
178:	      Grantotal = Grantotal + IPv6Host

Warnings: %s


Here is a relevant code snippet related to the "Warnings: %s" error message:

234:	
235:	    tOutput["node count"] = tSalida.Nodos
236:	    tOutput["addresses"] = tSalida.addrs
237:	
238:	    if tSalida.Error then
239:	      stdnse.debug1("Warnings: %s", tSalida.Error)
240:	    end
241:	  else
242:	    stdnse.debug1("Was unable to add nodes to the scan list due this error: %s",
243:	      tSalida.Error)
244:	  end

Was unable to add nodes to the scan list due this error: %s


Here is a relevant code snippet related to the "Was unable to add nodes to the scan list due this error: %s" error message:

237:	
238:	    if tSalida.Error then
239:	      stdnse.debug1("Warnings: %s", tSalida.Error)
240:	    end
241:	  else
242:	    stdnse.debug1("Was unable to add nodes to the scan list due this error: %s",
243:	      tSalida.Error)
244:	  end
245:	
246:	  return tOutput
247:	end

Version


This page has been created based on Nmap version 7.92.

Go back to menu.