在本章中,咱们将会学习如下内容:html
一、在Windows上安装Metasploitjava
二、在Linux和MacOS上安装Metasploitpython
三、在Kali Linux中使用 Metasploitios
四、使用虚拟化软件构建渗透测试实验环境git
五、配置SSH链接github
六、使用SSH链接Kalisql
七、为Metaspolit配置PostgreSQL数据库shell
八、建立工做区数据库
九、使用数据库ubuntu
十、使用hosts命令
十一、理解services命令
Metasploit 是目前世界上领先的渗透测试工具,也是信息安全与渗透测试领域最大的开源项目之一。它完全改变了咱们执行安全测试的方式。Metasploit
之因此流行,是由于它能够执行普遍的安全测试任务,从而简化渗透测试的工做。Metasploit
适用于全部流行的操做系统,本书中,主要以Kali Linux
为主。由于Kali Linux
预装了 Metasploit
框架和运行在框架上的其余第三方工具。
框架和相关术语简介:
Metasploit Framework
:这是一个免费的、开源的渗透测试框架,由 H.D.Moore
在 2003 年发布,后来被 Rapid7
收购。当前稳定版本是使用 Ruby
语言编写的。它拥有世界上最大的渗透测试攻击数据库,每一年超过100万次的下载。它也是迄今为止使用 Ruby
构建的最复杂的项目之一。
Vulnerability
:容许攻击者入侵或危害系统安全性的弱点称为漏洞,漏洞可能存在于操做系统,应用软件甚至网络协议中。
Exploit
:攻击代码或程序,它容许攻击者利用易受攻击的系统并危害其安全性。每一个漏洞都有对应的漏洞利用程序。Metasploit
有超过 1700
个漏洞利用程序。
Payload
:攻击载荷。它主要用于创建攻击者和受害者机器直接的链接,Metasploit
有超过 500
个有效攻击载荷。
Module
:模块是一个完整的构件,每一个模块执行特定的任务,并经过几个模块组成一个单元运行。这种架构的好处是能够很容易的将本身写的利用程序和工具集成到框架中。
Metasploit
框架具备模块化的体系结构,exploits、payload、encoders
都是独立的模块:
Metasploit
提供两种不一样的UI
,msfconsole
和WebUI
,本书中主要使用msfconsole
接口。由于msfconsole
对Metasploit
支持最好,可使用全部功能。
在Windows
上安装Metasploit
很是简单,直接从官方下载(www.metasploit.com/download).安装文件进行安装便可。
Metasploit
的四个版本:
Pro
:适用于渗透测试人员和IT安全团队
Express
:适用于通常IT人员
Community
:适用于小公司和学生
Framework
:适用于开发人员和安全研究人员
请从官网下载最新版的 Metasploit Framework
(windows.metasploit.com/metasploitf… 它包含控制台程序和其余依赖程序。
下载完以后,运行便可,它将自动安装相关全部组件。
Tip:在Windows
上安装Metasploit
时候,应该禁用防御软件,由于可能会检测到一些安装文件为恶意程序,从而阻止安装过程。安装完后将 Metasploit
加入到防御软件的白名单。
经过如下快速安装脚本导入Rapid7
签名密钥并为受支持的Linux
和macOS
系统设置程序包:
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall
复制代码
软件包将集成到系统的包管理器中,可使用 msfupdate
命令或包管理器进行更新。
安装过程差很少是这样的:
bcook@localhost:~$ uname -a
Linux localhost 3.14.0 #1 SMP PREEMPT Mon Feb 6 21:59:30 PST 2017 armv7l armv7l armv7l GNU/Linux
bcook@localhost:~$ curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
> chmod 755 msfinstall && \
> ./msfinstall
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5394 100 5394 0 0 5609 0 --:--:-- --:--:-- --:--:-- 5607
Switching to root user to update the package
[sudo] password for bcook:
Adding metasploit-framework to your repository list..OK
Updating package cache..OK
Checking for and installing update..
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
metasploit-framework
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 148 MB of archives.
After this operation, 358 MB of additional disk space will be used.
Get:1 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid/main armhf metasploit-framework armhf 4.13.23+20170217143300.git.1.85dca6a~1rapid7-1 [148 MB]
Fetched 148 MB in 19s (7743 kB/s)
Selecting previously unselected package metasploit-framework.
(Reading database ... 28449 files and directories currently installed.)
Preparing to unpack .../metasploit-framework_4.13.23+20170217143300.git.1.85dca6a~1rapid7-1_armhf.deb ...
Unpacking metasploit-framework (4.13.23+20170217143300.git.1.85dca6a~1rapid7-1) ...
Setting up metasploit-framework (4.13.23+20170217143300.git.1.85dca6a~1rapid7-1) ...
update-alternatives: using /opt/metasploit-framework/bin/msfbinscan to provide /usr/bin/msfbinscan (msfbinscan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfconsole to provide /usr/bin/msfconsole (msfconsole) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfd to provide /usr/bin/msfd (msfd) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfdb to provide /usr/bin/msfdb (msfdb) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfelfscan to provide /usr/bin/msfelfscan (msfelfscan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfmachscan to provide /usr/bin/msfmachscan (msfmachscan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfpescan to provide /usr/bin/msfpescan (msfpescan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfrop to provide /usr/bin/msfrop (msfrop) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfrpc to provide /usr/bin/msfrpc (msfrpc) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfrpcd to provide /usr/bin/msfrpcd (msfrpcd) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfupdate to provide /usr/bin/msfupdate (msfupdate) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfvenom to provide /usr/bin/msfvenom (msfvenom) in auto mode
Run msfconsole to get started
W: --force-yes is deprecated, use one of the options starting with --allow instead.
bcook@localhost:~$ msfconsole //启动msfconsole
** Welcome to Metasploit Framework Initial Setup **
Please answer a few questions to get started.
Would you like to use and setup a new database (recommended)? y //是否设置数据库
Creating database at /home/bcook/.msf4/db
Starting database at /home/bcook/.msf4/db...success
Creating database users
Creating initial database schema
** Metasploit Framework Initial Setup Complete **
=[ metasploit v4.13.23-dev-584850f1f8a1a74b69b5cea16c700c9fd1b8e4c6]
+ -- --=[ 1622 exploits - 924 auxiliary - 282 post ]
+ -- --=[ 472 payloads - 39 encoders - 9 nops ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
msf >
复制代码
在MacOS
中手动安装Metasploit
最新的OS X
安装程序包也能够直接在这里下载:osx.metasploit.com/metasploitf…
下载完后安装便可,安装完后,使用/opt/metasploit-framework/bin/msfconsole
启动msfconsole
。
Kali Linux
是最受安全从业人员欢迎的操做系统,第1、它预装了几乎全部流行的渗透测试工具,下降了使用成本,其次它是基于Linux
的操做系统,具备可靠的稳定性和安全性。
你能够在物理机上安装Kali Linux
,也能够在虚拟机中安装它,安装过程很是简单。
在Kali Linux
设置Metasploit
开发环境能够用如下命令:
sudo apt update
sudo apt -y install autoconf bison build-essential 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
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework
rvm --install $(cat .ruby-version)
gem install bundler
bundle install
复制代码
你能够从Kali
官网下载(www.kali.org)Kali Linux
ISO镜像文件,用来制做USB启动盘或者制做DVD-ROM光盘。你能够将Kali Linux
安装到硬盘上或者直接使用 Live CD
模式。也能够在虚拟机中安装Kali Linux
。
本书中,咱们将使用 Kali Linux
虚拟机。
一、从官网下载 Kali Vmware
虚拟机文件,导入到Vmware Workstation
中,启动系统,输入用户名和密码便可登陆到Kali
中,root
默认密码是toor
。
二、成功登陆后,直接从 应用程序 菜单中启动 Metasploit
Tip:从应用程序菜单启动 Metasploit
后,将自动设置PostgreSQL
数据库,它将建立数据库用户,建立msf
和msf_test
数据库,配置Metasploit
使用数据库,并经过如下命令启动msfconsole
:(这是自动的,不须要手动执行下面的命令)
service postgresql start && msfdb init && msfconsole
复制代码
过程以下:
或者你能够直接在终端中运行msfconsole
启动Metasploit
升级Kali Linux
很是简单,建议按期升级以得到最新的安全更新。若要升级,可使用 apt update
,而后使用 apt upgrade
进行升级,这种方法是在不删除任何包的状况下升级已安装的包。若是要升级大的版本和重要更新。可使用apt full-upgrade
进行彻底升级,这种方式将会删除过期的软件包和安装新的依赖。
构建一个渗透测试实验环境是很是有必要的。它容许你在一个安全的环境中练习和测试,由于直接针对真实系统攻击测试是违法的。使用虚拟机构建渗透测试实验环境具备可移植性,灵活性和低维护成本。而且能够构建多种操做系统,设置复杂的网络场景,并在多个目标上执行渗透测试。
选择你喜欢的虚拟化软件,好比 Vmware Workstation、VirtualBox、Hyper-V
等
咱们须要构建的渗透测试实验环境拓扑以下:
包含 Kali Linux
,Linux
服务器和Windows
服务器以及一台Windows 10
客户机。
固然你能够根据本身的喜爱来构建。
Kali Linux:直接从Kali
官网下载安装就行
Linux服务器:能够从 SourceForge
下载 Metasploitable2
: sourceforge.net/projects/me…
Windows 10 客户机:能够从微软开发者网站下载 90天评估版: developer.microsoft.com/en-us/micro…
Windows Server:咱们经过Metasploitable 3
来构建。在Windows
上运行build_win2008.sh
进行构建。
Metasploitable 3
(github.com/rapid7/meta…
构建过程不作详细描述
要配置远程登陆Kali Linux
,首先咱们须要更改默认的root
密码并生成新的SSH
密钥。
使用passwd
命令修改root
密码
root@osboxes:~# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@osboxes:~#
复制代码
从新配置SSH
主机密钥很是简单,首先删除当前的SSH
主机密钥,而后使用dpkg-reconfigure openssh-server
命令从新生成密钥便可。
root@osboxes:~# rm /etc/ssh/ssh_host_*
root@osboxes:~# dpkg-reconfigure openssh-server
Creating SSH2 RSA key; this may take some time ...
2048 SHA256:1FN10l0k50Ng/dpeLIXTPmFGyupZB22hk4JNQC1aKcI root@osboxes (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:37c9q4AwOW4wEwUoEpQ1Jz/KXIYJfV53ORWeGBzONdI root@osboxes (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:ky1bOQlbMFIMB0si0w7Msv32fpSeza6lZeHn8OevGdU root@osboxes (ED25519)
rescue-ssh.target is a disabled or a static unit, not starting it.
复制代码
咱们还须要编辑OpenSSH
服务配置文件:/etc/ssh/sshd_config
,将#PermitRootLogin without-password
更改成PermitRootLogin yes
,从而容许root
远程登陆。
若要设置SSH服务开机启动,则执行systemctl enable ssh
便可
root@osboxes:~# systemctl enable ssh
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
复制代码
Tip:最好是将远程登陆配置为密钥登陆,而不是使用密码。
要链接到Kali Linux
,咱们只须要使用SSH客户端便可,大多数Unix,Linux和MacOS都已经安装了SSH客户端。若是使用的是Windows,能够安装PuTTY
等SSH客户端软件。
查看Kali
的IP
地址
root@osboxes:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:9f:99:bf brd ff:ff:ff:ff:ff:ff
inet 192.168.177.138/24 brd 192.168.177.255 scope global dynamic noprefixroute eth0
valid_lft 1784sec preferred_lft 1784sec
inet6 fe80::28ff:605:ed51:4ab7/64 scope link noprefixroute
valid_lft forever preferred_lft forever
复制代码
使用SSH
客户端链接到Kali
λ ssh root@192.168.177.138
The authenticity of host '192.168.177.138 (192.168.177.138)' can't be established.
ECDSA key fingerprint is SHA256:37c9q4AwOW4wEwUoEpQ1Jz/KXIYJfV53ORWeGBzONdI.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.177.138' (ECDSA) to the list of known hosts.
root@192.168.177.138's password:
Linux osboxes 4.14.0-kali3-amd64 #1 SMP Debian 4.14.12-2kali1 (2018-01-08) x86_64
The programs included with the Kali GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Linux osboxes 4.14.0-kali3-amd64 #1 SMP Debian 4.14.12-2kali1 (2018-01-08) x86_64
The programs included with the Kali GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@osboxes:~#
复制代码
Metasploit
的一个重要特性是支持PostgreSQL
数据库,使用它来存储渗透测试结果和漏洞信息。
启动服务,而后使用 Metasploit msfdb
初始化数据库
一、启动数据库
root@osboxes:~# systemctl start postgresql
复制代码
二、初始化数据库
~# msfdb init
Creating database user 'msf'
Enter password for new role:
Enter it again:
Creating databases 'msf' and 'msf_test'
Creating configuration file in /usr/share/metasploit-framework/config/database.yml
Creating initial database schema
复制代码
msfdb
还能够用来管理Metasploit Framework
数据库
root@osboxes:~# msfdb
Manage the metasploit framework database
msfdb init # start and initialize the database
msfdb reinit # delete and reinitialize the database
msfdb delete # delete database and stop using it
msfdb start # start the database
msfdb stop # stop the database
msfdb status # check service status
msfdb run # start the database and run msfconsole
复制代码
三、修改数据库配置文件
咱们能够直接编辑 database.yml
文件,文件位于/usr/share/metasploit-framework/config/database.yml
root@osboxes:~# cat /usr/share/metasploit-framework/config/database.yml
development:
adapter: postgresql
database: msf
username: msf
password: 9JHbuu/CdoGT0kvBiSXf+VLDRQ9dKKpMYyWKY6Ui2jc=
host: localhost
port: 5432
pool: 5
timeout: 5
production:
adapter: postgresql
database: msf
username: msf
password: 9JHbuu/CdoGT0kvBiSXf+VLDRQ9dKKpMYyWKY6Ui2jc=
host: localhost
port: 5432
pool: 5
timeout: 5
test:
adapter: postgresql
database: msf_test
username: msf
password: 9JHbuu/CdoGT0kvBiSXf+VLDRQ9dKKpMYyWKY6Ui2jc=
host: localhost
port: 5432
pool: 5
timeout: 5
复制代码
里面的usrname
和password
是默认配置的,你能够根据本身的喜爱进行更改
四、肯定是否链接到数据库
启动msfconsole
,而后执行db_status
,检查数据库链接状况。
msf > db_status
[*] postgresql connected to msf
msf >
复制代码
若是要手动链接到数据库,可使用以下命令:
db_connect <user:pass>@<host:port>/<database>
复制代码
咱们可使用databse.yml
文件测试db_connect
命令
msf > db_disconnect //断开链接
msf > db_status //查看链接状态
[*] postgresql selected, no connection
msf > db_connect
[*] Usage: db_connect <user:pass>@<host:port>/<database>
[*] OR: db_connect -y [path/to/database.yml]
[*] Examples:
[*] db_connect user@metasploit3
[*] db_connect user:pass@192.168.0.2/metasploit3
[*] db_connect user:pass@192.168.0.2:1500/metasploit3
msf > db_connect -y /usr/share/metasploit-framework/config/database.yml //链接数据库
[*] Rebuilding the module cache in the background...
msf > db_status //查看链接状态
[*] postgresql connected to msf
msf >
复制代码
Metasploit
中有工做区的概念,能够用来隔离不一样的渗透测试任务,从而避免混淆不一样的测试任务。
一、默认工做区
默认工做区是default
,输入workspace
查看
msf > workspace
* default
msf >
复制代码
输入workspace -h
查看命令帮助
msf > workspace -h
Usage:
workspace List workspaces
workspace -v List workspaces verbosely
workspace [name] Switch workspace
workspace -a [name] ... Add workspace(s)
workspace -d [name] ... Delete workspace(s)
workspace -D Delete all workspaces
workspace -r <old> <new> Rename workspace
workspace -h Show this help information
msf >
复制代码
二、新建工做区
使用workspace -a <workspacename>
命令添加新的工做区
msf > workspace -a book
[*] Added workspace: book
msf > workspace
default
* book
msf >
复制代码
三、删除工做区
使用workspace -d <workspacename>
命令删除工做区
msf > workspace -d book
[*] Deleted workspace: book
[*] Switched workspace: default
复制代码
四、更改工做区
使用workspace <workspacename>
命令更改工做区
msf > workspace book
[*] Workspace: book
复制代码
五、重命名工做区
使用workspace -r <workspacename> <workspacenewname>
重命名工做区
msf > workspace -r book msf
[*] Switched workspace: msf
msf >
复制代码
配置完数据库,咱们就可使用它了,首先咱们了解如何使用db_import
导入外部工具数据。
在msfconsole
中运行db_import
命令,查看支持的文件类型
msf > db_import
Usage: db_import <filename> [file2...]
Filenames can be globs like *.xml, or **/*.xml which will search recursively
Currently supported file types include:
Acunetix
Amap Log
Amap Log -m
Appscan
Burp Session XML
Burp Issue XML
CI
Foundstone
FusionVM XML
...
Wapiti XML
msf >
复制代码
一、导入nmap
扫描结果
先完成扫描,保存结果为 XML
文档
root@osboxes:~# nmap -Pn -A -oX report 192.168.177.139
复制代码
二、而后执行 db_import PATH
进行导入
msf > db_import /root/report
[*] Importing 'Nmap XML' data
[*] Import: Parsing with 'Nokogiri v1.8.5'
[*] Importing host 192.168.177.139
[*] Successfully imported /root/report
msf >
复制代码
三、固然也能够直接在msfconsole
中运行db_nmap
进行扫描,这样结果就直接保存到当前数据库中了,db_nmap
命令的参数与nmap
命令相同。
既然数据库中有了数据,就可使用hosts
命令来显示当前工做区中存储的全部主机了。
msf > hosts
Hosts
=====
address mac name os_name os_flavor os_sp purpose info comments
------- --- ---- ------- --------- ----- ------- ---- --------
192.168.177.139 00:0c:29:c6:a9:e5 Unknown device
msf >
复制代码
一、查看命令帮助hosts -h
msf > hosts -h
Usage: hosts [ options ] [addr1 addr2 ...]
OPTIONS:
-a,--add Add the hosts instead of searching
-d,--delete Delete the hosts instead of searching
-c <col1,col2> Only show the given columns (see list below)
-C <col1,col2> Only show the given columns until the next restart (see list below)
-h,--help Show this help information
-u,--up Only show hosts which are up
-o <file> Send output to a file in csv format
-O <column> Order rows by specified column number
-R,--rhosts Set RHOSTS from the results of the search
-S,--search Search string to filter by
-i,--info Change the info of a host
-n,--name Change the name of a host
-m,--comment Change the comment of a host
-t,--tag Add or specify a tag to a range of hosts
Available columns: address, arch, comm, comments, created_at, cred_count, detected_arch, exploit_attempt_count, host_detail_count, info, mac, name, note_count, os_family, os_flavor, os_lang, os_name, os_sp, purpose, scope, service_count, state, updated_at, virtual_host, vuln_count, tags
msf >
复制代码
services
命令做用是显示目标主机上可用的服务
查看命令帮助:
msf > services -h
Usage: services [-h] [-u] [-a] [-r <proto>] [-p <port1,port2>] [-s <name1,name2>] [-o <filename>] [addr1 addr2 ...]
-a,--add Add the services instead of searching
-d,--delete Delete the services instead of searching
-c <col1,col2> Only show the given columns
-h,--help Show this help information
-s <name1,name2> Search for a list of service names
-p <port1,port2> Search for a list of ports
-r <protocol> Only show [tcp|udp] services
-u,--up Only show services which are up
-o <file> Send output to a file in csv format
-O <column> Order rows by specified column number
-R,--rhosts Set RHOSTS from the results of the search
-S,--search Search string to filter by
Available columns: created_at, info, name, port, proto, state, updated_at
复制代码
一、显示全部可用服务
msf > services
Services
========
host port proto name state info
---- ---- ----- ---- ----- ----
192.168.177.142 22 tcp ssh open OpenSSH 5.3p1 Debian 3ubuntu4 Ubuntu Linux; protocol 2.0
192.168.177.142 80 tcp http open Apache httpd 2.2.14 (Ubuntu) mod_mono/2.4.3 PHP/5.3.2-1ubuntu4.30 with Suhosin-Patch proxy_html/3.0.1 mod_python/3.3.1 Python/2.6.5 mod_ssl/2.2.14 OpenSSL/0.9.8k Phusion_Passenger/4.0.38 mod_perl/2.0.4 Perl/v5.10.1
192.168.177.142 139 tcp netbios-ssn open Samba smbd 3.X - 4.X workgroup: WORKGROUP
192.168.177.142 143 tcp imap open Courier Imapd released 2008
192.168.177.142 443 tcp ssl/https open
192.168.177.142 445 tcp netbios-ssn open Samba smbd 3.X - 4.X workgroup: WORKGROUP
192.168.177.142 5001 tcp java-rmi open Java RMI
192.168.177.142 8080 tcp http open Apache Tomcat/Coyote JSP engine 1.1
192.168.177.142 8081 tcp http open Jetty 6.1.25
msf >
复制代码
二、过滤服务
msf > services -s http
Services
========
host port proto name state info
---- ---- ----- ---- ----- ----
192.168.177.142 80 tcp http open Apache httpd 2.2.14 (Ubuntu) mod_mono/2.4.3 PHP/5.3.2-1ubuntu4.30 with Suhosin-Patch proxy_html/3.0.1 mod_python/3.3.1 Python/2.6.5 mod_ssl/2.2.14 OpenSSL/0.9.8k Phusion_Passenger/4.0.38 mod_perl/2.0.4 Perl/v5.10.1
192.168.177.142 8080 tcp http open Apache Tomcat/Coyote JSP engine 1.1
192.168.177.142 8081 tcp http open Jetty 6.1.25
复制代码
三、过滤端口
msf > services -p 22
Services
========
host port proto name state info
---- ---- ----- ---- ----- ----
192.168.177.142 22 tcp ssh open OpenSSH 5.3p1 Debian 3ubuntu4 Ubuntu Linux; protocol 2.0
msf >
复制代码
四、搜索特定字符
msf > services -S Apache
Services
========
host port proto name state info
---- ---- ----- ---- ----- ----
192.168.177.142 80 tcp http open Apache httpd 2.2.14 (Ubuntu) mod_mono/2.4.3 PHP/5.3.2-1ubuntu4.30 with Suhosin-Patch proxy_html/3.0.1 mod_python/3.3.1 Python/2.6.5 mod_ssl/2.2.14 OpenSSL/0.9.8k Phusion_Passenger/4.0.38 mod_perl/2.0.4 Perl/v5.10.1
192.168.177.142 8080 tcp http open Apache Tomcat/Coyote JSP engine 1.1
复制代码
五、多条件过滤
msf > services -c name,port,info -S Apache 192.168.177.142
Services
========
host name port info
---- ---- ---- ----
192.168.177.142 http 80 Apache httpd 2.2.14 (Ubuntu) mod_mono/2.4.3 PHP/5.3.2-1ubuntu4.30 with Suhosin-Patch proxy_html/3.0.1 mod_python/3.3.1 Python/2.6.5 mod_ssl/2.2.14 OpenSSL/0.9.8k Phusion_Passenger/4.0.38 mod_perl/2.0.4 Perl/v5.10.1
192.168.177.142 http 8080 Apache Tomcat/Coyote JSP engine 1.1
复制代码
Tip:在后续的章节咱们将学习更多的数据库命令,好比 loot
、cred
、vulns
、notes
。
本章完
相关练习实验 Metasploit之PostgreSQL及Scanner实践
原书:《Metasploit Penetration Testing Cookbook - Third Edition》
本文由合天网安实验室编译,转载请注明来源。
关于合天网安实验室
合天网安实验室(www.hetianlab.com)-国内领先的实操型网络安全在线教育平台
真实环境,在线实操学网络安全 ; 实验内容涵盖:系统安全,软件安全,网络安全,Web安全,移动安全,CTF,取证分析,渗透测试,网安意识教育等。