Update install script

This commit is contained in:
Brendan Coles
2018-03-07 08:54:39 +00:00
parent dfc08595fe
commit 2d3010dc0b
2 changed files with 121 additions and 184 deletions

135
install
View File

@@ -1,26 +1,133 @@
#!/usr/bin/env ruby
#!/bin/bash
#
# Copyright (c) 2006-2018 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
puts "\nWelcome to the BeEF installer!"
set -euo pipefail
IFS=$'\n\t'
if RUBY_VERSION < '2.2'
puts "\n"
puts "Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to Ruby version 2.2 or later."
puts "\n"
exit 1
end
clear
puts "\nPlease make sure you have installed SQLite before proceeding. For instructions on how to do this please see the README file"
if [ -f core/main/console/beef.ascii ] ; then
cat core/main/console/beef.ascii
echo
fi
puts "\nInstall Bundler: gem install bundler"
echo "#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
echo " -- [ BeEF Installer ] -- "
echo "#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"
echo
puts "\nRun bundler in your BeEF folder: bundle install"
command_exists () {
command -v "$1" /dev/null 2&>1
}
puts "\nRun BeEF: ./beef"
info() { echo "[INFO] $*"; }
warn() { echo "[WARN] $*"; }
error() { echo "[ERROR] $*"; }
fatal() { echo "[FATAL] $*"; exit 1 ; }
warn 'This script will install BeEF and its required dependencies (including operating system packages).'
read -p "Are you sure you wish to continue (Y/n)? "
if [ "`echo ${REPLY} | tr [:upper:] [:lower:]`" = "n" ] ; then
fatal 'Installation aborted'
fi
install_linux () {
info "Detecting Linux OS distribution..."
Distro=''
if [ -f /etc/redhat-release ] ; then
Distro='RedHat'
elif [ -f /etc/debian_version ] ; then
Distro='Debian'
elif [ -f /etc/os-release ] ; then
DISTRO_ID=`grep ^ID= /etc/os-release | cut -d= -f2-`
if [ "$DISTRO_ID" = 'kali' ] ; then
Distro='Kali'
fi
fi
if [ -z $Distro ] ; then
fatal "Unable to locate installer for your $OS distribution"
fi
readonly Distro
info "OS Distribution: $Distro"
info "Installing $Distro prerequisite packages..."
if [ "$Distro" = "Debian" -o "$Distro" = "Kali" ]; then
sudo apt-get update
sudo apt-get install curl git build-essential openssl libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion nodejs
elif [ "$Distro" = "RedHat" ]; then
sudo yum install -y git make gcc openssl-devel gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel bzip2 autoconf automake libtool bison iconv-devel sqlite-devel nodejs
fi
}
install_mac () {
echo
}
info "Detecting OS..."
OS=`uname`
readonly OS
info "Operating System: $OS"
if [ "${OS}" = "Linux" ] ; then
info "Launching Linux install..."
install_linux
elif [ "$OS" = "Darwin" ]; then
info "Launching Mac OSX install..."
install_mac
else
fatal "Unable to locate installer for your Operating system: $OS"
fi
info 'Detecting Ruby environment...'
MIN_RUBY_VER='2.3'
if command_exists ruby
then
RUBY_VERSION=`ruby -e "puts RUBY_VERSION"`
info "Ruby version ${RUBY_VERSION} is installed"
if [ `ruby -e "puts RUBY_VERSION.to_f >= ${MIN_RUBY_VER}"` = 'false' ]
then
fatal "Ruby version ${RUBY_VERSION} is not supported. Please install Ruby ${MIN_RUBY_VER} (or newer) and restart the installer."
fi
else
fatal "Ruby is not installed. Please install Ruby ${MIN_RUBY_VER} (or newer) and restart the installer."
fi
#if command_exists rbenv
#then
# info 'rbenv is installed'
#elif command_exists rvm
#then
# info 'rvm is installed'
#else
# fatal 'Could not find Ruby environment manager!
#Please install either RVM or rbenv and restart the installer
#For more information:
# * rbenv: https://github.com/rbenv/rbenv
# * rvm: https://rvm.io/rvm/install'
#fi
info 'Detecting bundler gem...'
if command_exists bundler
then
info 'bundler gem is installed'
else
info 'Installing bundler gem'
gem install bundler
fi
echo "Installing required Ruby gems..."
bundle install --without test development
echo
echo "=========================================="
echo
info "Install completed successfully!"
info "Run './beef' to launch BeEF"
echo
echo "=========================================="
echo
#Testing fork regroup

