1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00

Refactor a bunch of windows_name references

This commit is contained in:
Spencer McIntyre 2017-04-24 19:54:00 -04:00
parent 3cc089bcef
commit daf8833174
3 changed files with 13 additions and 16 deletions

View File

@ -99,7 +99,7 @@ class DLL
# ["DWORD","uType","in"],
# ])
#
# Use +windows_name+ when the actual windows name is different from the
# Use +remote_name+ when the actual library name is different from the
# ruby variable. You might need to do this for example when the actual
# func name is myFunc@4 or when you want to create an alternative version
# of an existing function.
@ -107,11 +107,11 @@ class DLL
# When the new function is called it will return a list containing the
# return value and all inout params. See #call_function.
#
def add_function(name, return_type, params, windows_name=nil, calling_conv="stdcall")
if windows_name == nil
windows_name = name
def add_function(name, return_type, params, remote_name=nil, calling_conv="stdcall")
if remote_name == nil
remote_name = name
end
@functions[name] = DLLFunction.new(return_type, params, windows_name, calling_conv)
@functions[name] = DLLFunction.new(return_type, params, remote_name, calling_conv)
end
private
@ -125,8 +125,6 @@ class DLL
native = 'V'
end
#puts "process_function_call(function.windows_name,#{PP.pp(args, "")})"
# We transmit the immediate stack and three heap-buffers:
# in, inout and out. The reason behind the separation is bandwidth.
# We don't want to transmit uninitialized data in or no-longer-needed data out.
@ -261,8 +259,8 @@ class DLL
request.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_IN, in_only_buffer)
request.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_INOUT, inout_buffer)
request.add_tlv(TLV_TYPE_RAILGUN_DLLNAME, @dll_path )
request.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.windows_name)
request.add_tlv(TLV_TYPE_RAILGUN_DLLNAME, @dll_path)
request.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.remote_name)
request.add_tlv(TLV_TYPE_RAILGUN_CALLCONV, function.calling_conv)
response = client.send_request(request)
@ -368,7 +366,7 @@ class DLL
#=== START of proccess_function_call snapshot ===
# {
# :platform => '#{native == 'Q' ? 'x64/windows' : 'x86/windows'}',
# :name => '#{function.windows_name}',
# :name => '#{function.remote_name}',
# :params => #{function.params},
# :return_type => '#{function.return_type}',
# :dll_name => '#{@dll_path}',
@ -379,7 +377,7 @@ class DLL
# TLV_TYPE_RAILGUN_BUFFERBLOB_IN => #{in_only_buffer.inspect},
# TLV_TYPE_RAILGUN_BUFFERBLOB_INOUT => #{inout_buffer.inspect},
# TLV_TYPE_RAILGUN_DLLNAME => '#{@dll_path}',
# TLV_TYPE_RAILGUN_FUNCNAME => '#{function.windows_name}',
# TLV_TYPE_RAILGUN_FUNCNAME => '#{function.remote_name}',
# },
# :response_from_client => {
# TLV_TYPE_RAILGUN_BACK_BUFFERBLOB_INOUT => #{rec_inout_buffers.inspect},

View File

@ -53,15 +53,15 @@ class DLLFunction
@@directions = ["in", "out", "inout", "return"].freeze
attr_reader :return_type, :params, :windows_name, :calling_conv
attr_reader :return_type, :params, :remote_name, :calling_conv
def initialize(return_type, params, windows_name, calling_conv="stdcall")
def initialize(return_type, params, remote_name, calling_conv="stdcall")
check_return_type(return_type) # we do error checking as early as possible so the library is easier to use
check_params(params)
check_calling_conv(calling_conv)
@return_type = return_type
@params = params
@windows_name = windows_name
@remote_name = remote_name
@calling_conv = calling_conv
end

View File

@ -75,7 +75,6 @@ class MultiCaller
end
raise "#{function.params.length} arguments expected. #{args.length} arguments provided." unless args.length == function.params.length
#puts "process_function_call(function.windows_name,#{PP.pp(args, "")})"
# We transmit the immediate stack and three heap-buffers:
# in, inout and out. The reason behind the separation is bandwidth.
@ -210,7 +209,7 @@ class MultiCaller
group.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_IN, in_only_buffer)
group.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_INOUT, inout_buffer)
group.add_tlv(TLV_TYPE_RAILGUN_DLLNAME, dll_host.dll_path)
group.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.windows_name)
group.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.remote_name)
request.tlvs << group
layouts << [inout_layout, out_only_layout]