fix up the simple.client.system_time and underlying stuffs
git-svn-id: file:///home/svn/framework3/trunk@10362 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
16f2e33442
commit
b22c24289d
|
@ -511,11 +511,22 @@ EVADE = Rex::Proto::SMB::Evasions
|
|||
# buf[16, buf.length - 16]
|
||||
end
|
||||
|
||||
if (ack['Payload'].v['ServerDate'] > 0)
|
||||
stamp = UTILS.time_smb_to_unix(ack['Payload'].v['ServerDate'],ack['Payload'].v['ServerTime'])
|
||||
self.server_date = ::Time.at(stamp)
|
||||
self.server_zone = ack['Payload'].v['Timezone']
|
||||
# The number of 100-nanosecond intervals that have elapsed since January 1, 1601, in
|
||||
# Coordinated Universal Time (UTC) format.
|
||||
# We convert it to a friendly Time object here
|
||||
self.system_time = UTILS.time_smb_to_unix(ack['Payload'].v['SystemTimeHigh'],ack['Payload'].v['SystemTimeLow'])
|
||||
self.system_time = ::Time.at( self.system_time )
|
||||
|
||||
# Convert the ServerTimeZone to seconds and back into a signed integer :-/
|
||||
system_zone = ack['Payload'].v['ServerTimeZone']
|
||||
if system_zone & 0x8000
|
||||
system_zone &= 0x7fff
|
||||
system_zone *= -1
|
||||
end
|
||||
system_zone *= 60
|
||||
|
||||
# Adjust the system_time object to reflect the remote timezone
|
||||
self.system_time = self.system_time.utc.localtime(system_zone)
|
||||
|
||||
return ack
|
||||
end
|
||||
|
@ -1734,7 +1745,8 @@ EVADE = Rex::Proto::SMB::Evasions
|
|||
end
|
||||
|
||||
# public read/write methods
|
||||
attr_accessor :native_os, :native_lm, :encrypt_passwords, :extended_security, :read_timeout, :evasion_opts, :server_date, :server_zone
|
||||
attr_accessor :native_os, :native_lm, :encrypt_passwords, :extended_security, :read_timeout, :evasion_opts
|
||||
attr_accessor :system_time
|
||||
|
||||
# public read methods
|
||||
attr_reader :dialect, :session_id, :challenge_key, :peer_native_lm, :peer_native_os
|
||||
|
|
|
@ -470,9 +470,9 @@ SMB_NEG_RES_NT_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|||
[ 'uint32v', 'MaxRaw', 0 ],
|
||||
[ 'uint32v', 'SessionKey', 0 ],
|
||||
[ 'uint32v', 'Capabilities', 0 ],
|
||||
[ 'uint32v', 'ServerTime', 0 ],
|
||||
[ 'uint32v', 'ServerDate', 0 ],
|
||||
[ 'uint16v', 'Timezone', 0 ],
|
||||
[ 'uint32v', 'SystemTimeLow', 0 ],
|
||||
[ 'uint32v', 'SystemTimeHigh', 0 ],
|
||||
[ 'uint16v', 'ServerTimeZone', 0 ],
|
||||
[ 'uint8', 'KeyLength', 0 ],
|
||||
[ 'uint16v', 'ByteCount', 0 ],
|
||||
[ 'string', 'Payload', nil, '' ]
|
||||
|
|
|
@ -54,6 +54,8 @@ CONST = Rex::Proto::SMB::Constants
|
|||
return CONST::CREATE_ACCESS_OPENCREATE
|
||||
end
|
||||
|
||||
# NOTE: the difference below came from: Time.utc("1970-1-1") - Time.utc("1601-1-1")
|
||||
|
||||
# Convert a 64-bit signed SMB time to a unix timestamp
|
||||
def self.time_smb_to_unix(thi, tlo)
|
||||
(((thi << 32) + tlo) / 10000000) - 11644473600
|
||||
|
|
Loading…
Reference in New Issue