diff --git a/scripts/asn-query.nse b/scripts/asn-query.nse index db6fd6d8c..fb4392f16 100644 --- a/scripts/asn-query.nse +++ b/scripts/asn-query.nse @@ -370,7 +370,7 @@ function get_prefix_length( range ) last = ipOps.ip_to_bin(last) for pos = 1, #first do - if first:sub(pos, pos) ~= last:sub(pos, pos) then + if first:byte(pos) ~= last:byte(pos) then return pos - 1 end end diff --git a/scripts/whois-ip.nse b/scripts/whois-ip.nse index edf12bc83..8e236e371 100644 --- a/scripts/whois-ip.nse +++ b/scripts/whois-ip.nse @@ -438,7 +438,7 @@ function get_prefix_length( range ) last = ipOps.ip_to_bin(last) for pos = 1, #first do - if first:sub(pos, pos) ~= last:sub(pos, pos) then + if first:byte(pos) ~= last:byte(pos) then return pos - 1 end end