Apple Mac OS x install Metasploit_ruby topic

Source: Internet
Author: User
Tags postgresql rehash git clone




Several steps to install:






0x00-from GitHub clone Metasploit project to local;






0x01-installation of PostgreSQL and configuration;






0x02-installs specific versions of Ruby, and resolves dependencies;






0x00 clones the Metasploit project from the GitHub to the local






Say GitHub is really everything, a lot of good projects can be found on the top, first open the terminal and enter the following command, because the 10.9.3 with git, so there is no need to install a different




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



After cloning locally, add the configuration file in the metasploit-framework/config/directory: DATABASE.YML to the environment variable (database.yml may not exist, copy database.yml.example directly)






Add the following configuration to the $home/.bash_profile or other configuration file




Export MSF_DATABASE_CONFIG=/USR/LOCAL/SHARE/METASPLOIT-FRAMEWORK/CONFIG/DATABASE.YML



0x01 Install PostgreSQL and configure






Metasploit after downloading, do not rush to configure, because the Metasploit default database PostgreSQL not yet installed






You can use brew directly to download and install PostgreSQL automatically, and you can run the following command




Brew Install PostgreSQL--without-ossp-build



Wait for automatic installation complete, after completion, initialize PostgreSQL (if there are errors delete/usr/local/var/postgres, and try again)




Initdb/usr/local/var/postgres



After initialization, add the database user to the Metasploit and create the corresponding DB




CreateUser msf-p-h localhost

createdb-o MSF msf-h localhost



(The above parameters do not understand, we can Baidu, here is not to do too much explanation)






When the above steps are complete, you need to change the Metasploit database connection configuration, which is the Database.yml file in the first step.






In Database.yml, the information is modified as follows




Production:

adapter:postgresql

database:msf

username:msf

Password: <your

password> host:127.0.0.1

port:5432

pool:75

timeout:5



When you are done, go to step three!






(can add Alisa to make it easy to start each time PostgreSQL)




Alias pg_start= ' pg_ctl-d/usr/local/var/postgres-l/usr/local/var/postgres/server.log start '

alias pg_stop= ' Pg_ ctl-d/usr/local/var/postgres Stop '



0X02 installs specific versions of Ruby and resolves dependencies






When it comes to multiple versions of Ruby management, it's going to be rbenv with the most power tools (you can find it on GitHub, or you can use brew to install it directly)




Brew Install rbenv Ruby-build



After the rbenv installation is complete, add the following settings in $host/.bash_profile or other configuration files




Eval "$ (rbenv init-)"



Below you can install a specific version of Ruby by Rbenv, listing the currently available Ruby versions




Rbenv Install--list



You can see that almost all Ruby versions are available, and here we choose to install ruby-1.9.3-p547 (because the OS X 10.9.3 has a ruby version of 2.0.0, which can cause problems in some places)




Rbenv Install 1.9.3-p547



This may wait a while, Rbenv will install each version of Ruby under $host/.rbenv/versions/, and when finished, set the downloaded version to the system default




Rbenv Rehash

rbenv Global 1.9.3-p547



When you are done, reopen the terminal and enter Ruby–version to see that the current default Ruby version has been set to 1.9.3-p547






Install bundle below to resolve dependency issues




Gem Install bundle



Installation, you may have a connection problem, try more than a few times






Bundle after installation, re-enter the Metasploit's home directory to resolve Module pack dependencies




Cd/usr/local/share/metasploit-framework

rbenv Rehash

Bundle install



(in the process of bundle install, a specific version of the module may have failed to install the problem, the solution: According to the gemfiles version limit, the use of gem to install the replacement version, complete, delete the Gemfiles.lock, rerun bundle Install






After the dependency is resolved, you can run the Msfconsole in the directory to start the Metasploit Terminal controller (PostgreSQL is started, or the database will not be connected)






MSF commands can be bulk ln to bin




For MSF in $ (LS msf*); Do ln-s/usr/local/share/metasploit-framework/$MSF/usr/local/bin/$MSF;d One



Here is the screenshot after the completion










Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.