Skip to content

Commit daf8833

Browse files
committed
Refactor a bunch of windows_name references
1 parent 3cc089b commit daf8833

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,19 @@ def call_function(func_symbol, args, client)
9999
# ["DWORD","uType","in"],
100100
# ])
101101
#
102-
# Use +windows_name+ when the actual windows name is different from the
102+
# Use +remote_name+ when the actual library name is different from the
103103
# ruby variable. You might need to do this for example when the actual
104104
# func name is myFunc@4 or when you want to create an alternative version
105105
# of an existing function.
106106
#
107107
# When the new function is called it will return a list containing the
108108
# return value and all inout params. See #call_function.
109109
#
110-
def add_function(name, return_type, params, windows_name=nil, calling_conv="stdcall")
111-
if windows_name == nil
112-
windows_name = name
110+
def add_function(name, return_type, params, remote_name=nil, calling_conv="stdcall")
111+
if remote_name == nil
112+
remote_name = name
113113
end
114-
@functions[name] = DLLFunction.new(return_type, params, windows_name, calling_conv)
114+
@functions[name] = DLLFunction.new(return_type, params, remote_name, calling_conv)
115115
end
116116

117117
private
@@ -125,8 +125,6 @@ def process_function_call(function, args, client)
125125
native = 'V'
126126
end
127127

128-
#puts "process_function_call(function.windows_name,#{PP.pp(args, "")})"
129-
130128
# We transmit the immediate stack and three heap-buffers:
131129
# in, inout and out. The reason behind the separation is bandwidth.
132130
# We don't want to transmit uninitialized data in or no-longer-needed data out.
@@ -261,8 +259,8 @@ def process_function_call(function, args, client)
261259
request.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_IN, in_only_buffer)
262260
request.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_INOUT, inout_buffer)
263261

264-
request.add_tlv(TLV_TYPE_RAILGUN_DLLNAME, @dll_path )
265-
request.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.windows_name)
262+
request.add_tlv(TLV_TYPE_RAILGUN_DLLNAME, @dll_path)
263+
request.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.remote_name)
266264
request.add_tlv(TLV_TYPE_RAILGUN_CALLCONV, function.calling_conv)
267265

268266
response = client.send_request(request)
@@ -368,7 +366,7 @@ def process_function_call(function, args, client)
368366
#=== START of proccess_function_call snapshot ===
369367
# {
370368
# :platform => '#{native == 'Q' ? 'x64/windows' : 'x86/windows'}',
371-
# :name => '#{function.windows_name}',
369+
# :name => '#{function.remote_name}',
372370
# :params => #{function.params},
373371
# :return_type => '#{function.return_type}',
374372
# :dll_name => '#{@dll_path}',
@@ -379,7 +377,7 @@ def process_function_call(function, args, client)
379377
# TLV_TYPE_RAILGUN_BUFFERBLOB_IN => #{in_only_buffer.inspect},
380378
# TLV_TYPE_RAILGUN_BUFFERBLOB_INOUT => #{inout_buffer.inspect},
381379
# TLV_TYPE_RAILGUN_DLLNAME => '#{@dll_path}',
382-
# TLV_TYPE_RAILGUN_FUNCNAME => '#{function.windows_name}',
380+
# TLV_TYPE_RAILGUN_FUNCNAME => '#{function.remote_name}',
383381
# },
384382
# :response_from_client => {
385383
# TLV_TYPE_RAILGUN_BACK_BUFFERBLOB_INOUT => #{rec_inout_buffers.inspect},

lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ class DLLFunction
5353

5454
@@directions = ["in", "out", "inout", "return"].freeze
5555

56-
attr_reader :return_type, :params, :windows_name, :calling_conv
56+
attr_reader :return_type, :params, :remote_name, :calling_conv
5757

58-
def initialize(return_type, params, windows_name, calling_conv="stdcall")
58+
def initialize(return_type, params, remote_name, calling_conv="stdcall")
5959
check_return_type(return_type) # we do error checking as early as possible so the library is easier to use
6060
check_params(params)
6161
check_calling_conv(calling_conv)
6262
@return_type = return_type
6363
@params = params
64-
@windows_name = windows_name
64+
@remote_name = remote_name
6565
@calling_conv = calling_conv
6666
end
6767

lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def call(functions)
7575
end
7676

7777
raise "#{function.params.length} arguments expected. #{args.length} arguments provided." unless args.length == function.params.length
78-
#puts "process_function_call(function.windows_name,#{PP.pp(args, "")})"
7978

8079
# We transmit the immediate stack and three heap-buffers:
8180
# in, inout and out. The reason behind the separation is bandwidth.
@@ -210,7 +209,7 @@ def call(functions)
210209
group.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_IN, in_only_buffer)
211210
group.add_tlv(TLV_TYPE_RAILGUN_BUFFERBLOB_INOUT, inout_buffer)
212211
group.add_tlv(TLV_TYPE_RAILGUN_DLLNAME, dll_host.dll_path)
213-
group.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.windows_name)
212+
group.add_tlv(TLV_TYPE_RAILGUN_FUNCNAME, function.remote_name)
214213
request.tlvs << group
215214

216215
layouts << [inout_layout, out_only_layout]

0 commit comments

Comments
 (0)