1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 08:59:01 +00:00
david d6288c5280 Escape '%' in arguments to Thread:d.
A user reported this crash when scanning a target whose name contained
the '%' character:

NSE: Script Engine Scan Aborted.
An error was thrown by the engine: nse_main.lua:322: invalid capture index
stack traceback:
	[C]: in function 'gsub'
	nse_main.lua:322: in function 'd'
	nse_main.lua:377: in function 'start'
	nse_main.lua:912: in function 'run'
	nse_main.lua:1390: in function <nse_main.lua:1293>
	[C]: in ?

I'm not sure how a name with '%' got resolved, but I was able to
reproduce the crash by adding this line to /etc/hosts:
	127.0.0.1	a%40b
and then running
	./nmap --script=banner a%40b -d --top-ports 5

The gsub function recognizes "%d", where d is a digit, as a capture
index. The constructed string is then passed to print_debug, which is
like printf. Therefore we escape every occurrence of "%" twice, to get
"%%%%".
2014-01-27 22:56:29 +00:00
2014-01-10 20:43:32 +00:00
2014-01-16 21:50:26 +00:00
2013-07-16 00:51:47 +00:00
2012-12-06 02:34:28 +00:00
2012-12-06 02:25:46 +00:00
2008-07-31 14:18:21 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-05-27 08:53:32 +00:00
2012-09-15 17:56:17 +00:00
2013-02-09 22:46:47 +00:00
2013-12-04 12:51:59 +00:00
2013-10-08 21:50:47 +00:00

Here is some documentation for Nmap, but these files are much less
comprehensive than what you'll find at the actual Nmap documentation
site ( http://nmap.org ).
Languages
C 37.8%
Lua 28.1%
C++ 16.7%
Shell 5.8%
Python 4.2%
Other 7.2%