Class: Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Config
- Inherits:
-
Object
- Object
- Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Config
- Defined in:
- lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb
Overview
This class provides access to remote system configuration and information.
Instance Method Summary collapse
-
#drop_token ⇒ Object
Drops any assumed token.
-
#getprivs ⇒ Object
Enables all possible privileges.
-
#getuid ⇒ Object
Returns the username that the remote side is running as.
-
#initialize(client) ⇒ Config
constructor
A new instance of Config.
-
#revert_to_self ⇒ Object
Calls RevertToSelf on the remote machine.
-
#steal_token(pid) ⇒ Object
Steals the primary token from a target process.
-
#sysinfo ⇒ Object
Returns a hash of information about the remote computer.
Constructor Details
#initialize(client) ⇒ Config
Returns a new instance of Config.
23 24 25 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb', line 23 def initialize(client) self.client = client end |
Instance Method Details
#drop_token ⇒ Object
Drops any assumed token
71 72 73 74 75 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb', line 71 def drop_token req = Packet.create_request('stdapi_sys_config_drop_token') res = client.send_request(req) return res.get_tlv_value(TLV_TYPE_USER_NAME) end |
#getprivs ⇒ Object
Enables all possible privileges
80 81 82 83 84 85 86 87 88 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb', line 80 def getprivs req = Packet.create_request('stdapi_sys_config_getprivs') ret = [] res = client.send_request(req) res.each(TLV_TYPE_PRIVILEGE) do |p| ret << p.value end return ret end |
#getuid ⇒ Object
Returns the username that the remote side is running as.
30 31 32 33 34 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb', line 30 def getuid request = Packet.create_request('stdapi_sys_config_getuid') response = client.send_request(request) return response.get_tlv_value(TLV_TYPE_USER_NAME) end |
#revert_to_self ⇒ Object
Calls RevertToSelf on the remote machine.
54 55 56 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb', line 54 def revert_to_self client.send_request(Packet.create_request('stdapi_sys_config_rev2self')) end |
#steal_token(pid) ⇒ Object
Steals the primary token from a target process
61 62 63 64 65 66 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb', line 61 def steal_token(pid) req = Packet.create_request('stdapi_sys_config_steal_token') req.add_tlv(TLV_TYPE_PID, pid.to_i) res = client.send_request(req) return res.get_tlv_value(TLV_TYPE_USER_NAME) end |
#sysinfo ⇒ Object
Returns a hash of information about the remote computer.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb', line 39 def sysinfo request = Packet.create_request('stdapi_sys_config_sysinfo') response = client.send_request(request) { 'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME), 'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME), 'Architecture' => response.get_tlv_value(TLV_TYPE_ARCHITECTURE), 'System Language' => response.get_tlv_value(TLV_TYPE_LANG_SYSTEM), } end |