mirror of
https://github.com/nmap/nmap.git
synced 2026-01-11 08:59:04 +00:00
o The NSE http library now supports chunked encoding. [Sven Klemm]
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o The NSE http library now supports chunked encoding. [Sven Klemm]
|
||||
|
||||
o Fix a number of NSE scripts which used print_debug()
|
||||
incorrectly. See
|
||||
http://seclists.org/nmap-dev/2008/q3/0470.html. [Sven Klemm].
|
||||
|
||||
o Improve the nebtios-smb-os-discovery NSE script to improve target
|
||||
port selection and to also decode the system's timestamp from an SMB
|
||||
response. [Ron at SkullSecurity]
|
||||
|
||||
@@ -143,7 +143,7 @@ request = function( host, port, data, options )
|
||||
return result
|
||||
end
|
||||
|
||||
local buffer = stdnse.make_buffer( socket, "\r?\n" )
|
||||
local buffer = stdnse.make_buffer( socket, "\r\n" )
|
||||
|
||||
local line, _
|
||||
local header, body = {}, {}
|
||||
@@ -184,15 +184,32 @@ request = function( host, port, data, options )
|
||||
end
|
||||
end
|
||||
|
||||
-- body loop
|
||||
while true do
|
||||
line = buffer()
|
||||
if not line then break end
|
||||
table.insert(body,line)
|
||||
-- handle body
|
||||
if result.header['transfer-encoding'] == 'chunked' then
|
||||
-- if the server used chunked encoding we have to 'dechunk' the answer
|
||||
local counter, chunk_size
|
||||
counter = 0; chunk_size = 0
|
||||
while true do
|
||||
if counter >= chunk_size then
|
||||
counter = 0
|
||||
chunk_size = tonumber( buffer(), 16 )
|
||||
if chunk_size == 0 or not chunk_size then break end
|
||||
end
|
||||
line = buffer()
|
||||
if not line then break end
|
||||
counter = counter + #line + 2
|
||||
table.insert(body,line)
|
||||
end
|
||||
else
|
||||
while true do
|
||||
line = buffer()
|
||||
if not line then break end
|
||||
table.insert(body,line)
|
||||
end
|
||||
end
|
||||
|
||||
socket:close()
|
||||
result.body = table.concat( body, "\n" )
|
||||
result.body = table.concat( body, "\r\n" )
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user