Gentoo Archives: gentoo-commits

From: "Richard Farina (zerochaos)" <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-analyzer/metasploit: metasploit-9999.ebuild metasploit-4.8.2-r1.ebuild ChangeLog
Date: Mon, 10 Feb 2014 16:03:04
Message-Id: 20140210160300.871852004C@flycatcher.gentoo.org
1 zerochaos 14/02/10 16:03:00
2
3 Modified: metasploit-9999.ebuild ChangeLog
4 Added: metasploit-4.8.2-r1.ebuild
5 Log:
6 closing bug 500404, syncing 9999 and tagged
7
8 (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key DD11F94A)
9
10 Revision Changes Path
11 1.10 net-analyzer/metasploit/metasploit-9999.ebuild
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild?rev=1.10&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild?rev=1.10&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild?r1=1.9&r2=1.10
16
17 Index: metasploit-9999.ebuild
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild,v
20 retrieving revision 1.9
21 retrieving revision 1.10
22 diff -u -r1.9 -r1.10
23 --- metasploit-9999.ebuild 22 Jan 2014 16:12:33 -0000 1.9
24 +++ metasploit-9999.ebuild 10 Feb 2014 16:03:00 -0000 1.10
25 @@ -1,6 +1,6 @@
26 # Copyright 1999-2014 Gentoo Foundation
27 # Distributed under the terms of the GNU General Public License v2
28 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild,v 1.9 2014/01/22 16:12:33 zerochaos Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild,v 1.10 2014/02/10 16:03:00 zerochaos Exp $
30
31 EAPI="5"
32
33 @@ -108,7 +108,13 @@
34 }
35
36 all_ruby_unpack() {
37 - git-r3_src_unpack
38 + if [[ ${PV} == "9999" ]] ; then
39 + git-r3_src_unpack
40 + else
41 + default_src_unpack
42 + mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all
43 + rm -r msf3
44 + fi
45 }
46
47 all_ruby_prepare() {
48 @@ -157,7 +163,7 @@
49 echo "echo \"[*]\"" >> msfupdate
50 echo "echo \"\"" >> msfupdate
51 if [[ ${PV} == "9999" ]] ; then
52 - echo "ESVN_REVISION=HEAD emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
53 + echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
54 else
55 echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate
56 echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate
57 @@ -196,18 +202,30 @@
58 rm -rf spec
59 rm -rf test
60
61 + #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.
62 # should be as simple as copying everything into the target...
63 dodir /usr/$(get_libdir)/${PN}${SLOT}
64 cp -R * "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
65 rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md
66 fowners -R root:0 /
67
68 +}
69 +
70 +all_ruby_install() {
71 # do not remove LICENSE, bug #238137
72 dodir /usr/share/doc/${PF}
73 cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
74 dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation
75
76 fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate
77 +
78 + #tell revdep-rebuild to ignore binaries meant for the target
79 + dodir /etc/revdep-rebuild
80 + cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT}
81 + #These dirs contain prebuilt binaries for running on the TARGET not the HOST
82 + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter"
83 + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits"
84 + EOF
85 }
86
87 pkg_postinst() {
88
89
90
91 1.77 net-analyzer/metasploit/ChangeLog
92
93 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/ChangeLog?rev=1.77&view=markup
94 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/ChangeLog?rev=1.77&content-type=text/plain
95 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/ChangeLog?r1=1.76&r2=1.77
96
97 Index: ChangeLog
98 ===================================================================
99 RCS file: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v
100 retrieving revision 1.76
101 retrieving revision 1.77
102 diff -u -r1.76 -r1.77
103 --- ChangeLog 30 Jan 2014 01:24:58 -0000 1.76
104 +++ ChangeLog 10 Feb 2014 16:03:00 -0000 1.77
105 @@ -1,6 +1,12 @@
106 # ChangeLog for net-analyzer/metasploit
107 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
108 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v 1.76 2014/01/30 01:24:58 zerochaos Exp $
109 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v 1.77 2014/02/10 16:03:00 zerochaos Exp $
110 +
111 +*metasploit-4.8.2-r1 (10 Feb 2014)
112 +
113 + 10 Feb 2014; Rick Farina <zerochaos@g.o> +metasploit-4.8.2-r1.ebuild,
114 + metasploit-9999.ebuild:
115 + closing bug 500404, syncing 9999 and tagged
116
117 30 Jan 2014; Rick Farina <zerochaos@g.o> metasploit-4.8.2.ebuild:
118 fix for bug 499224
119
120
121
122 1.1 net-analyzer/metasploit/metasploit-4.8.2-r1.ebuild
123
124 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/metasploit-4.8.2-r1.ebuild?rev=1.1&view=markup
125 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/metasploit/metasploit-4.8.2-r1.ebuild?rev=1.1&content-type=text/plain
126
127 Index: metasploit-4.8.2-r1.ebuild
128 ===================================================================
129 # Copyright 1999-2014 Gentoo Foundation
130 # Distributed under the terms of the GNU General Public License v2
131 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-4.8.2-r1.ebuild,v 1.1 2014/02/10 16:03:00 zerochaos Exp $
132
133 EAPI="5"
134
135 if [[ ${PV} == "9999" ]] ; then
136 EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
137 EGIT_CHECKOUT_DIR="${WORKDIR}"/all
138 inherit git-r3
139 KEYWORDS=""
140 else
141 #https://github.com/rapid7/metasploit-framework/wiki/Downloads-by-Version
142 SRC_URI="http://downloads.metasploit.com/data/releases/archive/framework-${PV}.tar.bz2"
143 KEYWORDS="~amd64 ~arm ~x86"
144 fi
145
146 #ruby18 is well beyond EoL
147 #ruby20 doesn't have wide enough support in gentoo yet (but is semi-supported upstream)
148 USE_RUBY="ruby19"
149 inherit eutils ruby-ng
150
151 DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code"
152 HOMEPAGE="http://www.metasploit.org/"
153 SLOT="4.8"
154 LICENSE="BSD"
155 IUSE="development +java lorcon +pcap test"
156
157 #multiple known bugs with tests reported upstream and ignored
158 #http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible)
159 RESTRICT="test"
160
161 RUBY_COMMON_DEPEND="virtual/ruby-ssl
162 dev-ruby/activesupport:3.2
163 dev-ruby/activerecord:3.2
164 dev-ruby/json
165 >=dev-ruby/metasploit_data_models-0.16.9
166 dev-ruby/msgpack
167 dev-ruby/nokogiri
168 dev-ruby/builder:3
169 >=dev-ruby/pg-0.11
170 =dev-ruby/packetfu-1.1.9
171 dev-ruby/robots
172 dev-ruby/kissfft
173 java? ( dev-ruby/rjb )
174 lorcon? ( net-wireless/lorcon[ruby] )
175 pcap? ( dev-ruby/pcaprub
176 dev-ruby/network_interface )
177 dev-ruby/bundler
178 development? ( dev-ruby/redcarpet
179 dev-ruby/yard
180 dev-ruby/rake
181 >=dev-ruby/factory_girl-4.1.0 )"
182 ruby_add_bdepend "${RUBY_COMMON_DEPEND}
183 test? ( >=dev-ruby/factory_girl-4.1.0
184 dev-ruby/database_cleaner
185 >=dev-ruby/rspec-2.12
186 dev-ruby/shoulda-matchers
187 dev-ruby/timecop )"
188 #>=dev-ruby/rake-10.0.0[ruby_targets_ruby19] re-add when in gentoo. I'm not allowed to add it :-(
189 ruby_add_rdepend "${RUBY_COMMON_DEPEND}"
190
191 COMMON_DEPEND="dev-db/postgresql-server
192 >=app-crypt/johntheripper-1.7.9-r1[-minimal]
193 net-analyzer/nmap"
194 DEPEND+=" ${COMMON_DEPEND}"
195 RDEPEND+=" ${COMMON_DEPEND}
196 >=app-admin/eselect-metasploit-0.10"
197
198 RESTRICT="strip"
199
200 QA_PREBUILT="
201 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
202 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
203 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
204 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
205 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
206 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
207 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
208 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
209 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
210 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
211 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
212 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
213 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
214 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
215 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
216 usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
217 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
218 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
219 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
220 usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
221 usr/$(get_libdir)/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
222 "
223
224 pkg_setup() {
225 if use test; then
226 su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
227 su postgres -c "createuser msf_test_user -d -S -R"
228 if [ $? -ne 0 ]; then
229 su postgres -c "dropuser msf_test_user" || die
230 su postgres -c "createuser msf_test_user -d -S -R" || die
231 fi
232 su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
233 fi
234 ruby-ng_pkg_setup
235 }
236
237 all_ruby_unpack() {
238 if [[ ${PV} == "9999" ]] ; then
239 git-r3_src_unpack
240 else
241 default_src_unpack
242 mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all
243 rm -r msf3
244 fi
245 }
246
247 all_ruby_prepare() {
248 # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
249 epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
250
251 #unbundle johntheripper, at least it now defaults to running the system version
252 rm -r data/john/run.*
253 rm -r data/john/src.tar.bz2
254 #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
255 rm -r data/cpuinfo
256
257 #remove random oudated collected garbage
258 rm -r external
259
260 #remove unneeded ruby bundler versioning files
261 #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
262 #we regen this file in each_ruby_prepare
263 rm Gemfile.lock
264 #The Gemfile contains real known deps
265 #now we edit the Gemfile based on use flags
266 #even if we pass --without=blah bundler still calculates the deps and messes us up
267 if ! use pcap; then
268 sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
269 fi
270 if ! use development; then
271 sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
272 fi
273 if ! use test; then
274 sed -i -e "/^group :test/,/^end$/d" Gemfile || die
275 fi
276 if ! use test && ! use development; then
277 sed -i -e "/^group :development/,/^end$/d" Gemfile || die
278 fi
279 if use test; then
280 #We don't need simplecov
281 sed -i -e "s#gem 'simplecov', '0.5.4', :require => false##" Gemfile || die
282 sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
283 fi
284
285 #let's bogart msfupdate
286 rm msfupdate
287 echo "#!/bin/sh" > msfupdate
288 echo "echo \"[*]\"" >> msfupdate
289 echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate
290 echo "echo \"[*]\"" >> msfupdate
291 echo "echo \"\"" >> msfupdate
292 if [[ ${PV} == "9999" ]] ; then
293 echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
294 else
295 echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate
296 echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate
297 echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate
298 fi
299 #this is set executable in src_install
300
301 #install our database.yml file before tests are run
302 cp "${FILESDIR}"/database.yml config/
303
304 }
305
306 each_ruby_prepare() {
307 ${RUBY} -S bundle install --local || die
308 ${RUBY} -S bundle check || die
309
310 #force all metasploit executables to ruby19, ruby18 is not supported anymore and ruby20 is not supported yet
311 #https://dev.metasploit.com/redmine/issues/8357
312 for file in $(ls -1 msf*)
313 do
314 #poorly adapted from python.eclass
315 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"
316 done
317 }
318
319 each_ruby_test() {
320 #rake --trace spec || die
321 # https://dev.metasploit.com/redmine/issues/8425
322 ${RUBY} -S rake db:migrate || die
323 RAILS_ENV=test MSF_DATABASE_CONFIG=config/database.yml ${RUBY} -S rake spec || die
324 su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
325 }
326
327 each_ruby_install() {
328 #Tests have already been run, we don't need this stuff
329 rm -rf spec
330 rm -rf test
331
332 #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.
333 # should be as simple as copying everything into the target...
334 dodir /usr/$(get_libdir)/${PN}${SLOT}
335 cp -R * "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
336 rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md
337 fowners -R root:0 /
338
339 }
340
341 all_ruby_install() {
342 # do not remove LICENSE, bug #238137
343 dodir /usr/share/doc/${PF}
344 cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
345 dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation
346
347 fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate
348
349 #tell revdep-rebuild to ignore binaries meant for the target
350 dodir /etc/revdep-rebuild
351 cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT}
352 #These dirs contain prebuilt binaries for running on the TARGET not the HOST
353 SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter"
354 SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits"
355 EOF
356 }
357
358 pkg_postinst() {
359 elog "You need to prepare the database by running:"
360 elog "emerge --config postgresql-server"
361 elog "/etc/init.d/postgresql-<version> start"
362 elog "emerge --config =metasploit-${PV}"
363
364 "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
365
366 einfo
367 elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
368 }
369
370 pkg_config() {
371 einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
372 su postgres -c "createuser msf_user -D -S -R"
373 su postgres -c "createdb --owner=msf_user msf_database"
374 }