mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
resetPluginWinWidth(480);
|
resetPluginWinWidth(480);
|
||||||
$.getScript( "/plugins/file?name=webssh&f=js/webssh.js", function() {
|
// $.getScript( "/plugins/file?name=webssh&f=js/webssh.js", function() {
|
||||||
if ($(".term-box #term").text() != 'W') {
|
//});
|
||||||
layer.closeAll();
|
if ($(".term-box #term").text() != 'W') {
|
||||||
web_shell2();
|
layer.closeAll();
|
||||||
}
|
webShell();
|
||||||
});
|
}
|
||||||
</script>
|
</script>
|
||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
import time
|
||||||
|
import random
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append(os.getcwd() + "/class/core")
|
||||||
|
import public
|
||||||
|
|
||||||
|
|
||||||
|
def status():
|
||||||
|
return 'start'
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
func = sys.argv[1]
|
||||||
|
if func == 'status':
|
||||||
|
print status()
|
||||||
@@ -2,7 +2,6 @@ flask
|
|||||||
flask_session
|
flask_session
|
||||||
flask_socketio
|
flask_socketio
|
||||||
gunicorn
|
gunicorn
|
||||||
gevent
|
|
||||||
gevent-websocket
|
gevent-websocket
|
||||||
psutil
|
psutil
|
||||||
pillow
|
pillow
|
||||||
|
|||||||
@@ -459,7 +459,8 @@ function getFiles(Path) {
|
|||||||
BarTools += ' <button onclick="javascript:BackDir();" class="btn btn-default btn-sm glyphicon glyphicon-arrow-left" title="'+lan.files.return+'"></button>';
|
BarTools += ' <button onclick="javascript:BackDir();" class="btn btn-default btn-sm glyphicon glyphicon-arrow-left" title="'+lan.files.return+'"></button>';
|
||||||
}
|
}
|
||||||
setCookie('open_dir_path',rdata.PATH);
|
setCookie('open_dir_path',rdata.PATH);
|
||||||
BarTools += ' <button onclick="javascript:getFiles(\'' + rdata.PATH + '\');" class="btn btn-default btn-sm glyphicon glyphicon-refresh" title="'+lan.public.fresh+'"></button> <button onclick="ExecShell()" title="'+lan.files.shell+'" type="button" class="btn btn-default btn-sm"><em class="ico-cmd"></em></button>';
|
BarTools += ' <button onclick="javascript:getFiles(\'' + rdata.PATH + '\');" class="btn btn-default btn-sm glyphicon glyphicon-refresh" title="'+lan.public.fresh+'"></button>\
|
||||||
|
<button onclick="webShell()" title="'+lan.files.shell+'" type="button" class="btn btn-default btn-sm"><em class="ico-cmd"></em></button>';
|
||||||
var copyName = getCookie('copyFileName');
|
var copyName = getCookie('copyFileName');
|
||||||
var cutName = getCookie('cutFileName');
|
var cutName = getCookie('cutFileName');
|
||||||
var isPaste = (copyName == 'null') ? cutName : copyName;
|
var isPaste = (copyName == 'null') ? cutName : copyName;
|
||||||
@@ -970,59 +971,6 @@ function downloadFile(action){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//执行SHELL
|
|
||||||
function ExecShell(action){
|
|
||||||
if(action == 1){
|
|
||||||
var path = $("#DirPathPlace input").val();
|
|
||||||
var exec = encodeURIComponent($("#mExec").val());
|
|
||||||
$.post('/files?action=ExecShell','path='+path+'&shell='+exec,function(rdata){
|
|
||||||
if(rdata.status){
|
|
||||||
$("#mExec").val('');
|
|
||||||
GetShellEcho();
|
|
||||||
} else {
|
|
||||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
shift: 5,
|
|
||||||
closeBtn: 2,
|
|
||||||
area: ['70%','600px'],
|
|
||||||
title: lan.files.shell_title,
|
|
||||||
content: '<div class="bt-form pd15">\
|
|
||||||
<div class="shellcode"><pre id="Result"></pre></div>\
|
|
||||||
<div class="line">\
|
|
||||||
<input type="text" class="bt-input-text" name="exec" id="mExec" value="" placeholder="'+lan.files.shell_ps+'" onkeydown="if(event.keyCode==13)ExecShell(1);" /><span class="shellbutton btn btn-default btn-sm pull-right" onclick="ExecShell(1)" style="width:10%">'+lan.files.shell_go+'</span>\
|
|
||||||
</div>\
|
|
||||||
</div>'
|
|
||||||
});
|
|
||||||
setTimeout(function(){
|
|
||||||
outTimeGet();
|
|
||||||
},1000);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var outTime = null;
|
|
||||||
//取SHELL输出
|
|
||||||
function outTimeGet(){
|
|
||||||
outTime = setInterval(function(){
|
|
||||||
if(!$("#mExec").attr('name')){
|
|
||||||
clearInterval(outTime);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GetShellEcho();
|
|
||||||
},1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetShellEcho(){
|
|
||||||
$.post('/files?action=GetExecShellMsg','',function(rdata){
|
|
||||||
$("#Result").html(rdata);
|
|
||||||
$(".shellcode").scrollTop($(".shellcode")[0].scrollHeight);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//重命名
|
//重命名
|
||||||
function ReName(type, fileName) {
|
function ReName(type, fileName) {
|
||||||
|
|||||||
+16
-26
@@ -1203,23 +1203,27 @@ function loadImage(){
|
|||||||
|
|
||||||
var socket, gterm;
|
var socket, gterm;
|
||||||
function webShell() {
|
function webShell() {
|
||||||
var termCols = 50;
|
var termCols = 83;
|
||||||
var termRows = 12;
|
var termRows = 21;
|
||||||
var sendTotal = 0;
|
var sendTotal = 0;
|
||||||
if(!socket){
|
if(!socket)socket = io.connect();
|
||||||
socket = io.connect();
|
|
||||||
}
|
|
||||||
var term = new Terminal({ cols: termCols, rows: termRows, screenKeys: true, useStyle: true});
|
var term = new Terminal({ cols: termCols, rows: termRows, screenKeys: true, useStyle: true});
|
||||||
|
|
||||||
term.open();
|
term.open();
|
||||||
gterm = term
|
|
||||||
term.setOption('cursorBlink', true);
|
term.setOption('cursorBlink', true);
|
||||||
|
term.setOption('fontSize', 10);
|
||||||
|
gterm = term
|
||||||
|
|
||||||
socket.on('server_response', function (data) {
|
socket.on('server_response', function (data) {
|
||||||
term.write(data.data);
|
term.write(data.data);
|
||||||
|
if (data.data == '\r\n登出\r\n' ||
|
||||||
if (data.data == '\r\n登出\r\n' || data.data == '登出\r\n' || data.data == '\r\nlogout\r\n' || data.data == 'logout\r\n') {
|
data.data == '登出\r\n' ||
|
||||||
|
data.data == '\r\nlogout\r\n' ||
|
||||||
|
data.data == 'logout\r\n') {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
layer.closeAll();
|
layer.closeAll();
|
||||||
|
term.destroy();
|
||||||
|
clearInterval(interval);
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1239,7 +1243,7 @@ function webShell() {
|
|||||||
var term_box = layer.open({
|
var term_box = layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: "本地终端",
|
title: "本地终端",
|
||||||
area: ['480px','300px'],
|
area: ['600px','400px'],
|
||||||
closeBtn: 2,
|
closeBtn: 2,
|
||||||
shadeClose: false,
|
shadeClose: false,
|
||||||
content: '<div class="term-box"><div id="term"></div></div>\
|
content: '<div class="term-box"><div id="term"></div></div>\
|
||||||
@@ -1252,13 +1256,13 @@ function webShell() {
|
|||||||
</div>',
|
</div>',
|
||||||
cancel: function () {
|
cancel: function () {
|
||||||
term.destroy();
|
term.destroy();
|
||||||
clearInterval(interval)
|
clearInterval(interval);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(".shell_btn_close").click(function(){
|
$(".shell_btn_close").click(function(){
|
||||||
layer.close(term_box);
|
layer.close(term_box);
|
||||||
term.destroy();
|
term.destroy();
|
||||||
clearInterval(interval)
|
clearInterval(interval);
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@@ -1358,22 +1362,9 @@ function webShell() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}, 100)
|
}, 100);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// function shell_translate_text() {
|
|
||||||
// remove_ssh_menu();
|
|
||||||
// var selectText = getCookie('ssh_selection');
|
|
||||||
// var loadT = layer.msg('正在翻译...', { icon: 16, time: 1000 * 60, });
|
|
||||||
// $.get('https://www.bt.cn/api/index/fanyi', { query: selectText }, function (rdata) {
|
|
||||||
// layer.close(loadT);
|
|
||||||
// layer.msg("原文: " + rdata.src + '<br>译文: ' + rdata.dst, { time: 1000 * 10, shadeClose: true, shade: 0.01 });
|
|
||||||
// }, 'JSONP');
|
|
||||||
// gterm.focus();
|
|
||||||
// }
|
|
||||||
|
|
||||||
function shell_to_baidu() {
|
function shell_to_baidu() {
|
||||||
var selectText = getCookie('ssh_selection');
|
var selectText = getCookie('ssh_selection');
|
||||||
remove_ssh_menu();
|
remove_ssh_menu();
|
||||||
@@ -1381,7 +1372,6 @@ function shell_to_baidu() {
|
|||||||
gterm.focus();
|
gterm.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function shell_paste_text(){
|
function shell_paste_text(){
|
||||||
socket.emit('webssh', getCookie('ssh_selection'));
|
socket.emit('webssh', getCookie('ssh_selection'));
|
||||||
remove_ssh_menu();
|
remove_ssh_menu();
|
||||||
|
|||||||
Reference in New Issue
Block a user