MSF基础使用

68 阅读2分钟

初始化

第一次在控制台输入msfconsole会进行初始化操作

➜  ~ msfconsole 
Metasploit tip: Use sessions -1 to interact with the last opened session
                                                  

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMM                MMMMMMMMMM
MMMN$                           vMMMM
MMMNl  MMMMM             MMMMM  JMMMM
MMMNl  MMMMMMMN       NMMMMMMM  JMMMM
MMMNl  MMMMMMMMMNmmmNMMMMMMMMM  JMMMM
MMMNI  MMMMMMMMMMMMMMMMMMMMMMM  jMMMM
MMMNI  MMMMMMMMMMMMMMMMMMMMMMM  jMMMM
MMMNI  MMMMM   MMMMMMM   MMMMM  jMMMM
MMMNI  MMMMM   MMMMMMM   MMMMM  jMMMM
MMMNI  MMMNM   MMMMMMM   MMMMM  jMMMM
MMMNI  WMMMM   MMMMMMM   MMMM#  JMMMM
MMMMR  ?MMNM             MMMMM .dMMMM
MMMMNm `?MMM             MMMM` dMMMMM
MMMMMMN  ?MM             MM?  NMMMMMN
MMMMMMMMNe                 JMMMMMNMMM
MMMMMMMMMMNm,            eMMMMMNMMNMM
MMMMNNMNMMMMMNx        MMMMMMNMMNMMNM
MMMMMMMMNMMNMMMMm+..+MMNMMNMNMMNMMNMM
        https://metasploit.com


       =[ metasploit v6.4.90-dev                                ]
+ -- --=[ 2,561 exploits - 1,310 auxiliary - 1,680 payloads     ]
+ -- --=[ 431 post - 49 encoders - 13 nops - 9 evasion          ]

Metasploit Documentation: https://docs.metasploit.com/
The Metasploit Framework is a Rapid7 Open Source Project


msf > 
msf > 
msf > 

查看帮助

msfconsole输入help可以查看命令。

msf > help

常用命令

banner

显示banner信息,每次输出的不一样

msf > banner 

image.png

image.png

color

输出是否有颜色

msf > color 
Usage: color <'true'|'false'|'auto'>

Enable or disable color output.

image.png

connect

类似于nc命令, 可以连接一个目标服务器的指定端口。

msf > connect -h
Usage: connect [options] <host> <port>

Communicate with a host, similar to interacting via netcat, taking advantage of
any configured session pivoting.

OPTIONS:

    -c, --comm <comm>               Specify which Comm to use.
    -C, --crlf                      Try to use CRLF for EOL sequence.
    -h, --help                      Help banner.
    -i, --send-contents <file>      Send the contents of a file.
    -p, --proxies <proxies>         List of proxies to use.
    -P, --source-port <port>        Specify source port.
    -S, --source-address <address>  Specify source address.
    -s, --ssl                       Connect with SSL.
    -u, --udp                       Switch to a UDP socket.
    -w, --timeout <seconds>         Specify connect timeout.
    -z, --try-connection            Just try to connect, then return.

image.png

show

顾名思义,可以展示信息,如下所示,有很多模块的信息可以展示。

msf > show
[-] Argument required

[*] Valid parameters for the "show" command are: all, encoders, nops, exploits, payloads, auxiliary, post, plugins, info, options, favorites
[*] Additional module-specific parameters are: missing, advanced, evasion, targets, actions

search

可以根据关键字搜索在MSF中有没有要查找的漏洞模块

image.png

image.png

use

使用模块,在我们查找到我们需要的模块后,可以使用use使用这个模块。

msf > use exploit/windows/smb/ms08_067_netapi
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
msf exploit(windows/smb/ms08_067_netapi) > 

image.png

执行完上述命令后,我们就进入了该模块的上下文环境中。

使用info查看漏洞信息

image.png

显示选项

在模块上下文使用show options查看模块参数。

image.png

检查漏洞

在模块上下文使用check查看目标是否有可以利用的漏洞。

msf exploit(windows/smb/ms08_067_netapi) > set RHOSTS 192.168.122.111
RHOSTS => 192.168.122.111

msf exploit(windows/smb/ms08_067_netapi) > check
[+] 192.168.122.111:445 - The target is vulnerable.

退出模块上下文环境

使用back命令。

msf exploit(windows/smb/ms08_067_netapi) > back 
msf > 

db相关命令

db_status
msf > db_status 
[*] postgresql selected, no connection