View File

@@ -1,170 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2006-2018 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
set -e
clear
echo "======================================"
echo " BeEF Installer "
echo "======================================"
echo ""
echo "CAUTION: This installation script will install a number of BeEF dependencies including the Ruby-RVM environment and its dependencies."
echo ""
echo "In rare cases, this may lead to unexpected behaviour or package conflicts on some systems."
echo ""
read -p "Are you sure you wish to continue (Y/n)? "
if [ "`echo ${REPLY} | tr [:upper:] [:lower:]`" == "n" ] ; then
exit;
fi
echo ""
echo "Detecting OS..";
OS=`uname`
if [ "${OS}" = "Linux" ] ; then
if [ -f /etc/redhat-release ] ; then
Distro='RedHat'
elif [ -f /etc/debian_version ] ; then
Distro='Debian'
fi
readonly OS
readonly Distro
fi
if [ "$OS" == "Darwin" ]; then
echo "Mac OSX Detected"
echo "Installing Ruby Version Manager (RVM) & Ruby 2.3.0.."
bash -s stable < <(curl -Ls https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_login
rvm install 2.3.0 --with-gcc=clang
rvm use 2.3.0
echo ""
echo "Downloading BeEF.."
git clone git://github.com/beefproject/beef.git
cd beef
echo ""
echo "Installing Ruby Gems.."
bundle install
OK="yes"
./beef
echo ""
echo "=========================================="
echo " Install Complete"
echo "Please restart Terminal and Run BeEF with:"
echo " $ ./beef "
echo "=========================================="
echo ""
fi
if [ "$Distro" == "Debian" ]; then
echo "Debian/Ubuntu Detected"
echo "Installing Prerequisite Packages.."
sudo apt-get update
sudo apt-get install curl git
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion nodejs
curl -Lsk https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
source ~/.bashrc
if [ -e $HOME/.rvm/scripts/rvm ]; then
source $HOME/.rvm/scripts/rvm
elif [ -e /usr/local/rvm/scripts/rvm ]; then
source /usr/local/rvm/scripts/rvm
else
source /etc/profile.d/rvm.sh
fi
rvm install 2.3.0
rvm use 2.3.0 --default
echo "Downloading BeEF.."
git clone git://github.com/beefproject/beef.git
cd beef
echo "Installing Ruby Gems"
gem install bundler
bundle install
./beef
OK="yes"
echo ""
echo "=========================================="
echo " Install Complete"
echo "=========================================="
echo ""
fi
if [ "$Distro" == "RedHat" ]; then
echo "Redhat/Fedora Detected"
echo "Installing Prerequisite Packages.."
sudo yum install -y git make gcc openssl-devel gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel bzip2 autoconf automake libtool bison iconv-devel sqlite-devel nodejs
echo ""
echo "Installing Ruby Version Manager (RVM) & Ruby 2.3.0"
wget https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer
bash ./rvm-installer
source ~/.rvm/scripts/rvm
rvm pkg install openssl
rvm install 2.3.0 --with-openssl-dir=$rvm_path/usr
source ~/.rvm/scripts/rvm
rvm use 2.3.0 --default
echo "Downloading BeEF.."
git clone git://github.com/beefproject/beef.git
cd beef
gem install bundler
bundle
source ~/.bash_profile
./beef
OK="yes"
echo ""
echo "=========================================="
echo " Install Complete"
echo "=========================================="
echo ""
fi
if [ "$OK" == "yes" ]; then
echo ""
else
echo ""
echo "======================================="
echo " Install Failed"
echo "Unable to locate installer for your OS:"
echo $OS
echo $Distro
echo "======================================="
echo ""
fi