Skip to content

Instantly share code, notes, and snippets.

@MShahine
Last active April 3, 2024 00:57
Show Gist options
  • Save MShahine/1bb7455668319bfa82254706fe44210d to your computer and use it in GitHub Desktop.
Save MShahine/1bb7455668319bfa82254706fe44210d to your computer and use it in GitHub Desktop.
This Script Will Install Metasplloit-framework automatically .
sudo su
clear
echo '[!] Original Work Is By DARKOPERATOR '
echo '[+] Welcome To The MSF Installer Modified By MShahine [@MShahine1]'
echo '\n[+] Update And Upgrade The System For Installing MSF ... '
sudo apt-get update && sudo apt-get upgrade
echo '\n[+] install all the dependent packages that are needed by Metasploit Framework: '
sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev libyaml-dev curl zlib1g-dev gawk bison libffi-dev libgdbm-dev libncurses5-dev libtool sqlite3 libgmp-dev gnupg2 dirmngr nmap -y
#----------------------------------------------#
clear
echo '\n[+] As We Know Metasploit Is Using RUBY-2.6.6'
echo '\n[+] Installing a Proper Version of Ruby '
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
# sudo plugin so we can run Metasploit as root with "rbenv sudo msfconsole"
git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo
exec $SHELL
RUBYVERSION=$(wget https://raw.githubusercontent.com/rapid7/metasploit-framework/master/.ruby-version -q -O - )
rbenv install $RUBYVERSION
rbenv global $RUBYVERSION
#ruby -v
echo '\n[+] Reload The Profile Configuration ....'
source /etc/profile
#------------------------#
clear
echo '\n[+] We will download the latest version of Metasploit Framework via Git so we can use msfupdate to keep it updated ...'
cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework
#--------------------#
clear
echo '\n[+] Install using bundler the required gems and versions ...'
gem install bundler
bundle install
#--------------------#
echo '\n[+] create the links to the commands so we can use them under any user and not being under the framework folder ... '
sudo bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'
#--------------------#
clear
echo '\n[+] Configuring Postgre SQL Server ...'
printf "\nexport PATH=$PATH:/usr/lib/postgresql/10/bin" >> ~/.bashrc
. ~/.bashrc
sudo usermod -a -G postgres `whoami`
sudo su - `whoami`
#--------------------#
clear
echo '\n[+] First Check '
msfconsole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment