[Installing Metasploit Framework on CentOS_RHEL 6]在CentOS_RHEL 6上安裝Metasploit的架構【翻譯】

來源:互聯網
上載者:User

標籤:style   blog   http   java   color   使用   

[Installing Metasploit Framework on CentOS_RHEL 6]在CentOS_RHEL 6上安裝Metasploit的架構【翻譯】

 

標記聲明:藍色漢子為翻譯上段英文內容,黃色文字為執行命令。英文水平有限,如有疏漏還請指出。文章出處 部落格園-初行

All command in the guide need to be ran as root. To switch to root and have all the proper variables run:

在本教程中的所有命令需要使用root賬戶。切換到root賬戶保證所變數正確執行:

su -

 

Installing Dependencies

安裝依賴關係

We start by making sure that we have the latest packages by updating the system using yum:

首先,我們要確保我們所使用yum更新系統擁有最新的軟體包:

yum update

yum upgrade

 

Now that we know that we are running an updated system we can install all the dependent packages that are needed by Metasploit Framework:

現在我們知道,我們正在運行一個更新過的系統,我們可以安裝所有需要通過Metasploit的架構的依賴包:

yum groupinstall ‘Development Tools‘

yum install sqlite-devel libxslt-devel libxml2-devel java-1.7.0-openjdk libpcap-devel nano openssl-devel zlib-devel libffi-devel gdbm-devel readline-devel nano wget

 

Installing Ruby 1.9.3

安裝Ruby1.9.3

CentOS/RHEL is a solid operating system but sadly it does not tend to run the latest in term of packages so we have to compile and install by hand the YAML and Ruby 1.9.3 software.

CentOS/ RHEL作業系統非常的穩定,但遺憾的是它對最新的軟體包不能很好支援,所以我們要手動編譯和安裝YAML和Ruby1.9.3。

First we download and install the latest version of YAML.

首先我們下載並安裝最新的YAML版本。

cd /usr/src

wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz

tar zxf yaml-0.1.4.tar.gz

cd yaml-0.1.4

./configure --prefix=/usr/local

make && make install

 

Now we download and install the latest version of Ruby 1.9.3

現在,我們下載並安裝Ruby1.9.3的最新版本

cd /usr/src

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p374.tar.gz

tar xvzf ruby-1.9.3-p374.tar.gz

cd ruby-1.9.3-p374

./configure --prefix=/usr/local --with-opt-dir=/usr/local/lib

make & make install

 

Installing Nmap

安裝Nmap

One of the external tools that Metasploit uses for scanning that is not included with the sources is Nmap. Here we will cover downloading the latest source code for Nmap, compiling and installing:

其中一個是Metasploit的使用掃描的外部工具,Nmap不包含在源中。在這裡,我們將介紹用於下載Nmap的最新的原始碼,編譯和安裝:

cd /usr/src

svn co https://svn.nmap.org/nmap

cd nmap

./configure

make

make install

make clean

 

Configuring Postgre SQL Server

配置Postgre的SQL Server

The version that comes with CentOS/RHEL is quite old so we need to modify our system to install the latest from PostgreSQL directly. Open /etc/yum.repos.d/CentOS-Base.repo and add to the [base] and [update] sections:

CentOS/ RHEL中附帶的版本很老,所以我們需要修改我們的系統可以直接安裝最新的PostgreSQL的。開啟/ etc / yum.repos.d/ CentOS-Base.repo,並加入到[base]和[updatge]部分:

exclude=postgresql*

 

Now we can install the Postgres official repository for CentOS 6 x64:

現在我們可以安裝Postgres的官方庫在CentOS6 x64的:

wget http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm

rpm -ivh pgdg-centos92-9.2-6.noarch.rpm

 

for X86 download: http://yum.postgresql.org/9.2/redhat/rhel-6-i386/pgdg-redhat92-9.2-7.noarch.rpm

X86版本的:

 

Fot RHEL 6 x64

對於REHEL 6 x64版本

wget http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-redhat92-9.2-7.noarch.rpm

rpm -ivh pgdg-redhat92-9.2-7.noarch.rpm

 

for x86 download http://yum.postgresql.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm

X86版本的:

 

To install Postgres and the necessary files we use yum:

要安裝Postgres,我們必須使用的yum檔案:

