首页 » NetworkSec » Penetration » 正文

ubuntu14 or 16.04安装MSF5

20200719 updated

ubuntu 16.04安装msf5

注意:
1.尽量用非root的sudo用户,否则可能会出现非root无法用root安装的bundler install依赖

2.第一次执行msfconsole先退出ssh

//或者在msf目录执行msfconsole否则可能提示缺少依赖,要安装166个gem install依赖……

 

34  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 vncviewer libyaml-dev zlib1g-dev

 

apt-get install software-properties-common python-software-properties

29  add-apt-repository ppa:openjdk-r/ppa

 

apt-get update

32  apt-get install openjdk-7-jdk

 

37  git clone git://github.com/sstephenson/rbenv.git .rbenv

38  cd

39  echo ‘export PATH=”$HOME/.rbenv/bin:$PATH”‘ >> ~/.bashrc

40  echo ‘eval “$(rbenv init -)”‘ >> ~/.bashrc

41  git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

42  echo ‘export PATH=”$HOME/.rbenv/plugins/ruby-build/bin:$PATH”‘ >> ~/.bashrc

43  git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo

 

45  source .bashrc

 

49  apt-get install nmap

50  apt-get install openssl ruby-openssl libssl-dev

51  apt-get install openssl libssl-dev

 

52  su postgres

createuser msf -P -S -R -D

3  cd

4  createdb -O msf msf

exit

 

53  cd /opt

54  ls

55  git clone https://github.com/rapid7/metasploit-framework.git

56  cd metasploit-framework/

57  ls

 

65  curl -L get.rvm.io | bash -s stable

66  ls

67  cd

68  gpg –keyserver hkp://pool.sks-keyservers.net –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

69  curl -L get.rvm.io | bash -s stable

70  rvm -v

71  source /etc/profile.d/rvm.sh

72  rvm -v

 

 

88  rvm install “ruby-2.6.6”

94  rbenv install 2.6.6

 

97  rbenv global 2.6.6

98  ruby -v

 

99  cd /opt/metasploit-framework/

102  rvm –default use ruby-2.6.6@metasploit-framework

 

104  gem install bundler

105  bundler install

106  bash -c ‘for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done’

107  cd

108  curl -# -o /tmp/armitage.tgz http://www.fastandeasyhacking.com/download/armitage150813.tgz

109  ls

110  tar -xvzf /tmp/armitage.tgz -C /opt

111  ln -s /opt/armitage/armitage /usr/local/bin/armitage

112  ln -s /opt/armitage/teamserver /usr/local/bin/teamserver

113  sh -c “echo java -jar /opt/armitage/armitage.jar \$\* > /opt/armitage/armitage”

114  perl -pi -e ‘s/armitage.jar/\/opt\/armitage\/armitage.jar/g’ /opt/armitage/teamserver

115  vim /opt/metasploit-framework/config/database.yml

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

116  sh -c “echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/config/database.yml >> /etc/profile”

117  source /etc/profile

 

 

cd /opt/metasploit-framework/

msfconsole

——————————————–

apt-get install somelibs

apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev zlib1g-dev

apt-get install libxml2-dev libxslt1-dev vncviewer libyaml-dev ruby1.9.3 ruby-dev

apt-get install svn

apt-get install nmap

apt-get install rvm

apt-get install libpq-dev

apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev

apt-get install openssl ruby-openssl libssl-dev

rbenv install 2.6.2

rbenv global 2.6.2

 

su postgres
createuser msf -P -S -R -D

createdb -O msf msf

 

git clone git://github.com/sstephenson/rbenv.git .rbenv

echo ‘export PATH=”$HOME/.rbenv/bin:$PATH”‘ >> ~/.bashrc

echo ‘eval “$(rbenv init -)”‘ >> ~/.bashrc

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

echo ‘export PATH=”$HOME/.rbenv/plugins/ruby-build/bin:$PATH”‘ >> ~/.bashrc

git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo

 

git clone https://github.com/rapid7/metasploit-framework.git

cd metasploit-framework/

rvm –default use ruby-2.1.6@metasploit-framework

cd metasploit-framework/

bash -c ‘for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done’

vim /opt/metasploit-framework/config/database.yml

sh -c “echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/config/database.yml >> /etc/profile”

 

curl -# -o /tmp/armitage.tgz http://www.fastandeasyhacking.com/download/armitage150813.tgz

tar -xvzf /tmp/armitage.tgz -C /opt

ln -s /opt/armitage/armitage /usr/local/bin/armitage

ln -s /opt/armitage/teamserver /usr/local/bin/teamserver

sh -c “echo java -jar /opt/armitage/armitage.jar \$\* > /opt/armitage/armitage”

perl -pi -e ‘s/armitage.jar/\/opt\/armitage\/armitage.jar/g’ /opt/armitage/teamserver

 

vim /opt/metasploit-framework/config/database.yml

sh -c “echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/config/database.yml >> /etc/profile”

 

gem install rubylibs -v ‘1.2.3’

gem install bundler
gem install nokogiri -v ‘1.10.4’
gem install bcrypt -v ‘3.1.12’
gem install ed25519 -v ‘1.2.4’
gem install json -v ‘2.2.0’
gem install msgpack -v ‘1.3.1’
gem install redcarpet -v ‘3.5.0’
gem install sqlite3 -v ‘1.3.13’

 

Comment

please input captcha *