mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
3b67eefe4e
git-svn-id: file:///home/svn/framework3/trunk@10202 4d416f70-5f16-0410-b530-b9f4589650da
78 lines
2.2 KiB
Plaintext
78 lines
2.2 KiB
Plaintext
Steps needed to build the POSIX meterpreter from scratch
|
|
--------------------------------------------------------
|
|
|
|
1) Build bionic libc
|
|
|
|
you will need "jam" package for compiling.
|
|
|
|
# cd external/source/meterpreter/source/bionic/libc
|
|
# ARCH=x86 TOP=${PWD} jam
|
|
... lots of output ...
|
|
# cd out/x86/
|
|
# sh make.sh
|
|
.. makes dynamic library ...
|
|
|
|
you now have a libbionic.so, copy to source/bionic/compiled/libc.so
|
|
|
|
2) Build bionic libm
|
|
|
|
# cd external/source/meterpreter/source/bionic/libm
|
|
# make -f msfMakefile
|
|
... lots of output ...
|
|
|
|
you now have a libm.so, copy to source/bionic/compiled/
|
|
|
|
3) Build bionic libdl
|
|
|
|
# cd external/source/meterpreter/source/bionic/libdl
|
|
# make
|
|
|
|
copy libdl.so to source/bionic/compiled
|
|
|
|
4) Build openssl
|
|
|
|
download openssl 0.9.8o
|
|
|
|
Edit the Configure file. Locate "linux-elf line, duplicate it, s/-elf/-msf/, s/-ldl//, on the duplicate.
|
|
|
|
# ./Configure threads no-zlib no-krb5 386 --prefix=/tmp/out linux-msf no-dlfcn shared
|
|
...
|
|
# LIBC=/path/to/bionic/libc
|
|
# LIBM=/path/to/bionic/libm
|
|
# COMPILED=/path/to/bionic/compiled
|
|
# make CC="gcc -I ${LIBC}/include -I ${LIBC}/kernel/common/linux/ -I ${LIBC}/kernel/common/ -I ${LIBC}/arch-x86/include/ -I ${LIBC}/kernel/arch-x86/ -I${LIBC}/private -fPIC -DPIC -nostdinc -nostdlib -Dwchar_t='char' -fno-builtin -D_SIZE_T_DECLARED -DElf_Size='u_int32_t' -I${LIBM}/include -L${COMPILED} -D_BYTE_ORDER=_LITTLE_ENDIAN -lc" depend clean all
|
|
... lots of compiling ...
|
|
# cp libssl.so ${COMPILED}
|
|
# cp libcrypto.so ${COMPILED}
|
|
|
|
5) Compile the common/support library code
|
|
|
|
# cd external/source/meterpreter/workspace/common
|
|
# make
|
|
|
|
.. copy libsupport.so to source/bionic/compiled ..
|
|
|
|
6) Build the metsrv_main binary
|
|
|
|
# cd external/source/meterpreter/workspace/metsrv
|
|
# make
|
|
|
|
You will need to generate a linker script, and set the location to 0x00040000. -Wl,-verbose >log , edit log for == ==
|
|
|
|
.. copy metsrv_main to source/bionic/compiled directory
|
|
|
|
7) Build the rtld binary (last step)
|
|
|
|
# cd external/source/meterpreter/source/server/rtld
|
|
# make test
|
|
|
|
(make test will make msflinker, which you can use to test the meterpreter)
|
|
|
|
8) Compile the ext_server_stdapi
|
|
|
|
# external/source/meterpreter/workspace/extensions/stdapi
|
|
# make
|
|
|
|
copy ext_server_stdapi.so to data/meterpreter/ext_server_stdai.lso <-- notice the .lso
|
|
|