diff --git a/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/platform_util.rb b/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/platform_util.rb new file mode 100644 index 0000000000..f9e426325b --- /dev/null +++ b/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/platform_util.rb @@ -0,0 +1,25 @@ + +module Rex +module Post +module Meterpreter +module Extensions +module Stdapi +module Railgun +module Type +module PlatformUtil + + X86_64 = :x86_64 + X86_32 = :x86_32 + + def self.parse_client_platform(meterp_client_platform) + meterp_client_platform =~ /win64/ ? X86_64 : X86_32 + end + +end # PlatformUtil +end # Type +end # Railgun +end # Stdapi +end # Extensions +end # Meterpreter +end # Post +end # Rex diff --git a/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/platform_util.rb.ut.rb b/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/platform_util.rb.ut.rb new file mode 100644 index 0000000000..af97716231 --- /dev/null +++ b/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/platform_util.rb.ut.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby + +$:.unshift(File.join(File.dirname(__FILE__), '..', '..','..','..','..','..', '..', '..', 'lib')) + +require 'rex/post/meterpreter/extensions/stdapi/railgun/type/platform_util' +require 'rex/post/meterpreter/extensions/stdapi/railgun/mock_magic' +require 'test/unit' + +module Rex +module Post +module Meterpreter +module Extensions +module Stdapi +module Railgun +module Type +class PlatformUtil::UnitTest < Test::Unit::TestCase + def test_parse_client_platform + assert_equal(PlatformUtil.parse_client_platform('x86/win32'), PlatformUtil::X86_32, + 'parse_client_platform should translate Win32 client platforms') + assert_equal(PlatformUtil.parse_client_platform('x86/win64'), PlatformUtil::X86_64, + 'parse_client_platform should translate Win64 client platforms') + end +end +end +end +end +end +end +end +end