yum update

yum install postgresql92-server postgresql92-devel postgresql92

 

Now we initialize the server and configure it for automatic startup:

現在我們初始化伺服器並將其配置為自動啟動:

service postgresql-9.2 initdb

service postgresql-9.2 start

chkconfig postgresql-9.2 on

 

For when we compile the necessary gem for ruby we need to add the new install to our path so the compiler can find the binaries and libraries:

因為當我們編譯所需的ruby gem包時我們需要添加新安裝路徑到我們的環境變數(path),這樣編譯器可以找到二進位檔案和庫:

echo export PATH=/usr/pgsql-9.2/bin:\$PATH >> /etc/bashrc

source ~/.bashrc

 

We start by switching to the Postgres user so we can create the user and database that we will use for Metasploit

首先,我們切換到Postgres使用者,這樣可以建立我們將使用的Metasploit使用者和資料庫。

su - postgres

 

Now we create the user and Database, do record the database that you gave to the user since it will be used in the database.yml file that Metasploit and Armitage use to connect to the database.

現在,我們建立使用者和資料庫,並記錄您給了使用者,因為它會在Metasploit和Armitage 用於串連到資料庫的database.yml檔案要使用的資料庫。

createuser msf -P -S -R -D

createdb -O msf msf

exit

exit

 

To allow the user we created to connect to Postgres we need to add to /var/lib/pgsql/9.2/data/pg_hba.conf file the following lines above the rest of the other configured settings:

要允許我們建立的使用者串連到Postgres,我們需要添加以下行到/ var/lib/pgsql/9.2/data/pg_hba.conf檔案上面的其他設定的其餘部分:

local msf msf md5

hostmsf msf 127.0.0.1/8 md5

hostmsf msf ::1/128 md5

 

Restart the service:

重新啟動服務:

service postgresql-9.2 start

 

Installing Metasploit Framework

安裝Metasploit的架構

Once the packages have been install we need to install the required Ruby libraries that metasploit depends on:

一旦包已經安裝,我們需要安裝所需的Ruby庫的Metasploit取決於:

gem install wirble pg sqlite3 msgpack activerecord redcarpet rspec simplecov yard bundler

 

We will download the latest version of Metasploit Framework via Git so we can use msfupdate to keep it updated:

我們將下載的Metasploit Framework的最新版本通過Git的,所以我們可以使用msfupdate保持更新:

cd /opt

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

cd metasploit-framework

 

Lets create the links to the commands so we can use them under any user and not being under the framework folder:

讓我們建立於命令的連結,這樣我們就可以使用它們在任何使用者,而不是根據架構檔案夾為:

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

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

 

From the Metasploit-Framework folder lets use the Bundler Gem to install the properly supportted Gem versions:

從Metasploit架構檔案夾允許使用Bundler Gem安裝正確的被支援 gem版本:

bundle install

 

Lets create the database.yml file that will contain the configuration parameters that will be use by framework:

讓我們建立一個被架構使並用包含配置參數的database.yml檔案:

nano /opt/metasploit-framework/database.yml

 

Copy the YAML entries and make sure you provide the password you entered in the user creating step in the password field for the database:

複製YAML項目,並確保您提供您建立的步驟在密碼欄位為資料庫中的使用者輸入的密碼:

production:

 adapter: postgresql

 database: msf

 username: msf

 password: 

 host: 127.0.0.1

 port: 5432

 pool: 75

 timeout: 5

 

Create and environment variable so it is loaded by Armitage and by msfconsole when running and load the variable in to your current shell:

由Armitage建立環境變數並,msfconsole運行時載入變數到當前的shell:

echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/database.yml >> /etc/bashrc

source ~/.bashrc

 

First Run

首次運行

Now we are ready to run Metasploit for the first time. My recommendation is to run it first under a regular user so the folders create under your home directory have the proper permissions. First time it runs it will create the entries needed by Metasploit in the database so it will take a while to load.

現在,我們已經準備好運行Metasploit的第一次。我的建議是先以普通使用者身份下運行它,因此檔案夾你的home目錄下建立具有適當的許可權。首次運行時會在資料庫中建立所需的Metasploit項目,以便將需要一段時間來載入。

msfconsole

 

原文地址:http://www.darkoperator.com/msf-centosrhel/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.