1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Minor code simplification using tableaux.invert

This commit is contained in:
nnposter
2020-12-16 18:03:08 +00:00
parent 1b39988bf9
commit 003849f795

View File

@@ -21,7 +21,6 @@ local match = require "match"
_ENV = stdnse.module("smb2", stdnse.seeall)
local TIMEOUT = 10000
local command_names = {}
local command_codes =
{
SMB2_COM_NEGOTIATE = 0x0000,
@@ -44,7 +43,7 @@ local command_codes =
SMB2_COM_SET_INFO = 0x0011,
SMB2_COM_OPLOCK_BREAK = 0x0012
}
local smb2_values_codes = {}
local command_names = tableaux.invert(command_codes)
local smb2_values = {
-- Security Mode
SMB2_NEGOTIATE_SIGNING_ENABLED = 0x0001,
@@ -61,13 +60,7 @@ local smb2_values = {
SMB2_ENCRYPTION_CAPABILITIES = 0x0002,
SMB2_PREAUTH_INTEGRITY_CAPABILITIES = 0x0001
}
for i, v in pairs(command_codes) do
command_names[v] = i
end
for i, v in pairs(smb2_values) do
smb2_values_codes[v] = i
end
local smb2_values_codes = tableaux.invert(smb2_values)
---
-- Creates a SMB2 SYNC header packet.