Skip to content

Commit 60a7ad5

Browse files
committed
Derp, missed file
1 parent d10f082 commit 60a7ad5

File tree

1 file changed

+49
-0
lines changed
  • spec/support/shared/contexts/msf/util

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
3+
shared_context 'Msf::Util::Exe' do
4+
@platform_format_map = {
5+
"windows" => [
6+
{ :format => "dll", :arch => "x86", :file_fp => /PE32 .*DLL/ },
7+
{ :format => "dll", :arch => "x64", :file_fp => /PE32\+.*DLL/ },
8+
{ :format => "exe", :arch => "x86", :file_fp => /PE32 / },
9+
{ :format => "exe", :arch => "x64", :file_fp => /PE32\+/ },
10+
{ :format => "exe-small", :arch => "x86", :file_fp => /PE32 / },
11+
# No template for 64-bit exe-small. That's fine, we probably
12+
# don't need one.
13+
#{ :format => "exe-small", :arch => "x64", :file_fp => /PE32\+/ },
14+
{ :format => "exe-only", :arch => "x86", :file_fp => /PE32 / },
15+
{ :format => "exe-only", :arch => "x64", :file_fp => /PE32\+ / },
16+
],
17+
"linux" => [
18+
{ :format => "elf", :arch => "x86", :file_fp => /ELF 32.*SYSV/ },
19+
{ :format => "elf", :arch => "x64", :file_fp => /ELF 64.*SYSV/ },
20+
{ :format => "elf", :arch => "armle", :file_fp => /ELF 32.*ARM/ },
21+
{ :format => "elf", :arch => "mipsbe", :file_fp => /ELF 32-bit MSB executable, MIPS/ },
22+
{ :format => "elf", :arch => "mipsle", :file_fp => /ELF 32-bit LSB executable, MIPS/ },
23+
],
24+
"bsd" => [
25+
{ :format => "elf", :arch => "x86", :file_fp => /ELF 32.*BSD/ },
26+
],
27+
"solaris" => [
28+
{ :format => "elf", :arch => "x86", :file_fp => /ELF 32/ },
29+
],
30+
"osx" => [
31+
{ :format => "macho", :arch => "x86", :file_fp => /Mach-O.*i386/ },
32+
{ :format => "macho", :arch => "x64", :file_fp => /Mach-O 64/ },
33+
{ :format => "macho", :arch => "armle", :file_fp => /Mach-O.*acorn/ },
34+
{ :format => "macho", :arch => "ppc", :file_fp => /Mach-O.*ppc/ },
35+
],
36+
}
37+
38+
def verify_bin_fingerprint(format_hash, bin)
39+
bin.should be_a(String)
40+
fp = IO.popen("file -","w+") do |io|
41+
io.write(bin)
42+
io.close_write
43+
io.read
44+
end
45+
if format_hash[:file_fp]
46+
fp.should =~ format_hash[:file_fp]
47+
end
48+
end
49+
end

0 commit comments

Comments
 (0)