INSTALLING METASPLOIT

tested on xenial and bionic

INSTALL

enable main restricted universe into /etc/apt/sources.list

apt update
apt full-upgrade
apt install apt-transport-https software-properties-common

install Java 11

mkdir -p /var/cache/oracle-jdk11-installer-local/
mv jdk-11.0.4_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-installer-local/

add-apt-repository ppa:linuxuprising/java
apt update
apt install oracle-java11-installer-local
apt install oracle-java11-set-default-local
java -version

libraries & postgres

apt install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev git autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev tigervnc-viewer libyaml-dev curl zlib1g-dev ruby ruby-dev postgresql postgresql-contrib
#xtightvncviewer
gem update --system #takes a while
gem install bundler

netstat -lntup
systemctl status postgresql

su - postgres
createuser msf -P -S -R -D
#createuser msfbusterb -P -S -R -D
createdb -O msf msf
#createdb -O msfbusterb msfbusterb
^D

get latest

cd /opt/
git clone https://github.com/rapid7/metasploit-framework.git
#git clone --single-branch --branch bluekeep git://github.com/busterb/metasploit-framework.git
cd /opt/metasploit-framework/
bundle install
yard config --gem-install-yri
#.gemspec
#spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.

for MSF in $(ls msf*); do ln -sf /opt/metasploit-framework/$MSF /usr/local/bin/$MSF; done; unset MSF

useradd -m -s /bin/bash -g users msf
usermod -aG sudo msf
chown -R msf /opt/metasploit-framework/

test as user

cd ~/
su - msf
yard config --gem-install-yri
cp -pi /opt/metasploit-framework/config/database.yml.example /opt/metasploit-framework/config/database.yml
vi /opt/metasploit-framework/config/database.yml

production:
  adapter: postgresql
  database: msf
  username: msf
  password: PASSWORD_HERE
  host: 127.0.0.1
  port: 5432
  pool: 75
  timeout: 5

READY TO GO

see msf.ops

TWEAK THE SOURCE

cp lib/msf/core/module/search.rb lib/msf/core/module/search.rb.dist
vi lib/msf/core/module/search.rb

Metasploit search by port function disappeared. How to search an exploit by port http://itdrafts.blogspot.com/2015/03/metasploit-search-by-port-function.html

Re: Fwd: Search exploits for a particular port number https://seclists.org/metasploit/2011/q3/242

? https://dev.metasploit.com/pipermail/framework/2011-September/008122.html

RESOURCES

Nightly Installers https://github.com/rapid7/metasploit-framework/wiki/Nightly-Installers

Setting Up a Metasploit Development Environment https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment

Installing Metasploit Framework on Ubuntu 18.04 LTS and Debian 7 https://www.darkoperator.com/installing-metasploit-in-ubunt/

How To Install and Use PostgreSQL on Ubuntu 16.04 https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04

TRASH

#add-apt-repository -y ppa:webupd8team/java
#apt -y install oracle-java8-installer
#add-apt-repository --remove ppa:webupd8team/java

Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml