1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-02 12:59:02 +00:00

canonicalize some code

This commit is contained in:
batrick
2011-05-11 14:38:52 +00:00
parent 1cd183014d
commit 186cb2d6a3
3 changed files with 12 additions and 16 deletions

View File

@@ -22,8 +22,8 @@ local function check_code(result)
if result:match( "\r?\n\r?\n" ) then
result = result:match( "^(.-)\r?\n\r?\n(.*)$" )
end
if string.match(result:lower(),"^http/%d\.%d%s*200") then return true end
if string.match(result:lower(),"^http/%d\.%d%s*30[12]") then return true end
if result:lower():match("^http/%d\.%d%s*200") then return true end
if result:lower():match("^http/%d\.%d%s*30[12]") then return true end
end
return false
end
@@ -34,13 +34,10 @@ end
--@return true if pattern is found, otherwise false
local function check_pattern(result, pattern)
local lines = stdnse.strsplit("\n", result)
local i = 1
local n = table.getn(lines)
while true do
if i > n then return false end
if string.match(lines[i]:lower(),pattern:lower()) then return true end
i = i + 1
for i, line in ipairs(lines) do
if line:lower():match(pattern:lower()) then return true end
end
return false
end
--- check, decides what kind of check should be done on the response,