0x00 Introduction
location
- /usr/share/metasploit-framework/
interface
- msfconsole: 终端接口,非常常用,几乎能处理所有事情
- msfvenom: payload生成接口,用来生成木马,反弹shell
msfcil: 命令行接口,已删除,通过msfconsole -x调用- armitage: 图形化界面接口,使用前需启动数据库(systemctl start postgresql)
moudle
模块 | 作用 | 路径 |
---|---|---|
auxiliary | 辅助模块,主要做一些信息收集和暴力破解的工作 | modules/auxiliary |
exploits | 渗透攻击模块,发现安全漏洞,利用payload进行攻击 | modules/exploits |
payloads | 漏洞利用模块,渗透攻击成功后植入shellcode,获取shell | modules/payloads |
encoders | 编码器模块,删除坏字符,免杀 | modules/encoders |
post | 后渗透模块 | modules/post |
nops | 空指令模块 | modules/nops |
evasion | 免杀模块 | modules/evasion |
0x01 Database
postgresql
psql是msf框架的默认数据库,默认库名为msf,(配置文件:/etc/postgresql/11/main/pstgresql)
root@kali:~# service postgresql start //启动postgresql
root@kali:~# service postgresql status //检查状态
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor pres
Active: active (exited) since Thu 2020-03-19 11:40:37 CST; 1h 31min ago
Process: 1546 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 1546 (code=exited, status=0/SUCCESS)
3月 19 11:40:37 kali systemd[1]: Starting PostgreSQL RDBMS...
3月 19 11:40:37 kali systemd[1]: Started PostgreSQL RDBMS.
root@kali:~#
root@kali:~# sudo -u postgres psql //赋予postgres用户root权限并执行psql
psql (11.5 (Debian 11.5-1)) //进入数据库
输入 "help" 来获取帮助信息.
postgres=# alter user postgres password '123456' //更改密码为123456
postgres-# \q //退出
msfdb
命令 | 作用 |
---|---|
msfdb init |
启动并初始化数据库 |
msfdb reinit |
删除并重新初始化数据库 |
msfbd delet |
删除数据库并关闭数据库 |
msfdb start |
启动数据库 |
msfdb stop |
关闭数据库 |
msfdb status |
查看数据库运行状态 |
msfdb run |
启动数据库并运行msfconsole |
0x02 msfconsole
elementary command
help/?
: 显示msfconsole可以使用的命令及用法connect
:msf中的nc命令set|unset
:设置|取消参数save
:保存设置参数check
:检查目标是否存在漏洞run/exploit(-j)
:开始使用模块sessions(-i id)
:查看当前已经建立的sessions(shell)load|unload
:调用外部的扫描器back|exit
:回到|退出msfconsoleinfo
:查看模块的信息
msf5 > info exploit/windows/smb/ms08_067_netapi
use
:使用模块
msf5 > use exploit/windows/smb/ms08_067_netapi
search
:查找模块具体位置,可指定关键字(name,path,author…)
msf5 > search name:mysql
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 auxiliary/admin/mysql/mysql_enum normal No MySQL Enumeration Module
1 auxiliary/admin/mysql/mysql_sql normal No MySQL SQL Generic Query
2 auxiliary/analyze/jtr_mysql_fast normal No John the Ripper MySQL Password Cracker (Fast Mode)
3 auxiliary/scanner/mysql/mysql_authbypass_hashdump 2012-06-09 normal Yes MySQL Authentication Bypass Password Dump
4 auxiliary/scanner/mysql/mysql_file_enum normal Yes MYSQL File/Directory Enumerator
5 auxiliary/scanner/mysql/mysql_hashdump normal Yes MYSQL Password Hashdump
6 auxiliary/scanner/mysql/mysql_login normal Yes MySQL Login Utility
7 auxiliary/scanner/mysql/mysql_schemadump normal Yes MYSQL Schema Dump
8 auxiliary/scanner/mysql/mysql_version normal Yes MySQL Server Version Enumeration
9 auxiliary/scanner/mysql/mysql_writable_dirs normal Yes MYSQL Directory Write Test
10 auxiliary/server/capture/mysql normal No Authentication Capture: MySQL
11 exploit/linux/mysql/mysql_yassl_getname 2010-01-25 good No MySQL yaSSL CertDecoder::GetName Buffer Overflow
12 exploit/linux/mysql/mysql_yassl_hello 2008-01-04 good No MySQL yaSSL SSL Hello Message Buffer Overflow
13 exploit/multi/mysql/mysql_udf_payload 2009-01-16 excellent No Oracle MySQL UDF Payload Execution
14 exploit/windows/mysql/mysql_mof 2012-12-01 excellent Yes Oracle MySQL for Microsoft Windows MOF Execution
15 exploit/windows/mysql/mysql_start_up 2012-12-01 excellent Yes Oracle MySQL for Microsoft Windows FILE Privilege Abuse
16 exploit/windows/mysql/mysql_yassl_hello 2008-01-04 average No MySQL yaSSL SSL Hello Message Buffer Overflow
17 exploit/windows/mysql/scrutinizer_upload_exec 2012-07-27 excellent Yes Plixer Scrutinizer NetFlow and sFlow Analyzer 9 Default MySQL Credential
database command
command | effect |
---|---|
db_connect |
连接数据库 |
db_disconnect |
断开数据库 |
db_status |
查看msf有无连接数据库 |
db_rebuild_cache |
将模块信息写入数据库,便于查询 |
db_nmap |
调用nmap并保存到数据库 |
db_import |
数据库导入 |
db_export |
数据库导出 |
db_remove |
数据库删除 |
db_save |
数据库保存 |
show command
command | effect |
---|---|
show |
展示指定模块下的所有文件 |
show options |
展示模块的选项参数 |
show all |
展示所有 |
show targets |
展示目标主机 |
show advanced |
展示模块的高级选项参数 |
show missing |
查看没有被设置的必需选项 |
show plugins |
展示插件 |
show info |
展示模块信息 |
show actions |