Fixes #466 and #467. Binaries and source to be stored outside the tree

git-svn-id: file:///home/svn/framework3/trunk@7372 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-11-06 02:55:18 +00:00
parent c3dd1698fc
commit 7b8d08a635
6 changed files with 206 additions and 0 deletions

41
external/installer-linux/README.txt vendored Normal file
View File

@ -0,0 +1,41 @@
****************************************
* Metasploit Framework Linux Installer *
****************************************
The Metasploit installer for Linux provides a self-contained execution
environment for the Metasploit Framework. This includes the Ruby interpreter,
the RubyGems package, SQLite3, and Subversion. The package also includes
binary copies of the libraries needed to support these tools.
The installer is built using binaries from Ubuntu 6.06 Server. This old
version is necessary for the compiled tools to be compatible with older versions
of the GLIBC library.
The following applications/libraries are built from source:
- Ruby 1.9.1
- RubyGems
- SQLite3-Ruby
- Subversion
- Lorcon2
The following libraries are taken from Ubuntu:
- libssl.so.0.9.8
- libutil-2.3.6.so
- libcrypto.so.0.9.8
- libncursesw.so.5.5
- libsqlite3.so.0.8.6
- libncurses.so.5.5
- libz.so.1.2.3
- libaprutil-1.so.0.3.9
- libserf-0.so.0.0.0
- libapr-1.so.0.3.8
- libdb-4.3.so
- libpcap.so.0.9.4
- libexpat.so.1.0.0
While the source code for each of these applications and libraries are easily
available from the upstream repository, we will make them available directly
from the Metasploit server on demand.
The installer itself is created with makeself

37
external/installer-linux/build.sh vendored Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
VERSION="3.3-beta"
# Grab a fresh copy of Metasploit
if [ -f "tmp/msf3/msfconsole" ]; then
svn update tmp/msf3/
else
svn checkout https://www.metasploit.com/svn/framework3/trunk tmp/msf3/
fi
(cd tmp; tar cf msf3.tar msf3)
NAME32="Metasploit Framework v${VERSION} Installer (32-bit)"
PATH32="framework-${VERSION}-linux-i686.run"
NAME64="Metasploit Framework v${VERSION} Installer (64-bit)"
PATH64="framework-${VERSION}-linux-x86_64.run"
rm -rf tmp32
mkdir tmp32
cp tmp/msf3.tar tmp32/
cp bin/linux32.tar.bz2 tmp32/metasploit.tar.bz2
bunzip2 tmp32/metasploit.tar.bz2
cp -a scripts/*.sh tmp32/
makeself tmp32 ${PATH32} "${NAME32}" ./installer.sh 32
rm -rf tmp32
rm -rf tmp64
mkdir tmp64
cp tmp/msf3.tar tmp64/
cp bin/linux64.tar.bz2 tmp64/metasploit.tar.bz2
bunzip2 tmp64/metasploit.tar.bz2
cp -a scripts/*.sh tmp64/
makeself tmp64 ${PATH64} "${NAME64}" ./installer.sh 64
rm -rf tmp64

8
external/installer-linux/scripts/banner.sh vendored Executable file
View File

@ -0,0 +1,8 @@
__. .__. .__. __.
_____ _____/ |______ ____________ | | ____ |__|/ |_
/ \_/ __ \ __\__ \ / ___/\____ \| | / _ \| \ __\
| Y Y \ ___/| | / __ \_\___ \ | |_> > |_( <_> ) || |
|__|_| /\___ >__| (____ /____ >| __/|____/\____/|__||__|
\/ \/ \/ \/ |__|

5
external/installer-linux/scripts/env.sh vendored Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
export BASE=`dirname $0`
export PATH=${BASE}/bin:$PATH
export LD_LIBRARY_PATH=${BASE}/lib:$LD_LIBRARY_PATH
$@

90
external/installer-linux/scripts/installer.sh vendored Executable file
View File

@ -0,0 +1,90 @@
#!/bin/bash
confirm(){
Q=$1
while true; do
echo -n "${Q} (yes/no) > "
read INPUT
if [ -z $INPUT ]; then
exit 1
fi
if [ $INPUT == "no" ]; then
return
fi
if [ $INPUT == "yes" ]; then
return 1
fi
done
}
cat banner.sh
if [ `id -u -n` != "root" ]; then
echo "Error: The installer must be executed as the root user."
echo ""
exit 1
fi
if [ -d "/opt/metasploit3" ]; then
echo "Warning: A copy of Metasploit already exists at /opt/metasploit3"
echo " continuing this installation will DELETE the previous "
echo " install, including all user-modified files."
echo ""
echo "Please enter 'yes' to continue or any other key to abort"
confirm "Continue"
if [ $? -eq "0" ]; then exit; fi
echo ""
fi
echo "This installer will place Metasploit into the /opt/metasploit3 directory."
confirm "Continue"
if [ $? -eq "0" ]; then exit; fi
if [ -d "/opt/metasploit3" ]; then
echo "Removing files from the previous installation..."
rm -rf /opt/metasploit3
find /usr/local/bin -name 'msf*' -type l | xargs rm -f
echo ""
fi
mkdir -p /opt/metasploit3
echo "Extracting the Metasploit operating environment..."
tar --directory=/opt -xf metasploit.tar
cp run.sh env.sh /opt/metasploit3/
echo ""
echo "Extracting the Metasploit Framework..."
tar --directory=/opt/metasploit3 -xf msf3.tar
echo ""
echo "Installing links into /usr/local/bin..."
mkdir -p /usr/local/bin
ln -sf /opt/metasploit3/bin/msf* /usr/local/bin/
echo ""
echo "Installation complete."
echo ""
echo "Would you like to automatically update Metasploit?"
confirm "AutoUpdate?"
if [ $? -eq "1" ]; then
CRON=`mktemp cronXXXXX`
crontab -l 2>/dev/null | grep -v msfupdate > $CRON
echo "30 * * * * /opt/metasploit3/bin/msfupdate > /var/log/msfupdate.log 2>&1" >> $CRON
crontab $CRON
rm -f $CRON
echo ""
fi
echo "Would you like to update Metasploit right now?"
confirm "Update?"
if [ $? -eq "1" ]; then
/opt/metasploit3/bin/msfupdate
echo ""
fi
echo "Exiting the installer..."

25
external/installer-linux/scripts/run.sh vendored Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
export LINK=$(which "$0")
export NAME=$(basename "$0")
while [ -L "$LINK" ]; do
LAST=$LINK
LINK="$(readlink "$LINK")"
if [ ! -L "$LINK" ]; then
break
fi
done
# Chop it twice
BASE=$(dirname "$LAST")
BASE=$(dirname "$BASE")
export BASE
export PATH=${BASE}/app:$PATH
export LD_LIBRARY_PATH=${BASE}/lib:$LD_LIBRARY_PATH
if [ -f "${BASE}/msf3/${NAME}" ]; then
exec ${BASE}/msf3/${NAME} $@
fi
exec ${NAME} $@