Class: Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Power
- Inherits:
-
Object
- Object
- Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Power
- Defined in:
- lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb
Overview
This class provides access to the power of the remote machine (reboot, etc).
Class Attribute Summary collapse
-
.client ⇒ Object
Returns the value of attribute client.
Class Method Summary collapse
-
._exitwindows(flags, reason = 0) ⇒ Object
Calls ExitWindows on the remote machine with the supplied parameters.
-
.reboot(reason = 0) ⇒ Object
Reboots the remote machine.
-
.shutdown(force = 0, reason = 0) ⇒ Object
Shuts down the remote machine.
Class Attribute Details
.client ⇒ Object
Returns the value of attribute client.
25 26 27 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb', line 25 def client @client end |
Class Method Details
._exitwindows(flags, reason = 0) ⇒ Object
Calls ExitWindows on the remote machine with the supplied parameters.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb', line 31 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 |
.reboot(reason = 0) ⇒ Object
Reboots the remote machine.
45 46 47 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb', line 45 def Power.reboot(reason = 0) self._exitwindows(EWX_REBOOT, reason) end |
.shutdown(force = 0, reason = 0) ⇒ Object
Shuts down the remote machine.
52 53 54 55 56 57 58 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb', line 52 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 |