1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-13 17:06:34 +00:00

A few changes to HTTPtrace.nse: use stdnse.strsplit() rather than my str2tab(), remove unused var, and change how to remove extra newline from server response

This commit is contained in:
kris
2007-09-03 22:24:26 +00:00
parent 4d94f8a0ee
commit 54bf839dc9

View File

@@ -19,16 +19,7 @@ license = "Look at Nmap's COPYING"
categories = {"discovery"}
require "shortport"
str2tab = function(str)
local tab = { }
for s in string.gfind(str, "[^\r\n]+") do
table.insert(tab, s)
end
return tab
end
require "stdnse"
truncate = function(tab)
local str = ""
@@ -59,10 +50,10 @@ validate = function(response, original)
local sub = string.sub(data, 19) -- skip TRACE line
local tab = {}
-- Avoid extra newlines
sub = string.gsub(sub, "\r\n$", "")
-- Skip extra newline at the end (making sure it's there)
sub = string.gsub(sub, "\r\n\r\n$", "\r\n")
tab = str2tab(sub)
tab = stdnse.strsplit("\r\n", sub)
if #tab > 5 then
output = output .. "First 5 additional lines:\n"
@@ -85,7 +76,7 @@ end
portrule = shortport.port_or_service({80, 8080}, "http")
action = function(host, port)
local cmd, response, ret
local cmd, response
local socket
socket = nmap.new_socket()