revert to backward compatible method of using utc+zone
git-svn-id: file:///home/svn/framework3/trunk@10367 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
e939379b1b
commit
ff22e5212e
|
@ -523,10 +523,16 @@ EVADE = Rex::Proto::SMB::Evasions
|
|||
system_zone &= 0x7fff
|
||||
system_zone *= -1
|
||||
end
|
||||
system_zone *= 60
|
||||
self.system_zone = system_zone * 60
|
||||
|
||||
# XXX: this is being commented out because ruby prior to 1.9.2 doesn't
|
||||
# seem to support representing non-utc or local times (eg, a time in
|
||||
# another timezone) If you know a way to do it in pre-1.9.2 please
|
||||
# tell us!
|
||||
=begin
|
||||
# Adjust the system_time object to reflect the remote timezone
|
||||
self.system_time = self.system_time.utc.localtime(system_zone)
|
||||
=end
|
||||
|
||||
return ack
|
||||
end
|
||||
|
@ -1746,7 +1752,7 @@ EVADE = Rex::Proto::SMB::Evasions
|
|||
|
||||
# public read/write methods
|
||||
attr_accessor :native_os, :native_lm, :encrypt_passwords, :extended_security, :read_timeout, :evasion_opts
|
||||
attr_accessor :system_time
|
||||
attr_accessor :system_time, :system_zone
|
||||
|
||||
# public read methods
|
||||
attr_reader :dialect, :session_id, :challenge_key, :peer_native_lm, :peer_native_os
|
||||
|
|
|
@ -153,9 +153,11 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
|
||||
|
||||
# Calculate the time (in milliseconds since midnight) to run the job at.
|
||||
# NOTE: We use the server's time as determined during SMB negotiation.
|
||||
# It has already been localized to the server's timezone as well.
|
||||
server_time = simple.client.system_time
|
||||
# NOTE: We use the server's time as determined during SMB negotiation, which
|
||||
# is sent in UTC. We have to localize it before moving on, using the timezone
|
||||
# which they also kindly sent us.
|
||||
server_time = simple.client.system_time.utc
|
||||
server_time += simple.client.system_zone # adjust to localized time
|
||||
|
||||
job_time = seconds_since_midnight(server_time) # convert to seconds since midnight
|
||||
elapsed = Time.now - login_time # account for time the module took so far
|
||||
|
@ -492,10 +494,11 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
|
||||
|
||||
def seconds_since_midnight(time)
|
||||
# .tv_sec always uses .utc :-/
|
||||
#(time.tv_sec % 86400)
|
||||
# .tv_sec always uses .utc
|
||||
(time.tv_sec % 86400)
|
||||
|
||||
# This method uses the localtime
|
||||
(time.hour * 3600) + (time.min * 60) + (time.sec)
|
||||
#(time.hour * 3600) + (time.min * 60) + (time.sec)
|
||||
end
|
||||
|
||||
# We have to wait up to two minutes because the Task Scheduler only has
|
||||
|
|
Loading…
Reference in New Issue