class Rex::Post::Meterpreter::Extensions::Stdapi::Railgun::DLLFunction
represents one function, e.g. MessageBoxW
Attributes
calling_conv[R]
params[R]
return_type[R]
windows_name[R]
Public Class Methods
new(return_type, params, windows_name, calling_conv="stdcall")
click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb, line 56 def initialize(return_type, params, windows_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 @calling_conv = calling_conv end
Private Instance Methods
check_calling_conv(conv)
click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb, line 68 def check_calling_conv(conv) if not @@allowed_convs.include?(conv) raise ArgumentError, "Calling convention unknown: #{conv}." end end
check_params(params)
click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb, line 87 def check_params (params) params.each do |param| raise ArgumentError, "each param must be descriped by a three-tuple [type,name,direction]" unless param.length == 3 type = param[0] direction = param[2] # Assert a valid type check_type_exists(type) # Only our set of predefined directions are valid unless @@directions.include?(direction) raise ArgumentError, "invalid direction: #{direction}" end # 'return' is not a valid direction in this context unless direction != "return" raise "direction 'return' is only for the return value of the function." end end end
check_return_type(type)
click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb, line 80 def check_return_type (type) check_type_exists(type) if not @@allowed_datatypes[type].include?("return") raise ArgumentError, "#{type} is not allowed as a return type" end end
check_type_exists(type)
click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb, line 74 def check_type_exists (type) if not @@allowed_datatypes.has_key?(type) raise ArgumentError, "Type unknown: #{type}. Allowed types: #{PP.pp(@@allowed_datatypes.keys, "")}" end end