Class: Rex::Post::Meterpreter::Extensions::Stdapi::Railgun::LibraryFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.rb

Overview

represents one function, e.g. MessageBoxW

Constant Summary collapse

@@allowed_datatypes =
{
  'VOID'       => ['return'],
  'BOOL'       => ['in', 'return'],
  'BYTE'       => ['in', 'return'],
  'WORD'       => ['in', 'return'],
  'DWORD'      => ['in', 'return'],
  'LPVOID'     => ['in', 'return'], # sf: for specifying a memory address (e.g. VirtualAlloc/HeapAlloc/...) where we don't want to back it up with actual mem ala PBLOB
  'ULONG_PTR'  => ['in', 'return'],
  'PDWORD'     => ['in', 'out', 'inout'], # todo: support for functions that return pointers to strings
  'PULONG_PTR' => ['in', 'out', 'inout', 'return'],
  'PWCHAR'     => ['in', 'out', 'inout', 'return'],
  'PCHAR'      => ['in', 'out', 'inout', 'return'],
  'PBLOB'      => ['in', 'out', 'inout'],
}.freeze
@@allowed_convs =
['stdcall', 'cdecl']
@@directions =
['in', 'out', 'inout', 'return'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(return_type, params, remote_name, calling_conv = 'stdcall') ⇒ LibraryFunction

Returns a new instance of LibraryFunction.



58
59
60
61
62
63
64
65
66
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.rb', line 58

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
  @remote_name = remote_name
  @calling_conv = calling_conv
end

Instance Attribute Details

#calling_convObject (readonly)

Returns the value of attribute calling_conv.



56
57
58
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.rb', line 56

def calling_conv
  @calling_conv
end

#paramsObject (readonly)

Returns the value of attribute params.



56
57
58
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.rb', line 56

def params
  @params
end

#remote_nameObject (readonly)

Returns the value of attribute remote_name.



56
57
58
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.rb', line 56

def remote_name
  @remote_name
end

#return_typeObject (readonly)

Returns the value of attribute return_type.



56
57
58
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.rb', line 56

def return_type
  @return_type
end