Nmap Development mailing list archives
Re: [nmap-svn] r33786 - in nmap: nselib scripts
From: Daniel Miller <bonsaiviking () gmail com>
Date: Fri, 7 Nov 2014 18:19:41 -0600
On Fri, Nov 7, 2014 at 4:06 PM, Jacek Wielemborek <d33tah () gmail com> wrote:
W dniu 07.11.2014 o 17:39, commit-mailer () nmap org pisze:Author: dmiller Date: Fri Nov 7 16:39:26 2014 New Revision: 33786 Log: Use internal cipher/handshake scoring system instead of static datafile Modified: nmap/nselib/tls.lua nmap/scripts/ssl-enum-ciphers.nse Modified: nmap/nselib/tls.lua ============================================================================== --- nmap/nselib/tls.lua (original) +++ nmap/nselib/tls.lua Fri Nov 7 16:39:26 2014 @@ -583,6 +583,18 @@ ["SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA"] = 0xFEFF, } +local function find_key(t, value) + local k, v + + for k, v in pairs(t) do + if v == value then + return k + end + end + + return nil +end +IMHO find_key belongs more to NSELib.
For what it's worth, stdnse.contains() does a similar thing:
--- Check for the presence of a value in a table
--@param tab the table to search into
--@param item the searched value
--@return Boolean true if the item was found, false if not
--@return The index or key where the value was found, or nil
function contains(tab, item)
for k, val in pairs(tab) do
if val == item then
return true, k
end
end
return false, nil
end
It would be good to combine these (probably make it a single-value
return like find_key, since that can be tested for nil), but not
necessary.
Dan
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: [nmap-svn] r33786 - in nmap: nselib scripts Jacek Wielemborek (Nov 07)
- Re: [nmap-svn] r33786 - in nmap: nselib scripts Daniel Miller (Nov 07)
