1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

More string.sub vs. string.byte optimizations

This commit is contained in:
nnposter
2018-08-19 01:49:08 +00:00
parent 57a17415b7
commit 19693c334c
3 changed files with 4 additions and 9 deletions

View File

@@ -1718,13 +1718,8 @@ PreLoginPacket =
end
if ( optionType == PreLoginPacket.OPTION_TYPE.Version ) then
local major, minor, build, subBuild, version
major = string.byte( optionData:sub( 1, 1 ) )
minor = string.byte( optionData:sub( 2, 2 ) )
build = (string.byte( optionData:sub( 3, 3 ) ) * 256) + string.byte( optionData:sub( 4, 4 ) )
subBuild = (string.byte( optionData:sub( 5, 5 ) ) * 256) + string.byte( optionData:sub( 6, 6 ) )
version = SqlServerVersionInfo:new()
local major, minor, build, subBuild = (">BBI2I2"):unpack(optionData)
local version = SqlServerVersionInfo:new()
version:SetVersion( major, minor, build, subBuild, "SSNetLib" )
preLoginPacket.versionInfo = version
elseif ( optionType == PreLoginPacket.OPTION_TYPE.Encryption ) then