在本章中,咱們將會學習如下內容: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,取證分析,滲透測試,網安意識教育等。