msftidy run
This commit is contained in:
parent
9cbd759eab
commit
70b463b257
|
@ -71,7 +71,7 @@ class Socket
|
||||||
res = create_tcp_client_channel( params )
|
res = create_tcp_client_channel( params )
|
||||||
end
|
end
|
||||||
elsif( params.udp? )
|
elsif( params.udp? )
|
||||||
res = create_udp_channel( params )
|
res = create_udp_channel( params )
|
||||||
end
|
end
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Stdapi < Extension
|
||||||
# can be directly referenced
|
# can be directly referenced
|
||||||
client.register_extension_aliases(
|
client.register_extension_aliases(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
'name' => 'fs',
|
'name' => 'fs',
|
||||||
'ext' => ObjectAliases.new(
|
'ext' => ObjectAliases.new(
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ class Stdapi < Extension
|
||||||
'config' => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Config.new(client),
|
'config' => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Config.new(client),
|
||||||
'socket' => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Socket.new(client)
|
'socket' => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Socket.new(client)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'railgun',
|
'name' => 'railgun',
|
||||||
'ext' => Rex::Post::Meterpreter::Extensions::Stdapi::Railgun::Railgun.new(client)
|
'ext' => Rex::Post::Meterpreter::Extensions::Stdapi::Railgun::Railgun.new(client)
|
||||||
|
@ -146,4 +146,4 @@ class Stdapi < Extension
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end; end; end; end; end
|
end; end; end; end; end
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Sys
|
||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# This class provides access to the Windows event log on the remote
|
# This class provides access to the Windows event log on the remote
|
||||||
# machine.
|
# machine.
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
@ -52,7 +52,7 @@ class EventLog
|
||||||
attr_accessor :handle # :nodoc:
|
attr_accessor :handle # :nodoc:
|
||||||
attr_accessor :client # :nodoc:
|
attr_accessor :client # :nodoc:
|
||||||
|
|
||||||
public
|
public
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initializes an instance of the eventlog manipulator.
|
# Initializes an instance of the eventlog manipulator.
|
||||||
|
@ -182,7 +182,7 @@ class EventLog
|
||||||
response = client.send_request(request, nil)
|
response = client.send_request(request, nil)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Instance method
|
# Instance method
|
||||||
def close
|
def close
|
||||||
self.class.close(self.client, self.handle)
|
self.class.close(self.client, self.handle)
|
||||||
|
|
|
@ -15,15 +15,15 @@ module EventLogSubsystem
|
||||||
###
|
###
|
||||||
class EventRecord
|
class EventRecord
|
||||||
|
|
||||||
attr_reader :num, :generated, :written, :eventid,
|
attr_reader :num, :generated, :written, :eventid
|
||||||
:type, :category, :strings, :data
|
attr_reader :type, :category, :strings, :data
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
attr_writer :num, :generated, :written, :eventid,
|
attr_writer :num, :generated, :written, :eventid
|
||||||
:type, :category, :strings, :data
|
attr_writer :type, :category, :strings, :data
|
||||||
|
|
||||||
public
|
public
|
||||||
|
|
||||||
def initialize(recnum, timegen, timewri, id, type, cat, strs, data)
|
def initialize(recnum, timegen, timewri, id, type, cat, strs, data)
|
||||||
self.num = recnum
|
self.num = recnum
|
||||||
|
@ -38,4 +38,4 @@ class EventRecord
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end end end end end end end
|
end end end end end end end
|
||||||
|
|
|
@ -22,17 +22,17 @@ class Memory
|
||||||
|
|
||||||
# Page protection translation hash
|
# Page protection translation hash
|
||||||
@@page_protection_map =
|
@@page_protection_map =
|
||||||
{
|
{
|
||||||
PROT_NONE => PAGE_NOACCESS,
|
PROT_NONE => PAGE_NOACCESS,
|
||||||
PROT_EXEC => PAGE_EXECUTE,
|
PROT_EXEC => PAGE_EXECUTE,
|
||||||
PROT_EXEC | PROT_READ => PAGE_EXECUTE_READ,
|
PROT_EXEC | PROT_READ => PAGE_EXECUTE_READ,
|
||||||
PROT_EXEC | PROT_READ |
|
PROT_EXEC | PROT_READ |
|
||||||
PROT_WRITE => PAGE_EXECUTE_READWRITE,
|
PROT_WRITE => PAGE_EXECUTE_READWRITE,
|
||||||
PROT_EXEC | PROT_READ |
|
PROT_EXEC | PROT_READ |
|
||||||
PROT_WRITE | PROT_COW => PAGE_EXECUTE_WRITECOPY,
|
PROT_WRITE | PROT_COW => PAGE_EXECUTE_WRITECOPY,
|
||||||
PROT_READ => PAGE_READONLY,
|
PROT_READ => PAGE_READONLY,
|
||||||
PROT_READ | PROT_WRITE => PAGE_READWRITE,
|
PROT_READ | PROT_WRITE => PAGE_READWRITE,
|
||||||
PROT_READ | PROT_WRITE |
|
PROT_READ | PROT_WRITE |
|
||||||
PROT_COW => PAGE_WRITECOPY,
|
PROT_COW => PAGE_WRITECOPY,
|
||||||
PROT_WRITE => PAGE_READWRITE
|
PROT_WRITE => PAGE_READWRITE
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,10 @@ class Memory
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Allocate storage of the supplied length and returns the
|
# Allocate storage of the supplied length and returns the
|
||||||
# address at which the memory was allocated.
|
# address at which the memory was allocated.
|
||||||
#
|
#
|
||||||
def allocate(length, protection = nil, base = nil)
|
def allocate(length, protection = nil, base = nil)
|
||||||
allocation_type = MEM_COMMIT
|
allocation_type = MEM_COMMIT
|
||||||
|
|
||||||
# If no protection was supplied, default to the most flexible
|
# If no protection was supplied, default to the most flexible
|
||||||
|
@ -225,7 +225,7 @@ class Memory
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Lock a region of memory into physical memory so that it can't be
|
# Lock a region of memory into physical memory so that it can't be
|
||||||
# swapped to disk. This can only be done in the context of the
|
# swapped to disk. This can only be done in the context of the
|
||||||
# process that is running the meterpreter server. The instance's
|
# process that is running the meterpreter server. The instance's
|
||||||
# handle is ignored.
|
# handle is ignored.
|
||||||
|
@ -242,7 +242,7 @@ class Memory
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Unloock a region of memory into physical memory so that it can be
|
# Unloock a region of memory into physical memory so that it can be
|
||||||
# swapped to disk. This can only be done in the context of the
|
# swapped to disk. This can only be done in the context of the
|
||||||
# process that is running the meterpreter server. The instance's
|
# process that is running the meterpreter server. The instance's
|
||||||
# handle is ignored.
|
# handle is ignored.
|
||||||
|
@ -322,7 +322,7 @@ protected
|
||||||
# Translates specific protection flags to general protection flags.
|
# Translates specific protection flags to general protection flags.
|
||||||
#
|
#
|
||||||
def specific_prot_to_gen(prot)
|
def specific_prot_to_gen(prot)
|
||||||
|
|
||||||
if (prot == nil)
|
if (prot == nil)
|
||||||
return PAGE_READONLY
|
return PAGE_READONLY
|
||||||
end
|
end
|
||||||
|
@ -333,4 +333,4 @@ protected
|
||||||
attr_accessor :process # :nodoc:
|
attr_accessor :process # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
end; end; end; end; end; end; end
|
end; end; end; end; end; end; end
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Thread
|
||||||
request.add_tlv(TLV_TYPE_CREATION_FLAGS, creation_flags)
|
request.add_tlv(TLV_TYPE_CREATION_FLAGS, creation_flags)
|
||||||
|
|
||||||
# Transmit the request
|
# Transmit the request
|
||||||
response = process.client.send_request(request)
|
response = process.client.send_request(request)
|
||||||
|
|
||||||
|
|
||||||
thread_id = response.get_tlv_value(TLV_TYPE_THREAD_ID)
|
thread_id = response.get_tlv_value(TLV_TYPE_THREAD_ID)
|
||||||
|
@ -138,4 +138,4 @@ protected
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end; end; end; end; end; end; end
|
end; end; end; end; end; end; end
|
||||||
|
|
|
@ -29,7 +29,7 @@ class RegistryKey
|
||||||
self.base_key = base_key
|
self.base_key = base_key
|
||||||
self.perm = perm
|
self.perm = perm
|
||||||
self.hkey = hkey
|
self.hkey = hkey
|
||||||
|
|
||||||
ObjectSpace.define_finalizer( self, self.class.finalize(self.client, self.hkey) )
|
ObjectSpace.define_finalizer( self, self.class.finalize(self.client, self.hkey) )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -110,9 +110,9 @@ class RegistryKey
|
||||||
return client.sys.registry.close_key(hkey)
|
return client.sys.registry.close_key(hkey)
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Instance method for the same
|
# Instance method for the same
|
||||||
def close()
|
def close()
|
||||||
self.class.close(self.client, self.hkey)
|
self.class.close(self.client, self.hkey)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class RegistryValue
|
||||||
self.name = name
|
self.name = name
|
||||||
self.type = type
|
self.type = type
|
||||||
self.data = data
|
self.data = data
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sets the value's data.
|
# Sets the value's data.
|
||||||
|
@ -99,4 +99,4 @@ protected
|
||||||
attr_writer :hkey, :name, :type, :data # :nodoc:
|
attr_writer :hkey, :name, :type, :data # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
end; end; end; end; end; end; end
|
end; end; end; end; end; end; end
|
||||||
|
|
|
@ -28,7 +28,7 @@ class RemoteRegistryKey
|
||||||
self.root_key = root_key
|
self.root_key = root_key
|
||||||
self.target_host = target_host
|
self.target_host = target_host
|
||||||
self.hkey = hkey
|
self.hkey = hkey
|
||||||
|
|
||||||
ObjectSpace.define_finalizer( self, self.class.finalize(self.client, self.hkey) )
|
ObjectSpace.define_finalizer( self, self.class.finalize(self.client, self.hkey) )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,9 +109,9 @@ class RemoteRegistryKey
|
||||||
return client.sys.registry.close_key(hkey)
|
return client.sys.registry.close_key(hkey)
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Instance method for the same
|
# Instance method for the same
|
||||||
def close()
|
def close()
|
||||||
self.class.close(self.client, self.hkey)
|
self.class.close(self.client, self.hkey)
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Sys
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
# This class implements the Rex::Post::Thread interface which
|
# This class implements the Rex::Post::Thread interface which
|
||||||
# wrappers a logical thread for a given process.
|
# wrappers a logical thread for a given process.
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
@ -123,7 +123,7 @@ class Thread < Rex::Post::Thread
|
||||||
# Add all of the register that we're setting
|
# Add all of the register that we're setting
|
||||||
regs_hash.each_key { |name|
|
regs_hash.each_key { |name|
|
||||||
t = request.add_tlv(TLV_TYPE_REGISTER)
|
t = request.add_tlv(TLV_TYPE_REGISTER)
|
||||||
|
|
||||||
t.add_tlv(TLV_TYPE_REGISTER_NAME, name)
|
t.add_tlv(TLV_TYPE_REGISTER_NAME, name)
|
||||||
t.add_tlv(TLV_TYPE_REGISTER_VALUE_32, regs_hash[name])
|
t.add_tlv(TLV_TYPE_REGISTER_VALUE_32, regs_hash[name])
|
||||||
}
|
}
|
||||||
|
@ -139,13 +139,13 @@ class Thread < Rex::Post::Thread
|
||||||
def pretty_regs
|
def pretty_regs
|
||||||
regs = query_regs
|
regs = query_regs
|
||||||
|
|
||||||
buf = sprintf("eax=%.8x ebx=%.8x ecx=%.8x edx=%.8x esi=%.8x edi=%.8x\n",
|
buf = sprintf("eax=%.8x ebx=%.8x ecx=%.8x edx=%.8x esi=%.8x edi=%.8x\n",
|
||||||
regs['eax'], regs['ebx'], regs['ecx'], regs['edx'], regs['esi'], regs['edi'])
|
regs['eax'], regs['ebx'], regs['ecx'], regs['edx'], regs['esi'], regs['edi'])
|
||||||
buf += sprintf("eip=%.8x esp=%.8x ebp=%.8x\n",
|
buf += sprintf("eip=%.8x esp=%.8x ebp=%.8x\n",
|
||||||
regs['eip'], regs['esp'], regs['ebp'])
|
regs['eip'], regs['esp'], regs['ebp'])
|
||||||
buf += sprintf("cs=%.4x ss=%.4x ds=%.4x es=%.4x fs=%.4x gs=%.4x\n",
|
buf += sprintf("cs=%.4x ss=%.4x ds=%.4x es=%.4x fs=%.4x gs=%.4x\n",
|
||||||
regs['cs'], regs['ss'], regs['ds'], regs['es'], regs['fs'], regs['gs'])
|
regs['cs'], regs['ss'], regs['ds'], regs['es'], regs['fs'], regs['gs'])
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -165,14 +165,14 @@ class Thread < Rex::Post::Thread
|
||||||
handle = nil
|
handle = nil
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Instance method
|
# Instance method
|
||||||
def close
|
def close
|
||||||
self.class.close(self.process.client, self.handle)
|
self.class.close(self.process.client, self.handle)
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :process, :handle, :tid # :nodoc:
|
attr_reader :process, :handle, :tid # :nodoc:
|
||||||
protected
|
protected
|
||||||
attr_writer :process, :handle, :tid # :nodoc:
|
attr_writer :process, :handle, :tid # :nodoc:
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue