Skip to content

Commit 1b50419

Browse files
committed
Check equality instead of regex
Thanks, @Meatballs1 for finding the cause of this bug! [FixRM rapid7#8149]
1 parent 60a7ad5 commit 1b50419

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

.yardopts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
--exclude \.ut\.rb/
44
--exclude \.ts\.rb/
55
--files CONTRIBUTING.md,COPYING,HACKING,LICENSE
6-
lib/msf/**/*.rb
7-
lib/rex/**/*.rb
6+
#lib/msf/**/*.rb
7+
#lib/rex/**/*.rb

lib/msf/util/exe.rb

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,22 +1959,17 @@ def self.to_executable_fmt(framework, arch, plat, code, fmt, exeopts)
19591959
output = Msf::Util::EXE.to_win32pe_aspx(framework, code, exeopts)
19601960

19611961
when 'dll'
1962-
if (not arch or (arch.index(ARCH_X86)))
1963-
output = Msf::Util::EXE.to_win32pe_dll(framework, code, exeopts)
1964-
end
1965-
1966-
if(arch and (arch.index( ARCH_X86_64 ) or arch.index( ARCH_X64 )))
1967-
output = Msf::Util::EXE.to_win64pe_dll(framework, code, exeopts)
1968-
end
1969-
1962+
output = case arch
1963+
when ARCH_X86,nil then to_win32pe_dll(framework, code, exeopts)
1964+
when ARCH_X86_64 then to_win64pe_dll(framework, code, exeopts)
1965+
when ARCH_64 then to_win64pe_dll(framework, code, exeopts)
1966+
end
19701967
when 'exe'
1971-
if (not arch or (arch.index(ARCH_X86)))
1972-
output = Msf::Util::EXE.to_win32pe(framework, code, exeopts)
1973-
end
1974-
1975-
if(arch and (arch.index( ARCH_X86_64 ) or arch.index( ARCH_X64 )))
1976-
output = Msf::Util::EXE.to_win64pe(framework, code, exeopts)
1977-
end
1968+
output = case arch
1969+
when ARCH_X86,nil then to_win32pe(framework, code, exeopts)
1970+
when ARCH_X86_64 then to_win64pe(framework, code, exeopts)
1971+
when ARCH_64 then to_win64pe(framework, code, exeopts)
1972+
end
19781973

19791974
when 'exe-small'
19801975
if(not arch or (arch.index(ARCH_X86)))
@@ -2010,11 +2005,6 @@ def self.to_executable_fmt(framework, arch, plat, code, fmt, exeopts)
20102005
end
20112006
end
20122007

2013-
# this should really be 'jar'
2014-
when 'java'
2015-
2016-
2017-
20182008
when 'macho'
20192009
output = case arch
20202010
when ARCH_X86,nil then to_osx_x86_macho(framework, code, exeopts)

spec/support/shared/contexts/msf/util/exe.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{ :format => "dll", :arch => "x64", :file_fp => /PE32\+.*DLL/ },
88
{ :format => "exe", :arch => "x86", :file_fp => /PE32 / },
99
{ :format => "exe", :arch => "x64", :file_fp => /PE32\+/ },
10+
{ :format => "exe", :arch => "x86_64", :file_fp => /PE32\+/ },
1011
{ :format => "exe-small", :arch => "x86", :file_fp => /PE32 / },
1112
# No template for 64-bit exe-small. That's fine, we probably
1213
# don't need one.

0 commit comments

Comments
 (0)