mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 05:31:31 +00:00
Starting in Lua 5.1, string.gfind was renamed to string.gmatch. This commit fixes a warning when gfind is used by using gmatch instead.
This commit is contained in:
@@ -263,7 +263,7 @@ expand_ip = function( ip )
|
|||||||
return nil, err4
|
return nil, err4
|
||||||
end
|
end
|
||||||
local octets = {}
|
local octets = {}
|
||||||
for octet in string.gfind( ip, "%d+" ) do
|
for octet in string.gmatch( ip, "%d+" ) do
|
||||||
if tonumber( octet, 10 ) > 255 then return nil, err4 end
|
if tonumber( octet, 10 ) > 255 then return nil, err4 end
|
||||||
octets[#octets+1] = octet
|
octets[#octets+1] = octet
|
||||||
end
|
end
|
||||||
@@ -283,7 +283,7 @@ expand_ip = function( ip )
|
|||||||
|
|
||||||
-- get a table of each hexadectet
|
-- get a table of each hexadectet
|
||||||
local hexadectets = {}
|
local hexadectets = {}
|
||||||
for hdt in string.gfind( ip, "[\.z%x]+" ) do
|
for hdt in string.gmatch( ip, "[\.z%x]+" ) do
|
||||||
hexadectets[#hexadectets+1] = hdt
|
hexadectets[#hexadectets+1] = hdt
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -435,13 +435,13 @@ ip_to_bin = function( ip )
|
|||||||
|
|
||||||
if not ip:match( ":" ) then
|
if not ip:match( ":" ) then
|
||||||
-- ipv4 string
|
-- ipv4 string
|
||||||
for octet in string.gfind( ip, "%d+" ) do
|
for octet in string.gmatch( ip, "%d+" ) do
|
||||||
t[#t+1] = stdnse.tohex( tonumber(octet) )
|
t[#t+1] = stdnse.tohex( tonumber(octet) )
|
||||||
end
|
end
|
||||||
mask = "00"
|
mask = "00"
|
||||||
else
|
else
|
||||||
-- ipv6 string
|
-- ipv6 string
|
||||||
for hdt in string.gfind( ip, "%x+" ) do
|
for hdt in string.gmatch( ip, "%x+" ) do
|
||||||
t[#t+1] = hdt
|
t[#t+1] = hdt
|
||||||
end
|
end
|
||||||
mask = "0000"
|
mask = "0000"
|
||||||
@@ -484,7 +484,7 @@ bin_to_ip = function( binstring )
|
|||||||
t = {}
|
t = {}
|
||||||
if af == 6 then
|
if af == 6 then
|
||||||
local pattern = string.rep( "[01]", 16 )
|
local pattern = string.rep( "[01]", 16 )
|
||||||
for chunk in string.gfind( binstring, pattern ) do
|
for chunk in string.gmatch( binstring, pattern ) do
|
||||||
t[#t+1] = stdnse.tohex( tonumber( chunk, 2 ) )
|
t[#t+1] = stdnse.tohex( tonumber( chunk, 2 ) )
|
||||||
end
|
end
|
||||||
return table.concat( t, ":" )
|
return table.concat( t, ":" )
|
||||||
@@ -492,7 +492,7 @@ bin_to_ip = function( binstring )
|
|||||||
|
|
||||||
if af == 4 then
|
if af == 4 then
|
||||||
local pattern = string.rep( "[01]", 8 )
|
local pattern = string.rep( "[01]", 8 )
|
||||||
for chunk in string.gfind( binstring, pattern ) do
|
for chunk in string.gmatch( binstring, pattern ) do
|
||||||
t[#t+1] = tonumber( chunk, 2 ) .. ""
|
t[#t+1] = tonumber( chunk, 2 ) .. ""
|
||||||
end
|
end
|
||||||
return table.concat( t, "." )
|
return table.concat( t, "." )
|
||||||
@@ -521,7 +521,7 @@ hex_to_bin = function( hex )
|
|||||||
end
|
end
|
||||||
|
|
||||||
local t, mask, binchar = {}, "0000"
|
local t, mask, binchar = {}, "0000"
|
||||||
for hexchar in string.gfind( hex, "%x" ) do
|
for hexchar in string.gmatch( hex, "%x" ) do
|
||||||
binchar = stdnse.tobinary( tonumber( hexchar, 16 ) )
|
binchar = stdnse.tobinary( tonumber( hexchar, 16 ) )
|
||||||
t[#t+1] = mask:sub( 1, string.len( mask ) - string.len( binchar ) ) .. binchar
|
t[#t+1] = mask:sub( 1, string.len( mask ) - string.len( binchar ) ) .. binchar
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ local function find_links(list, base_path, page, host)
|
|||||||
injectable = {}
|
injectable = {}
|
||||||
url_parts = {}
|
url_parts = {}
|
||||||
|
|
||||||
for w in string.gfind(page, 'href%s*=%s*"%s*[^"]+%s*"') do
|
for w in string.gmatch(page, 'href%s*=%s*"%s*[^"]+%s*"') do
|
||||||
s, e = string.find(w, '"')
|
s, e = string.find(w, '"')
|
||||||
httpurl = string.sub(w, s+1, string.len(w)-1)
|
httpurl = string.sub(w, s+1, string.len(w)-1)
|
||||||
i = 1
|
i = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user