diff --git a/nselib/mssql.lua b/nselib/mssql.lua index 2f4aaf19b..7124dae14 100644 --- a/nselib/mssql.lua +++ b/nselib/mssql.lua @@ -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 diff --git a/nselib/smb.lua b/nselib/smb.lua index 2574abfd3..be9f68241 100644 --- a/nselib/smb.lua +++ b/nselib/smb.lua @@ -3482,7 +3482,7 @@ function get_uniqueish_name(host, extension, seed) local str = lhost .. (seed or "") .. (extension or "") .. (nmap.registry.args.randomseed or "") for i = 1, #str, 1 do - local chr = string.byte(string.sub(str, i, i), 1) + local chr = str:byte(i) hash = bit.bxor(hash, chr) hash = bit.bor(bit.lshift(hash, 3), bit.rshift(hash, 29)) hash = bit.bxor(hash, 3) diff --git a/scripts/vtam-enum.nse b/scripts/vtam-enum.nse index 3dea2cb0b..3f465ecb9 100644 --- a/scripts/vtam-enum.nse +++ b/scripts/vtam-enum.nse @@ -87,7 +87,7 @@ local function screen_diff( orig_screen, current_screen ) if #orig_screen == 0 or #current_screen == 0 then return 0 end local m = 1 for i =1 , #orig_screen do - if orig_screen:sub(i,i) == current_screen:sub(i,i) then + if orig_screen:byte(i) == current_screen:byte(i) then m = m + 1 end end