merging in my branched changes, eventlogging, power, etc

git-svn-id: file:///home/svn/incoming/trunk@2673 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Spoon M 2005-07-08 00:30:43 +00:00
parent eab910e374
commit 4caa017d09
3 changed files with 70 additions and 1 deletions

View File

@ -162,7 +162,7 @@ class EventLog
request.add_tlv(TLV_TYPE_EVENT_HANDLE, self.handle);
response = client.send_request(request)
return nil
return self
end
#

View File

@ -0,0 +1,61 @@
#!/usr/bin/ruby
require 'Rex/Post/Process'
require 'Rex/Post/Meterpreter/Packet'
require 'Rex/Post/Meterpreter/Client'
require 'Rex/Post/Meterpreter/Extensions/Stdapi/Constants'
require 'Rex/Post/Meterpreter/Extensions/Stdapi/Stdapi'
module Rex
module Post
module Meterpreter
module Extensions
module Stdapi
module Sys
###
#
# Power
# --------
#
# This class provides access to the power of the remote machine (reboot, etc).
#
###
class Power
class <<self
attr_accessor :client
end
def Power._exitwindows(flags, reason = 0) # :nodoc:
request = Packet.create_request('stdapi_sys_power_exitwindows')
request.add_tlv(TLV_TYPE_POWER_FLAGS, flags);
request.add_tlv(TLV_TYPE_POWER_REASON, reason);
response = client.send_request(request)
return self
end
#
# Reboots the remote machine
#
def Power.reboot(reason = 0)
self._exitwindows(EWX_REBOOT, reason)
end
#
# Shuts down the remote machine
#
def Power.shutdown(force = 0, reason = 0)
flags = EWX_POWEROFF
flags |= EWX_FORCEIFHUNG if force == 1
flags |= EWX_FORCE if force == 2
self._exitwindows(flags, reason)
end
end
end end end end end end

View File

@ -147,4 +147,12 @@ TLV_TYPE_EVENT_CATEGORY = TLV_META_TYPE_UINT | 4011
TLV_TYPE_EVENT_STRING = TLV_META_TYPE_STRING | 4012
TLV_TYPE_EVENT_DATA = TLV_META_TYPE_RAW | 4013
##
#
# Power
#
##
TLV_TYPE_POWER_FLAGS = TLV_META_TYPE_UINT | 4100
TLV_TYPE_POWER_REASON = TLV_META_TYPE_UINT | 4101
end; end; end; end; end