This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
/
Copy pathmetasploit-framework.rb
137 lines (125 loc) · 5.45 KB
/
metasploit-framework.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
require "formula"
class MetasploitFramework < Formula
homepage "https://github.com/rapid7/metasploit-framework"
head "https://github.com/rapid7/metasploit-framework", :using => :git, :branch => '4.x'
url "https://github.com/rapid7/metasploit-framework", :using => :git, :tag => '4.16.56'
version "4.16.56"
option "with-oracle", "Build with oracle support. Requires Instant Client software, see https://github.com/InstantClientTap/homebrew-instantclient"
depends_on "[email protected]"
depends_on "openssl"
depends_on "libxml2"
depends_on "libxslt"
depends_on "sqlite"
depends_on "[email protected]"
# Combatability matrix: https://mikedietrichde.com/2017/02/17/client-certification-for-oracle-database-12-1-0-212-2-0-1/
depends_on 'instantclient-basic' if build.with? 'oracle' # for ruby-oci8
depends_on 'instantclient-sdk' if build.with? 'oracle' # for ruby-oci8
depends_on 'instantclient-sqlplus' if build.with? 'oracle' # for ruby-oci8
depends_on "gmp" if build.with? 'oracle' # for ruby-oci8
resource "bundler" do
url "https://rubygems.org/downloads/bundler-1.15.1.gem"
sha256 "fa6ec48f94faffe4987f89b4b85409fd6a4ddce8d46f779acdc26d041eb200d7"
end
def install
(buildpath/"vendor/bundle").mkpath
resources.each do |r|
r.verify_download_integrity(r.fetch)
system("#{HOMEBREW_PREFIX}/opt/[email protected]/bin/gem", "install", r.cached_download, "--no-document",
"--install-dir", "vendor/bundle")
end
ENV["GEM_HOME"] = "#{buildpath}/vendor/bundle"
system "#{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby", "#{buildpath}/vendor/bundle/bin/bundle", "install",
"--no-cache", "--path", "vendor/bundle"
if build.with? "oracle"
(buildpath/"Gemfile.local").write <<~EOS
group :local do
gem 'ruby-oci8', '~> 2.2.3'
end
EOS
(buildpath/"Gemfile.local.lock").write <<~EOS
GEM
remote: https://rubygems.org/
specs:
ruby-oci8 (2.2.3)
PLATFORMS
ruby
DEPENDENCIES
ruby-oci8 (~> 2.2.3)
BUNDLED WITH
1.11.2
EOS
system "#{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby", "#{buildpath}/vendor/bundle/bin/bundle", "install",
"--deployment", "--gemfile", "Gemfile.local", "--no-cache",
"--path", "vendor/bundle"
end
(bin/"msfbinscan").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfbinscan "$@"
EOS
(bin/"msfconsole").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfconsole "$@"
EOS
(bin/"msfd").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfd "$@"
EOS
(bin/"msfelfscan").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfelfscan "$@"
EOS
(bin/"msfmachscan").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfmachscan "$@"
EOS
(bin/"msfpescan").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfpescan "$@"
EOS
(bin/"msfrop").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfrop "$@"
EOS
(bin/"msfrpc").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfrpc "$@"
EOS
(bin/"msfrpcd").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfrpcd "$@"
EOS
#(bin/"msfupdate").write <<~EOS
# #!/usr/bin/env bash
# export GEM_HOME="#{pkgshare}/vendor/bundle"
# export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
# #{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfupdate "$@"
#EOS
(bin/"msfvenom").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{pkgshare}/vendor/bundle"
export BUNDLE_GEMFILE="#{pkgshare}/Gemfile"
#{pkgshare}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/[email protected]/bin/ruby #{pkgshare}/msfvenom "$@"
EOS
pkgshare.install Dir['*']
pkgshare.install ".git"
pkgshare.install ".bundle"
end
end