Advertisement
Guest User

Install metasploit-framework from git on kali wheezy 1.1.0a

a guest
Dec 23rd, 2016
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.97 KB | None | 0 0
  1. This manual is applied for those that like to use metasploit but do not want to change to systemd linux (kali sana/rolling) .
  2. Staying in 1.1.0a will not update metaploit with "msfupdate" because wheezy repositories of kali are not maintained anymore .
  3.  
  4. Steps to achieve :
  5. - change repositories
  6. - remove old metasploit from kali wheezy
  7. - install metasploit dependencies and ruby
  8. - install ruby 2.33
  9. - clone metasploit from git
  10. - configure metasploit and postgresql 9.1
  11. - configure new path environment for metasploit-framework
  12.  
  13. Change repositories :
  14. add debian wheezy repositories to /etc/apt/sources.list
  15. Your sources list should have only these repositories :
  16. nano /etc/apt/sources.list
  17. deb http://old.kali.org/kali moto main non-free contrib
  18. deb-src http://old.kali.org/kali moto main non-free contrib
  19. deb http://httpredir.debian.org/debian wheezy main contrib non-free
  20. deb-src http://httpredir.debian.org/debian wheezy main contrib non-free
  21. deb http://httpredir.debian.org/debian wheezy-updates main contrib non-free
  22. deb-src http://httpredir.debian.org/debian wheezy-updates main contrib non-free
  23. deb http://security.debian.org/ wheezy/updates main contrib non-free
  24. deb-src http://security.debian.org/ wheezy/updates main contrib non-free
  25.  
  26.  
  27. update your system with :
  28.  
  29. apt-get update && apt-get upgrade
  30.  
  31. -remove old metasploit-framework previous installed in kali 1.1.0a
  32.  
  33. apt-get remove --purge metasploit-framework
  34.  
  35. * : armitage will be removed as also postgresql , but we will install postgresql later
  36.  
  37. install metasploit dependencies , postgresql & ruby
  38.  
  39. apt-get install postgresql python-software-properties libxslt1-dev libffi-dev autoconf bison build-essential libreadline-dev curl git-core libapr1 libaprutil1 libcurl4-openssl-dev libgmp3-dev libpcap-dev libpq-dev libreadline6-dev libsqlite3-dev libssl-dev libsvn1 libtool libxml2 libxml2-dev libxslt-dev libyaml-dev locate ncurses-dev openssl postgresql postgresql-contrib wget xsel zlib1g zlib1g-dev -y
  40.  
  41.  
  42. - install ruby 2.33
  43.  
  44. gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  45. curl -sSL https://get.rvm.io | bash -s stable --ruby
  46. /bin/bash --login
  47. rvm install 2.3.3
  48. rvm use 2.3.3
  49.  
  50.  
  51. - clone metasploit from git to /opt/
  52.  
  53. cd /opt
  54. git clone https://github.com/rapid7/metasploit-framework.git
  55. cd metasploit-framework
  56.  
  57.  
  58. - configure metasploit and postgresql 9.1
  59.  
  60. gem install bundler
  61. gconftool-2 --set --type boolean /apps/gnome-terminal/profiles/Default/login_shell true
  62. bundle install
  63. service postgresql start
  64. cat <<EOF> $HOME/pg-utf8.sql
  65. update pg_database set datallowconn = TRUE where datname = 'template0';
  66. \c template0
  67. update pg_database set datistemplate = FALSE where datname = 'template1';
  68. drop database template1;
  69. create database template1 with template = template0 encoding = 'UTF8';
  70. update pg_database set datistemplate = TRUE where datname = 'template1';
  71. \c template1
  72. update pg_database set datallowconn = FALSE where datname = 'template0';
  73. \q
  74. EOF
  75. sudo -u postgres psql -f $HOME/pg-utf8.sql
  76. sudo -u postgres createuser msfdev -dRS
  77. sudo -u postgres psql
  78. "ALTER USER msfdev with ENCRYPTED PASSWORD 'msf';"
  79.  
  80. Press CTRL+D to exit
  81.  
  82. sudo -u postgres createdb --owner msfdev msf_dev_db
  83. sudo -u postgres createdb --owner msfdev msf_test_db
  84. cat <<EOF> $HOME/.msf4/database.yml
  85. # Development Database
  86. development: &pgsql
  87. adapter: postgresql
  88. database: msf_dev_db
  89. username: msfdev
  90. password: msf
  91. host: localhost
  92. port: 5432
  93. pool: 5
  94. timeout: 5
  95.  
  96. # Production database -- same as dev
  97. production: &production
  98. <<: *pgsql
  99.  
  100. # Test database -- not the same, since it gets dropped all the time
  101. test:
  102. <<: *pgsql
  103. database: msf_test_db
  104. EOF
  105. service postgresql start
  106. sudo -sE su postgres
  107. psql
  108. update pg_database set datallowconn = TRUE where datname = 'template0';
  109. \c template0
  110. update pg_database set datistemplate = FALSE where datname = 'template1';
  111. drop database template1;
  112. create database template1 with template = template0 encoding = 'UTF8';
  113. update pg_database set datistemplate = TRUE where datname = 'template1';
  114. \c template1
  115. update pg_database set datallowconn = FALSE where datname = 'template0';
  116. \q
  117.  
  118. We have to setup the password for msfdev again because i was unable to figure out why msfconsole says password is wrong .
  119.  
  120. sudo -u postgres psql
  121. \password msfdev
  122.  
  123. Write for password & confirm it : msf
  124. Press CTRL+D to exit
  125.  
  126.  
  127. service postgresql restart
  128.  
  129. - configure new path environment for metasploit-framework
  130.  
  131. export PATH=/opt/metasploit-framework/:$PATH
  132.  
  133.  
  134. After this point you can write "msfconsole" on your terminal anywhere that will open metasploit-framework .
  135. To update metasploit write "msfupdate"
  136.  
  137. Remember that postgresql must start before "msfconsole" , so msf can connect to its database .
  138.  
  139. Write on terminal :
  140. service postgresql start
  141.  
  142. This manual was written by pedropt for Kali "How TO" forum , the reason that is on pastebin is because kali server detects sql entries in the post and block the post automatically .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement