Parent

Class/Module Index [+]

Quicksearch

Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Config

This class provides access to remote system configuration and information.

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb, line 22
def initialize(client)
        self.client = client
end

Public Instance Methods

drop_token() click to toggle source

Drops any assumed token

# File lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb, line 70
def drop_token
        req = Packet.create_request('stdapi_sys_config_drop_token')
        res = client.send_request(req)
        return client.unicode_filter_encode( res.get_tlv_value(TLV_TYPE_USER_NAME) )
end
getprivs() click to toggle source

Enables all possible privileges

# File lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb, line 79
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() click to toggle source

Returns the username that the remote side is running as.

# File lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb, line 29
def getuid
        request  = Packet.create_request('stdapi_sys_config_getuid')
        response = client.send_request(request)
        return client.unicode_filter_encode( response.get_tlv_value(TLV_TYPE_USER_NAME) )
end
revert_to_self() click to toggle source

Calls RevertToSelf on the remote machine.

# File lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb, line 53
def revert_to_self
        client.send_request(Packet.create_request('stdapi_sys_config_rev2self'))
end
steal_token(pid) click to toggle source

Steals the primary token from a target process

# File lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb, line 60
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 client.unicode_filter_encode( res.get_tlv_value(TLV_TYPE_USER_NAME) )
end
sysinfo() click to toggle source

Returns a hash of information about the remote computer.

# File lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb, line 38
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

[Validate]

Generated with the Darkfish Rdoc Generator 2.