[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/

[Installing Metasploit Framework on CentOS_RHEL 6]在CentOS_RHEL 6上安装Metasploit的框架【翻译】的更多相关文章

  1. Metasploit Framework(6)客户端渗透(上)

    文章的格式也许不是很好看,也没有什么合理的顺序 完全是想到什么写一些什么,但各个方面都涵盖到了 能耐下心看的朋友欢迎一起学习,大牛和杠精们请绕道 前五篇文章讲解了Metasploit Framewor ...

  2. 在CentOS_RHEL 6上安装Metasploit的框架

    https://github.com/rapid7/metasploit-framework/wiki/Nightly-Installers 1. shyum update curl https:// ...

  3. Installing Metasploit Framework on Ubuntu 14.04 LTS and Debian 7

    原文链接:http://www.darkoperator.com/installing-metasploit-in-ubunt/ This Guide covers the installation ...

  4. 安装Windows Metasploit Framework

    Installing the Metasploit Framework on Windows 1. Visit http://windows.metasploit.com/metasploitfram ...

  5. Metasploit Framework(8)后渗透测试(一)

    文章的格式也许不是很好看,也没有什么合理的顺序 完全是想到什么写一些什么,但各个方面都涵盖到了 能耐下心看的朋友欢迎一起学习,大牛和杠精们请绕道 使用场景: Kali机器IP:192.168.163. ...

  6. Metasploit Framework(4)信息收集

    文章的格式也许不是很好看,也没有什么合理的顺序 完全是想到什么写一些什么,但各个方面都涵盖到了 能耐下心看的朋友欢迎一起学习,大牛和杠精们请绕道 使用场景: Kali机器一台:192.168.163. ...

  7. Metasploit Framework(1)基本命令、简单使用

    文章的格式也许不是很好看,也没有什么合理的顺序 完全是想到什么写一些什么,但各个方面都涵盖到了 能耐下心看的朋友欢迎一起学习,大牛和杠精们请绕道 基本的控制台命令介绍: banner 查看metasp ...

  8. Kali之Metasploit Framework环境配置

    运行Metasploit Framework 依照Kali Linux网络服务策略,Kali没有自动启动的网络服务,包括数据库服务在内.所以为了让Metasploit以支持数据库的方式运行有些必要的步 ...

  9. Docker Metasploit Framework

    https://hub.docker.com/r/usertaken/metasploit-framework/ docker pull usertaken/metasploit-framework ...

随机推荐

  1. 洛谷.4015.运输问题(SPFA费用流)

    题目链接 嗯..水题 洛谷这网络流二十四题的难度评价真神奇.. #include <queue> #include <cstdio> #include <cctype&g ...

  2. AppleScript脚本学习记录《二》

    关于AppleScript 说到AppleScript,可能涉及到三个含义: 1.AppleScript语言:就是苹果脚本的语言,用来编写运行于Mac系统的脚本. 2.AppleScript脚本:就是 ...

  3. ajax请求的完整步骤

    AJAX = 异步JavaScript和XML,可以使网页实现异步更新,达到局部更新的目的. 一.AJAX请求步骤如下: 1.创建XMLHttpRequest对象 var xhr; if(window ...

  4. Spark Client启动原理探索

    经过几天闲暇时间的学习,终于又理解的深入了一些,关于Spark Client如何提交作业也更清晰了点. 在整体的流程图上是这样的: 大体的思路就是应用程序通过SparkSubmit提交程序后,自动在当 ...

  5. windows 启动关闭Oracle监听和服务

    经常要用数据库,让他自己启动的话,开机太慢,所以用命令启动方便点.    1.开启:     在运行中输入cmd,进入控制台,lsnrctl start回车,提示启动监听成功后 net start O ...

  6. java maven打包jar 方法参数名变var1,var2之类的无意义参数名怎么办

    这是idea 对.class反编译的结果.要想看完整源码,可以使用maven-source-plugin,在pom.xml里配置: <plugin> <groupId>org. ...

  7. UnityEditor研究学习之EditorWindow

    在unity使用过程中,其实我们都是在各个不同功能的Window下工作. 比如在Scene窗口中操作物体,在Inspector中操作物体属性,在Game视窗中观察游戏状态. 所以窗口是Unity的灵魂 ...

  8. Js 判断浏览器类型整理

    判断原理 JavaScript是前端开发的主要语言,我们可以通过 编写JavaScript程序来判断浏览器的类型及版本.JavaScript判断浏览器类型一般有两种办法,一种是根据各种浏览器独有的属性 ...

  9. HTML5 Selection对象

    一.实例1,设置网页选中内容并且复制到黏贴板 <p id='txtone'>发的FDSAFSDFDS!其实不管哪个行业, <img src='http://beijing.gongj ...

  10. Python中Queue模块及多线程使用

    Python的Queue模块提供一种适用于多线程编程的FIFO实现.它可用于在生产者(producer)和消费者(consumer)之间线程安全(thread-safe)地传递消息或其它数据,因此多个 ...