1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-26 09:29:01 +00:00

New tableaux library containing table auxiliary functions.

This commit is contained in:
dmiller
2018-10-17 15:34:30 +00:00
parent c76424deb7
commit dcc0e3ed7e
43 changed files with 203 additions and 238 deletions

View File

@@ -4,6 +4,7 @@ local shortport = require "shortport"
local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
local tableaux = require "tableaux"
description = [[
Enumerates DNS names using the DNSSEC NSEC-walking technique.
@@ -119,16 +120,6 @@ local function guess_domain(host)
end
end
local function invert(t)
local result = {}
for k, v in pairs(t) do
result[v] = k
end
return result
end
-- RFC 952: "A 'name' is a text string up to 24 characters drawn from the
-- alphabet (A-Z), digits (0-9), minus sign (-), and period (.). ... The first
-- character must be an alpha character."
@@ -138,7 +129,7 @@ end
-- RFC 2782: An underscore (_) is prepended to the service identifier to avoid
-- collisions with DNS labels that occur in nature.
local DNS_CHARS = { string.byte("-0123456789_abcdefghijklmnopqrstuvwxyz", 1, -1) }
local DNS_CHARS_INV = invert(DNS_CHARS)
local DNS_CHARS_INV = tableaux.invert(DNS_CHARS)
-- Return the lexicographically next component, or nil if component is the
-- lexicographically last.