From 4321b992dc4281cb168aeb52c145551451a9e0e4 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Tue, 10 Nov 2009 01:26:46 +0000 Subject: [PATCH] Improved the msfupdate script, retry on dirty svn directories, warn the user if automatic updates are disabled, and indicate the msfconsole is in the system path after the install git-svn-id: file:///home/svn/framework3/trunk@7437 4d416f70-5f16-0410-b530-b9f4589650da --- external/installer-linux/build.sh | 4 ++- external/installer-linux/scripts/installer.sh | 9 ++++++ external/installer-linux/scripts/msfupdate | 29 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100755 external/installer-linux/scripts/msfupdate diff --git a/external/installer-linux/build.sh b/external/installer-linux/build.sh index 6d226a6291..b22b34f297 100755 --- a/external/installer-linux/build.sh +++ b/external/installer-linux/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -VERSION="3.3-beta" +VERSION="3.3-rc1" # Grab a fresh copy of Metasploit if [ -f "tmp/msf3/msfconsole" ]; then @@ -23,6 +23,7 @@ cp tmp/msf3.tar tmp32/ cp bin/linux32.tar.bz2 tmp32/metasploit.tar.bz2 bunzip2 tmp32/metasploit.tar.bz2 cp -a scripts/*.sh tmp32/ +cp -a scripts/msfupdate tmp32/ TMP32=tmp32`date +%s1` mv tmp32 $TMP32 makeself $TMP32 ${PATH32} "${NAME32}" ./installer.sh 32 @@ -34,6 +35,7 @@ cp tmp/msf3.tar tmp64/ cp bin/linux64.tar.bz2 tmp64/metasploit.tar.bz2 bunzip2 tmp64/metasploit.tar.bz2 cp -a scripts/*.sh tmp64/ +cp -a scripts/msfupdate tmp64/ TMP64=tmp32`date +%s1` mv tmp64 $TMP64 makeself $TMP64 ${PATH64} "${NAME64}" ./installer.sh 64 diff --git a/external/installer-linux/scripts/installer.sh b/external/installer-linux/scripts/installer.sh index 05aa7303cb..21304f5699 100755 --- a/external/installer-linux/scripts/installer.sh +++ b/external/installer-linux/scripts/installer.sh @@ -54,6 +54,7 @@ mkdir -p /opt/metasploit3 echo "Extracting the Metasploit operating environment..." tar --directory=/opt -xf metasploit.tar cp run.sh env.sh /opt/metasploit3/ +cp msfupdate /opt/metasploit3/app/ echo "" echo "Extracting the Metasploit Framework..." @@ -64,6 +65,7 @@ echo "Installing links into /usr/local/bin..." mkdir -p /usr/local/bin ln -sf /opt/metasploit3/bin/msf* /usr/local/bin/ echo "" +hash -r echo "Installation complete." echo "" @@ -77,6 +79,11 @@ if [ $? -eq "1" ]; then crontab $CRON rm -f $CRON echo "" +else + echo "" + echo "Warning: Automatic updates are disabled, update manually with:" + echo "$ sudo msfupdate" + echo "" fi echo "Would you like to update Metasploit right now?" @@ -87,5 +94,7 @@ if [ $? -eq "1" ]; then echo "" fi +echo "Launch the Metasploit console by running 'msfconsole'" +echo "" echo "Exiting the installer..." diff --git a/external/installer-linux/scripts/msfupdate b/external/installer-linux/scripts/msfupdate new file mode 100755 index 0000000000..9cce81a902 --- /dev/null +++ b/external/installer-linux/scripts/msfupdate @@ -0,0 +1,29 @@ +#!/bin/bash + +if [ `id -u -n` != "root" ]; then + echo "[*] Error: msfupdate must be run as the root user" + exit 1 +fi + + +cd $BASE/msf3 +REPO=`grep framework3 .svn/entries` +echo "Updating Metasploit from ${REPO}..." +svn update + + + +if [ $? -ne "0" ]; then + echo " " + echo "Error: cleaning up the SVN directory and retrying..." + svn cleanup + svn update +fi + +if [ $? -ne "0" ]; then + echo " " + echo "Error: please check connectivity to the following URL:" + echo " "`grep framework3 .svn/entries` + echo " " +fi +