Make the railgun def class names platform specific

bug/bundler_fix
Spencer McIntyre 2017-06-26 19:53:19 -04:00
parent feb8d14fe6
commit ea83cb0bb6
17 changed files with 39 additions and 29 deletions

View File

@ -7,12 +7,12 @@ module Stdapi
module Railgun
module Def
class Def_libc
class Def_linux_libc
def self.create_dll(constant_manager, dll_path = 'libc.so.6')
dll = DLL.new(dll_path, constant_manager)
lib = DLL.new(dll_path, constant_manager)
dll.add_function(
lib.add_function(
'calloc',
'LPVOID',
[
@ -22,7 +22,7 @@ class Def_libc
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'free',
'VOID',
[
@ -31,14 +31,14 @@ class Def_libc
nil,
'cdecl',
)
dll.add_function(
lib.add_function(
'getpid',
'DWORD',
[],
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'inet_ntop',
'LPVOID',
[
@ -50,7 +50,7 @@ class Def_libc
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'inet_pton',
'DWORD',
[
@ -61,14 +61,14 @@ class Def_libc
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'malloc',
'LPVOID',
[['SIZE_T', 'size', 'in']],
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'memfrob',
'LPVOID',
[
@ -78,7 +78,7 @@ class Def_libc
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'mmap',
'LPVOID',
[
@ -92,7 +92,7 @@ class Def_libc
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'mprotect',
'DWORD',
[
@ -103,7 +103,7 @@ class Def_libc
nil,
'cdecl'
)
dll.add_function(
lib.add_function(
'munmap',
'DWORD',
[
@ -113,7 +113,17 @@ class Def_libc
nil,
'cdecl'
)
return dll
lib.add_function(
'strcat',
'LPVOID',
[
['PCHAR', 'to', 'inout'],
['PCHAR', 'from', 'in']
],
nil,
'cdecl'
)
return lib
end
end

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_libc
class Def_osx_libc
def self.create_dll(constant_manager, dll_path = 'libc.dylib')
lib = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_libobjc
class Def_osx_libobjc
def self.create_dll(constant_manager, dll_path = 'libobjc.dylib')
lib = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_advapi32
class Def_windows_advapi32
CREDENTIAL = [
[:Flags, :DWORD],

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_crypt32
class Def_windows_crypt32
def self.create_dll(constant_manager, dll_path = 'crypt32')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_iphlpapi
class Def_windows_iphlpapi
def self.create_dll(constant_manager, dll_path = 'iphlpapi')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_kernel32
class Def_windows_kernel32
def self.create_dll(constant_manager, dll_path = 'kernel32')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_netapi32
class Def_windows_netapi32
def self.create_dll(constant_manager, dll_path = 'netapi32')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_ntdll
class Def_windows_ntdll
def self.create_dll(constant_manager, dll_path = 'ntdll')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_psapi
class Def_windows_psapi
def self.create_dll(constant_manager, dll_path = 'psapi')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_shell32
class Def_windows_shell32
def self.create_dll(constant_manager, dll_path = 'shell32')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_user32
class Def_windows_user32
def self.create_dll(constant_manager, dll_path = 'user32')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_version
class Def_windows_version
def self.create_dll(constant_manager, dll_path = 'version')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_wlanapi
class Def_windows_wlanapi
def self.create_dll(constant_manager, dll_path = 'wlanapi')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_wldap32
class Def_windows_wldap32
def self.create_dll(constant_manager, dll_path = 'wldap32')
dll = DLL.new(dll_path, constant_manager)

View File

@ -7,7 +7,7 @@ module Stdapi
module Railgun
module Def
class Def_ws2_32
class Def_windows_ws2_32
def self.create_dll(constant_manager, dll_path = 'ws2_32')
dll = DLL.new(dll_path, constant_manager)

View File

@ -267,7 +267,7 @@ class Railgun
end
require "rex/post/meterpreter/extensions/stdapi/railgun/def/#{client.platform}/def_#{dll_name}"
dll = Def.const_get('Def_' << dll_name).create_dll(constant_manager).freeze
dll = Def.const_get("Def_#{client.platform}_#{dll_name}").create_dll(constant_manager).freeze
@@cached_dlls[dll_name] = dll
dlls[dll_name] = dll