"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "nselib/mssql.lua" between
nmap-7.90.tgz and nmap-7.91.tgz

About: Nmap ("Network Mapper") is a utility for network exploration or security auditing (port scanner).

mssql.lua  (nmap-7.90.tgz):mssql.lua  (nmap-7.91.tgz)
skipping to change at line 109 skipping to change at line 109
-- instances not being discovered, particularly if UDP port 1434 is not -- instances not being discovered, particularly if UDP port 1434 is not
-- included. Additionally, instances that are found to be running on -- included. Additionally, instances that are found to be running on
-- ports that were not scanned (e.g. if 1434/udp is in the scan and the -- ports that were not scanned (e.g. if 1434/udp is in the scan and the
-- SQL Server Browser service on that port reports an instance -- SQL Server Browser service on that port reports an instance
-- listening on 43210/tcp, which was not scanned) will be reported but -- listening on 43210/tcp, which was not scanned) will be reported but
-- will not be stored for use by other ms-sql-* scripts. -- will not be stored for use by other ms-sql-* scripts.
local math = require "math" local math = require "math"
local match = require "match" local match = require "match"
local nmap = require "nmap" local nmap = require "nmap"
local os = require "os" local datetime = require "datetime"
local shortport = require "shortport" local shortport = require "shortport"
local smb = require "smb" local smb = require "smb"
local smbauth = require "smbauth" local smbauth = require "smbauth"
local stdnse = require "stdnse" local stdnse = require "stdnse"
local strbuf = require "strbuf" local strbuf = require "strbuf"
local string = require "string" local string = require "string"
local table = require "table" local table = require "table"
local unicode = require "unicode" local unicode = require "unicode"
_ENV = stdnse.module("mssql", stdnse.seeall) _ENV = stdnse.module("mssql", stdnse.seeall)
skipping to change at line 159 skipping to change at line 159
error(err) error(err)
end end
MSSQL_TIMEOUT = timeout MSSQL_TIMEOUT = timeout
SCANNED_PORTS_ONLY = false SCANNED_PORTS_ONLY = false
if ( stdnse.get_script_args( "mssql.scanned-ports-only" ) ) then if ( stdnse.get_script_args( "mssql.scanned-ports-only" ) ) then
SCANNED_PORTS_ONLY = true SCANNED_PORTS_ONLY = true
end end
end end
-- This constant is number of seconds from 1900-01-01 to 1970-01-01
local tds_offset_seconds = -2208988800 - datetime.utc_offset()
-- ************************************* -- *************************************
-- Informational Classes -- Informational Classes
-- ************************************* -- *************************************
--- SqlServerInstanceInfo class --- SqlServerInstanceInfo class
SqlServerInstanceInfo = SqlServerInstanceInfo =
{ {
instanceName = nil, instanceName = nil,
version = nil, version = nil,
serverName = nil, serverName = nil,
skipping to change at line 1225 skipping to change at line 1228
end, end,
[DataTypes.SYBINT4] = function( data, pos ) [DataTypes.SYBINT4] = function( data, pos )
local num local num
num, pos = string.unpack("<I4", data, pos) num, pos = string.unpack("<I4", data, pos)
return pos, num return pos, num
end, end,
[DataTypes.SYBDATETIME] = function( data, pos ) [DataTypes.SYBDATETIME] = function( data, pos )
local hi, lo, result_seconds, result local hi, lo
local tds_epoch, system_epoch, tds_offset_seconds
hi, lo, pos = string.unpack("<i4I4", data, pos) hi, lo, pos = string.unpack("<i4I4", data, pos)
tds_epoch = os.time( {year = 1900, month = 1, day = 1, hour = 00, min = 00 local result_seconds = (hi*24*60*60) + (lo/300)
, sec = 00, isdst = nil} )
-- determine the offset between the tds_epoch and the local system epoch
system_epoch = os.time( os.date("*t", 0))
tds_offset_seconds = os.difftime(tds_epoch,system_epoch)
result_seconds = (hi*24*60*60) + (lo/300)
result = os.date("!%b %d, %Y %H:%M:%S", tds_offset_seconds + result_second s ) local result = datetime.format_timestamp(tds_offset_seconds + result_secon ds)
return pos, result return pos, result
end, end,
[DataTypes.NTEXTTYPE] = function( data, pos ) [DataTypes.NTEXTTYPE] = function( data, pos )
local len, coldata local len, coldata
-- The first len value is the size of the meta data block -- The first len value is the size of the meta data block
len, pos = string.unpack( "<B", data, pos ) len, pos = string.unpack( "<B", data, pos )
if ( len == 0 ) then if ( len == 0 ) then
skipping to change at line 1305 skipping to change at line 1302
format_string = string.format("%%.%if", scale) format_string = string.format("%%.%if", scale)
coldata = string.format(format_string,coldata) coldata = string.format(format_string,coldata)
return pos, coldata return pos, coldata
end, end,
[DataTypes.NUMERICNTYPE] = function( precision, scale, data, pos ) [DataTypes.NUMERICNTYPE] = function( precision, scale, data, pos )
return ColumnData.Parse[DataTypes.DECIMALNTYPE]( precision, scale, data, p os ) return ColumnData.Parse[DataTypes.DECIMALNTYPE]( precision, scale, data, p os )
end, end,
[DataTypes.SYBDATETIME] = function( data, pos )
local hi, lo, result_seconds, result
local tds_epoch, system_epoch, tds_offset_seconds
hi, lo, pos = string.unpack("<i4I4", data, pos)
tds_epoch = os.time( {year = 1900, month = 1, day = 1, hour = 00, min = 00
, sec = 00, isdst = nil} )
-- determine the offset between the tds_epoch and the local system epoch
system_epoch = os.time( os.date("*t", 0))
tds_offset_seconds = os.difftime(tds_epoch,system_epoch)
result_seconds = (hi*24*60*60) + (lo/300)
result = os.date("!%b %d, %Y %H:%M:%S", tds_offset_seconds + result_second
s )
return pos, result
end,
[DataTypes.BITNTYPE] = function( data, pos ) [DataTypes.BITNTYPE] = function( data, pos )
return ColumnData.Parse[DataTypes.SYBINTN](data, pos) return ColumnData.Parse[DataTypes.SYBINTN](data, pos)
end, end,
[DataTypes.NTEXTTYPE] = function( data, pos ) [DataTypes.NTEXTTYPE] = function( data, pos )
local len, coldata local len, coldata
-- The first len value is the size of the meta data block -- The first len value is the size of the meta data block
len, pos = string.unpack( "<B", data, pos ) len, pos = string.unpack( "<B", data, pos )
skipping to change at line 1400 skipping to change at line 1380
len, pos = string.unpack( "<B", data, pos ) len, pos = string.unpack( "<B", data, pos )
if ( len == 0 ) then if ( len == 0 ) then
return pos, 'Null' return pos, 'Null'
elseif ( len == 4 ) then elseif ( len == 4 ) then
-- format is smalldatetime -- format is smalldatetime
local days, mins local days, mins
days, mins, pos = string.unpack("<I2I2", data, pos) days, mins, pos = string.unpack("<I2I2", data, pos)
local tds_epoch = os.time( {year = 1900, month = 1, day = 1, hour = 00,
min = 00, sec = 00, isdst = nil} )
-- determine the offset between the tds_epoch and the local system epoch
local system_epoch = os.time( os.date("*t", 0))
local tds_offset_seconds = os.difftime(tds_epoch,system_epoch)
local result_seconds = (days*24*60*60) + (mins*60) local result_seconds = (days*24*60*60) + (mins*60)
coldata = os.date("!%b %d, %Y %H:%M:%S", tds_offset_seconds + result_sec onds ) coldata = datetime.format_timestamp(tds_offset_seconds + result_seconds)
return pos,coldata return pos,coldata
elseif ( len == 8 ) then elseif ( len == 8 ) then
-- format is datetime -- format is datetime
return ColumnData.Parse[DataTypes.SYBDATETIME](data, pos) return ColumnData.Parse[DataTypes.SYBDATETIME](data, pos)
else else
return -1, ("Unhandled length (%d) for SYBDATETIMN"):format(len) return -1, ("Unhandled length (%d) for SYBDATETIMN"):format(len)
end end
 End of changes. 8 change blocks. 
37 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)