Gentoo Archives: gentoo-commits

From: Richard Farina <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/metasploit/
Date: Tue, 26 Jan 2016 19:47:42
Message-Id: 1453837315.b34b41e7e7d0acf60d7316aeadd4ddd28fa1f0b3.zerochaos@gentoo
1 commit: b34b41e7e7d0acf60d7316aeadd4ddd28fa1f0b3
2 Author: Zero_Chaos <zerochaos <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 26 19:33:51 2016 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 26 19:41:55 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b34b41e7
7
8 net-analyzer/metasploit: some updates for live ebuild
9
10 Package-Manager: portage-2.2.27
11
12 net-analyzer/metasploit/Manifest | 1 -
13 .../metasploit-4.11.4_p2015090201-r2.ebuild | 297 ---------------------
14 net-analyzer/metasploit/metasploit-9999.ebuild | 9 +-
15 3 files changed, 3 insertions(+), 304 deletions(-)
16
17 diff --git a/net-analyzer/metasploit/Manifest b/net-analyzer/metasploit/Manifest
18 index a9e8035..2378313 100644
19 --- a/net-analyzer/metasploit/Manifest
20 +++ b/net-analyzer/metasploit/Manifest
21 @@ -1,2 +1 @@
22 -DIST metasploit-4.11.4_p2015090201.tar.gz 35211994 SHA256 1254dbb3e8cf33c7a6c8c701a0be13f78bbd2234503e636f1afacf88676aeea2 SHA512 b96c9735ef579b5f98d1fd7176f91bb1710d263a19d3ff891877df8e341baa1749d5fdce9825a19d9ecbe162b72ebcd11336d4d7884e066f4e199baaff8b4085 WHIRLPOOL 875db5df25112736dd62ec1195080d2567a670cf3a770e787b70c364c6b30b43bf906f7ba35901ff367ce940b02af7b17ae135693a28ff5fca9fc05038132ae2
23 DIST metasploit-4.11.5_p2015110401.tar.gz 35426390 SHA256 fd8ef85a1d935245892c618001d1f992d6be16baa449a61c358b64a306ec249c SHA512 57e6d09546b219023a2f0c5920f143cbda1736c274004e16533693bc25d4f3fc35458c0ddecc1d552e0db575a41a7c7dab5db0dd1fa14d48e8fd66dbf6c9a94c WHIRLPOOL 1c3e2683598f25ce89904c5d0e9e3cf85820a6f09a06ef6e62207cdd30fe48e793012391b44c82131bacf05fce62f0093704d193769ab86ea40b9577543980f1
24
25 diff --git a/net-analyzer/metasploit/metasploit-4.11.4_p2015090201-r2.ebuild b/net-analyzer/metasploit/metasploit-4.11.4_p2015090201-r2.ebuild
26 deleted file mode 100644
27 index 3756f98..0000000
28 --- a/net-analyzer/metasploit/metasploit-4.11.4_p2015090201-r2.ebuild
29 +++ /dev/null
30 @@ -1,297 +0,0 @@
31 -# Copyright 1999-2015 Gentoo Foundation
32 -# Distributed under the terms of the GNU General Public License v2
33 -# $Id$
34 -
35 -EAPI="5"
36 -
37 -#never ever ever have more than one ruby in here
38 -USE_RUBY="ruby21"
39 -inherit eutils ruby-ng
40 -
41 -if [[ ${PV} == "9999" ]] ; then
42 - EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
43 - EGIT_CHECKOUT_DIR="${WORKDIR}"/all
44 - inherit git-r3
45 - KEYWORDS=""
46 - SLOT="9999"
47 -else
48 - ##Tags https://github.com/rapid7/metasploit-framework/releases
49 - ##Releases https://github.com/rapid7/metasploit-framework/wiki/Downloads-by-Version
50 - #SRC_URI="https://github.com/rapid7/metasploit-framework/archive/${PV}.tar.gz -> ${P}.tar.gz"
51 - ##Snapshots
52 - MY_PV=${PV/_p/-}
53 - SRC_URI="https://github.com/rapid7/metasploit-framework/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
54 - KEYWORDS="~amd64 ~arm ~x86"
55 - RUBY_S="${PN}-framework-${MY_PV}"
56 - inherit versionator
57 - SLOT="$(get_version_component_range 1).$(get_version_component_range 2)"
58 -fi
59 -
60 -DESCRIPTION="Advanced framework for developing, testing, and using vulnerability exploit code"
61 -HOMEPAGE="http://www.metasploit.org/"
62 -LICENSE="BSD"
63 -IUSE="development +java oracle +pcap test"
64 -
65 -#multiple known bugs with tests reported upstream and ignored
66 -#http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible)
67 -RESTRICT="test"
68 -
69 -RUBY_COMMON_DEPEND="virtual/ruby-ssl
70 - >=dev-ruby/activesupport-4.0.9:4.0
71 - >=dev-ruby/actionpack-4.0.9:4.0
72 - >=dev-ruby/activerecord-4.0.9:4.0
73 - dev-ruby/bcrypt-ruby
74 - dev-ruby/builder:3
75 - dev-ruby/bundler
76 - dev-ruby/jsobfu:0.2.1
77 - dev-ruby/json
78 - dev-ruby/kissfft
79 - =dev-ruby/metasploit_data_models-1.2.5
80 - dev-ruby/meterpreter_bins:0.0.22
81 - dev-ruby/metasploit-payloads:1.0.9
82 - =dev-ruby/metasploit-credential-1.0.0:1.0
83 - >=dev-ruby/metasploit-concern-1.0.0:1.0
84 - >=dev-ruby/metasploit-model-1.0.0:1.0
85 - dev-ruby/msgpack
86 - dev-ruby/nokogiri
87 - dev-ruby/recog:2.0.6
88 - =dev-ruby/rkelly-remix-0.0.6
89 - dev-ruby/sqlite3
90 - >=dev-ruby/pg-0.11
91 - dev-ruby/packetfu:1.1.9
92 - >=dev-ruby/rubyzip-1.1
93 - dev-ruby/rb-readline-r7
94 - dev-ruby/robots
95 - java? ( dev-ruby/rjb )
96 - oracle? ( dev-ruby/ruby-oci8 )
97 - pcap? ( dev-ruby/pcaprub:*
98 - dev-ruby/network_interface )
99 - development? ( dev-ruby/fivemat
100 - dev-ruby/pry
101 - dev-ruby/redcarpet
102 - dev-ruby/yard
103 - >=dev-ruby/rake-10.0.0
104 - >=dev-ruby/factory_girl-4.1.0 )"
105 - #lorcon doesn't support ruby21
106 - #lorcon? ( net-wireless/lorcon[ruby] )
107 -ruby_add_bdepend "${RUBY_COMMON_DEPEND}
108 - test? ( >=dev-ruby/factory_girl-4.1.0
109 - dev-ruby/fivemat
110 - dev-ruby/database_cleaner
111 - >=dev-ruby/rspec-2.12
112 - dev-ruby/shoulda-matchers
113 - dev-ruby/timecop
114 - >=dev-ruby/rake-10.0.0 )"
115 -ruby_add_rdepend "${RUBY_COMMON_DEPEND}"
116 -
117 -COMMON_DEPEND="dev-db/postgresql[server]
118 - >=app-crypt/johntheripper-1.7.9-r1[-minimal]
119 - net-analyzer/nmap"
120 -RDEPEND+=" ${COMMON_DEPEND}
121 - >=app-eselect/eselect-metasploit-0.16"
122 -
123 -RESTRICT="strip"
124 -
125 -QA_PREBUILT="
126 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_linux.bin
127 - usr/lib*/${PN}${SLOT}/data/templates/template_armle_linux.bin
128 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_solaris.bin
129 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux.bin
130 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux_dll.bin
131 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_bsd.bin
132 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_bsd.bin
133 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
134 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
135 - usr/lib*/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
136 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
137 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
138 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
139 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
140 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2014-3153.elf
141 - usr/lib*/${PN}${SLOT}/data/android/libs/x86/libndkstager.so
142 - usr/lib*/${PN}${SLOT}/data/android/libs/mips/libndkstager.so
143 - usr/lib*/${PN}${SLOT}/data/android/libs/armeabi/libndkstager.so
144 - "
145 -
146 -pkg_setup() {
147 - if use test; then
148 - su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
149 - su postgres -c "createuser msf_test_user -d -S -R"
150 - if [ $? -ne 0 ]; then
151 - su postgres -c "dropuser msf_test_user" || die
152 - su postgres -c "createuser msf_test_user -d -S -R" || die
153 - fi
154 - su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
155 - fi
156 - ruby-ng_pkg_setup
157 -}
158 -
159 -all_ruby_unpack() {
160 - if [[ ${PV} == "9999" ]] ; then
161 - git-r3_src_unpack
162 - else
163 - default_src_unpack
164 -# mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all
165 -# rm -r msf3
166 - #msf_version=$(grep --color=never "CURRENT_VERSION =" ${S}/spec/lib/msf/core/framework_spec.rb)
167 - #msf_version=${msf_version#*=}
168 - fi
169 -}
170 -
171 -all_ruby_prepare() {
172 - # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
173 - #epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
174 - epatch_user
175 -
176 - #unbundle johntheripper, at least it now defaults to running the system version
177 - rm -r data/john/run.*
178 - rm -r data/john/src.tar.bz2
179 - #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
180 - rm -r data/cpuinfo
181 -
182 - #remove random oudated collected garbage
183 - rm -r external
184 -
185 - #remove unneeded ruby bundler versioning files
186 - #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
187 - #we regen this file in each_ruby_prepare
188 - rm Gemfile.lock
189 - #The Gemfile contains real known deps
190 - #add our dep on upstream rb-readline instead of bundled one
191 - #and then they broke it...
192 - #sed -i "/gem 'packetfu'/a #use upstream readline instead of bundled\ngem 'rb-readline'" Gemfile || die
193 - sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die
194 - #remove the bundled readline
195 - #https://github.com/rapid7/metasploit-framework/pull/3105
196 - #this PR was closed due to numerous changes to their local fork, almost entirely for non-linux
197 - #but now we have to go back to bundled readline because otherwise it's broken
198 - #rm lib/rbreadline.rb
199 - #now we edit the Gemfile based on use flags
200 - #even if we pass --without=blah bundler still calculates the deps and messes us up
201 - if ! use pcap; then
202 - sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
203 - fi
204 - if ! use development; then
205 - sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
206 - fi
207 - if ! use test; then
208 - sed -i -e "/^group :test/,/^end$/d" Gemfile || die
209 - fi
210 - if ! use test && ! use development; then
211 - sed -i -e "/^group :development/,/^end$/d" Gemfile || die
212 - fi
213 - #We don't need simplecov
214 - sed -i -e "/^group :coverage/,/^end$/d" Gemfile || die
215 - sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
216 -
217 - #we need to edit the gemspec too, since it tries to call git instead of anything sane
218 - #probably a better way to fix this... if I care at some point
219 - sed -i -e "/^ spec.files/,/^ }/d" metasploit-framework.gemspec || die
220 -
221 - #let's bogart msfupdate
222 - rm msfupdate
223 - echo "#!/bin/sh" > msfupdate
224 - echo "echo \"[*]\"" >> msfupdate
225 - echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate
226 - echo "echo \"[*]\"" >> msfupdate
227 - echo "echo \"\"" >> msfupdate
228 - if [[ ${PV} == "9999" ]] ; then
229 - echo "if [ -x /usr/bin/smart-live-rebuild ]; then" >> msfupdate
230 - echo " smart-live-rebuild -f net-analyzer/metasploit" >> msfupdate
231 - echo "else" >> msfupdate
232 - echo " echo \"Please install app-portage/smart-live-rebuild for a better experience.\"" >> msfupdate
233 - echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
234 - echo "fi" >> msfupdate
235 - else
236 - echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate
237 - echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate
238 - echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate
239 - fi
240 - #this is set executable in src_install
241 -
242 - #install our database.yml file before tests are run
243 - cp "${FILESDIR}"/database.yml config/
244 -
245 -}
246 -
247 -each_ruby_prepare() {
248 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle install --local || die
249 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle check || die
250 -
251 - #force all metasploit executables to use desired ruby version
252 - #https://dev.metasploit.com/redmine/issues/8357
253 - for file in $(ls -1 msf*)
254 - do
255 - #poorly adapted from python.eclass
256 - sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?ruby\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${RUBY}:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
257 - done
258 -}
259 -
260 -each_ruby_test() {
261 - #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox
262 -
263 - #we bogart msfupdate so no point in trying to test it
264 - rm spec/msfupdate_spec.rb || die
265 - #we don't really want to be uploading to virustotal during the tests
266 - rm spec/tools/virustotal_spec.rb || die
267 -
268 - # https://dev.metasploit.com/redmine/issues/8425
269 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:create || die
270 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:migrate || die
271 -
272 - MSF_DATABASE_CONFIG=config/database.yml BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake || die
273 - su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
274 -}
275 -
276 -each_ruby_install() {
277 - #Tests have already been run, we don't need this stuff
278 - rm -r spec || die
279 - rm -r test || die
280 - rm Gemfile.lock || die
281 -
282 - #I'm 99% sure that this will only work for as long as we only support one ruby version. Creativity will be needed if we wish to support multiple.
283 - # should be as simple as copying everything into the target...
284 - dodir /usr/$(get_libdir)/${PN}${SLOT}
285 - cp -R * "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
286 - rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md
287 - fowners -R root:0 /
288 -
289 -}
290 -
291 -all_ruby_install() {
292 - # do not remove LICENSE, bug #238137
293 - dodir /usr/share/doc/${PF}
294 - cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
295 - dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation
296 -
297 - fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate
298 -
299 - #tell revdep-rebuild to ignore binaries meant for the target
300 - dodir /etc/revdep-rebuild
301 - cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT}
302 - #These dirs contain prebuilt binaries for running on the TARGET not the HOST
303 - SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter"
304 - SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits"
305 - EOF
306 -}
307 -
308 -pkg_postinst() {
309 - elog "Before use you should run 'env-update' and '. /etc/profile'"
310 - elog "otherwise you may be missing important environmental variables."
311 -
312 - elog "You need to prepare the database by running:"
313 - elog "emerge --config postgresql"
314 - elog "/etc/init.d/postgresql-<version> start"
315 - elog "emerge --config =metasploit-${PV}"
316 -
317 - "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
318 -
319 - einfo
320 - elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
321 -}
322 -
323 -pkg_config() {
324 - einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
325 - su postgres -c "createuser msf_user -D -S -R"
326 - su postgres -c "createdb --owner=msf_user msf_database"
327 -}
328
329 diff --git a/net-analyzer/metasploit/metasploit-9999.ebuild b/net-analyzer/metasploit/metasploit-9999.ebuild
330 index 41df423..7ce597d 100644
331 --- a/net-analyzer/metasploit/metasploit-9999.ebuild
332 +++ b/net-analyzer/metasploit/metasploit-9999.ebuild
333 @@ -1,4 +1,4 @@
334 -# Copyright 1999-2015 Gentoo Foundation
335 +# Copyright 1999-2016 Gentoo Foundation
336 # Distributed under the terms of the GNU General Public License v2
337 # $Id$
338
339 @@ -48,9 +48,9 @@ RUBY_COMMON_DEPEND="virtual/ruby-ssl
340 dev-ruby/json
341 dev-ruby/kissfft
342 dev-ruby/metasm:1.0.2
343 - dev-ruby/metasploit_data_models:1.2.9
344 + dev-ruby/metasploit_data_models:1.2.10
345 dev-ruby/meterpreter_bins:0.0.22
346 - dev-ruby/metasploit-payloads:1.0.19
347 + dev-ruby/metasploit-payloads:1.0.22
348 dev-ruby/metasploit-credential:1.0.1
349 >=dev-ruby/metasploit-concern-1.0.0:1.0
350 >=dev-ruby/metasploit-model-1.0.0:1.0
351 @@ -145,9 +145,6 @@ all_ruby_prepare() {
352 #epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
353 epatch_user
354
355 - #unbundle johntheripper, at least it now defaults to running the system version
356 - rm -r data/john/run.*
357 - rm -r data/john/src.tar.bz2
358 #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
359 rm -r data/cpuinfo