From 32cc87c132835cd5a2f09a93547846a4c63b7bef Mon Sep 17 00:00:00 2001 From: jose Date: Sat, 15 Aug 2020 18:02:15 +0800 Subject: [PATCH] v6.8.2 --- BTPanel/__init__.py | 206 ++- BTPanel/static/ace/ace.editor.config.json | 2 +- BTPanel/static/css/site.css | 284 ++++- BTPanel/static/js/aes.js | 13 + BTPanel/static/js/control.js | 71 +- BTPanel/static/js/files.js | 2 +- BTPanel/static/js/index.js | 264 +++- BTPanel/static/js/public.js | 125 +- BTPanel/static/js/public_backup.js | 112 +- BTPanel/static/js/site.js | 96 +- BTPanel/static/js/soft.js | 42 +- BTPanel/static/language/English/log.json | 9 +- BTPanel/static/language/English/public.json | 129 +- BTPanel/static/language/English/template.json | 1 + BTPanel/templates/default/control.html | 10 +- BTPanel/templates/default/database.html | 8 +- BTPanel/templates/default/index.html | 13 +- BTPanel/templates/default/layout.html | 70 +- class/acme_v2.py | 252 ++-- class/ajax.py | 164 ++- class/common.py | 14 +- class/config.py | 37 +- class/crontab.py | 6 +- class/data.py | 3 - class/database.py | 2 + class/fastcgiClient.py | 399 ++++++ class/files.py | 118 +- class/http_requests.py | 14 +- class/jobs.py | 59 +- class/panelPHP.py | 544 +++++++- class/panelPlugin.py | 38 +- class/panelPmd.py | 189 +++ class/panelRedirect.py | 2 +- class/panelSite.py | 63 +- class/panelTask.py | 10 +- class/panelWarning.py | 174 +++ class/panel_restore.py | 184 +++ class/public.py | 171 ++- class/safe_warning/sw_database_backup.py | 56 + class/safe_warning/sw_debug_mode.py | 40 + class/safe_warning/sw_dir_mode.py | 82 ++ class/safe_warning/sw_files_recycle_bin.py | 39 + class/safe_warning/sw_firewall_open.py | 50 + class/safe_warning/sw_login_message.py | 43 + class/safe_warning/sw_login_user.py | 67 + class/safe_warning/sw_memcached_port.py | 50 + class/safe_warning/sw_mysql_port.py | 58 + class/safe_warning/sw_panel_pass.py | 1117 +++++++++++++++++ class/safe_warning/sw_panel_path.py | 65 + class/safe_warning/sw_panel_port.py | 43 + class/safe_warning/sw_ping.py | 47 + class/safe_warning/sw_redis_port.py | 1097 ++++++++++++++++ class/safe_warning/sw_site_spath.py | 93 ++ class/safe_warning/sw_site_ssl.py | 52 + class/safe_warning/sw_site_ssl_expire.py | 77 ++ class/safe_warning/sw_ssh_port.py | 91 ++ class/system.py | 2 +- class/wxapp.py | 10 + 58 files changed, 6517 insertions(+), 562 deletions(-) create mode 100644 BTPanel/static/js/aes.js create mode 100644 class/fastcgiClient.py create mode 100644 class/panelPmd.py create mode 100644 class/panelWarning.py create mode 100644 class/panel_restore.py create mode 100644 class/safe_warning/sw_database_backup.py create mode 100644 class/safe_warning/sw_debug_mode.py create mode 100644 class/safe_warning/sw_dir_mode.py create mode 100644 class/safe_warning/sw_files_recycle_bin.py create mode 100644 class/safe_warning/sw_firewall_open.py create mode 100644 class/safe_warning/sw_login_message.py create mode 100644 class/safe_warning/sw_login_user.py create mode 100644 class/safe_warning/sw_memcached_port.py create mode 100644 class/safe_warning/sw_mysql_port.py create mode 100644 class/safe_warning/sw_panel_pass.py create mode 100644 class/safe_warning/sw_panel_path.py create mode 100644 class/safe_warning/sw_panel_port.py create mode 100644 class/safe_warning/sw_ping.py create mode 100644 class/safe_warning/sw_redis_port.py create mode 100644 class/safe_warning/sw_site_spath.py create mode 100644 class/safe_warning/sw_site_ssl.py create mode 100644 class/safe_warning/sw_site_ssl_expire.py create mode 100644 class/safe_warning/sw_ssh_port.py diff --git a/BTPanel/__init__.py b/BTPanel/__init__.py index ba6686fc..d484b008 100644 --- a/BTPanel/__init__.py +++ b/BTPanel/__init__.py @@ -13,10 +13,11 @@ import time import re import uuid import threading +import socket os.chdir('/www/server/panel/') sys.path.insert(0,'class/') import public -from flask import Flask,current_app,session,render_template,send_file,request,redirect,g,url_for,make_response,render_template_string,abort +from flask import Flask,current_app,session,render_template,send_file,request,redirect,g,url_for,make_response,render_template_string,abort,stream_with_context,Response as Resp from flask_session import Session try: from werkzeug.contrib.cache import SimpleCache @@ -79,7 +80,7 @@ except: app.config['SESSION_PERMANENT'] = True app.config['SESSION_USE_SIGNER'] = True app.config['SESSION_KEY_PREFIX'] = 'BT_:' -app.config['SESSION_COOKIE_NAME'] = "BT_PANEL_6" +app.config['SESSION_COOKIE_NAME'] = "SESSIONID" app.config['PERMANENT_SESSION_LIFETIME'] = 86400 Session(app) @@ -144,19 +145,60 @@ admin_path_checks = [ '/down', '/api', '/tips', - '/message' + '/message', + '/warning' ] if admin_path in admin_path_checks: admin_path = '/bt' -@app.route('/service_status',methods = method_all) +@app.route('/service_status',methods = method_get) def service_status(): return 'True' +@app.route('/phpmyadmin',methods = method_all) +@app.route('/phpmyadmin/',methods = method_all) +@app.route('/phpmyadmin/',methods = method_all) +def phpmyadmin(puri = None): + comReturn = comm.local() + if comReturn: return comReturn + import panelPHP + p = panelPHP.panelPHP() + document_root = '/www/server/phpmyadmin/pma/' + sock = p.start(puri,document_root,'/phpmyadmin/') + + #如果是响应体则直接返回 + if isinstance(sock,Resp): + return sock + + headers_data = p.get_header_data(sock) + status,headers,bdata = p.format_header_data(headers_data) + return Response(p.resp_sock(sock,bdata),headers=headers,status=status) + + +@app.route('/adminer',methods = method_all) +@app.route('/adminer/',methods = method_all) +@app.route('/adminer/',methods = method_all) +def adminer(puri = None): + comReturn = comm.local() + if comReturn: return comReturn + import panelPHP + p = panelPHP.panelPHP() + document_root = '/www/server/adminer/' + + sock = p.start(puri,document_root,'/adminer/') + + #如果是响应体则直接返回 + if isinstance(sock,Resp):return sock + + headers_data = p.get_header_data(sock) + status,headers,bdata = p.format_header_data(headers_data) + return Response(p.resp_sock(sock,bdata),headers=headers,status=status) + + @sockets.route('/webssh') def webssh(ws): if not check_login(): session.clear() - ws.send('server_response',"Panel session is lost, please re-login panel!") + ws.send('server_response',"SSH_ERROR") return None if not 'ssh_obj' in session: import ssh_terminal @@ -174,7 +216,7 @@ def webssh(ws): session['ssh_obj'].run(ws,session['ssh_info']) -@app.route('/term_open',methods=method_get) +@app.route('/term_open',methods=method_all) def term_open(): comReturn = comm.local() if comReturn: return comReturn @@ -183,7 +225,7 @@ def term_open(): key = 'ssh_' + args['host'] if key in session: return public.getJson(session[key]),json_header - return public.returnMsg(False,'Acquisition failed!') + return public.returnMsg(False,'SSH_INFO_ERROR') session['ssh_info'] = json.loads(args.data) key = 'ssh_' + session['ssh_info']['host'] session[key] = session['ssh_info'] @@ -194,7 +236,7 @@ def term_open(): else: if os.path.exists(s_file): os.remove(s_file) if 'ssh_obj' in session: session['ssh_obj']._ssh_info = session['ssh_info'] - return public.returnJson(True,'Successful setup!') + return public.returnJson(True,'SET_SUCCESS') @app.route('/reload_mod',methods=method_all) def reload_mod(): @@ -206,21 +248,28 @@ def reload_mod(): mod_name = args.mod_name result = public.reload_mod(mod_name) if result: return public.returnJson(True,result),json_header - return public.returnJson(False,'Reload failure!'),json_header + return public.returnJson(False,'INIT_RELOAD_ERR'),json_header + @app.before_request def request_check(): #路由和URI长度过滤 - if len(request.path) > 64: return abort(403) - if len(request.url) > 256: return abort(403) + if request.path.find('/adminer/') != -1: + return + if request.path.find('/phpmyadmin/') == -1: + if len(request.path) > 128: return abort(403) + if len(request.url) > 1024: return abort(403) + else: + if len(request.path) > 512: return abort(403) + return if request.path in ['/service_status']: return #POST参数过滤 if request.path in ['/login','/safe','/hook','/public','/down','/get_app_bind_status','/check_bind']: pdata = request.form.to_dict() for k in pdata.keys(): - if len(k) > 32: return abort(403) - if len(pdata[k]) > 128: return abort(403) + if len(k) > 48: return abort(403) + if len(pdata[k]) > 256: return abort(403) if not request.path in ['/safe','/hook','/public','/mail_sys','/down']: ip_check = public.check_ip_panel() @@ -235,7 +284,7 @@ def request_check(): if public.is_local(): not_networks = ['uninstall_plugin','install_plugin','UpdatePanel'] if request.args.get('action') in not_networks: - return public.returnJson(False,'This feature is not available in offline mode!'),json_header + return public.returnJson(False,'INIT_REQUEST_CHECK_LOCAL_ERR'),json_header if app.config['BASIC_AUTH_OPEN']: if request.path in ['/public','/download','/mail_sys','/hook','/down','/check_bind','/get_app_bind_status']: return @@ -270,7 +319,6 @@ def home(): data['ftpCount'] = public.M('ftps').count() data['databaseCount'] = public.M('databases').count() data['lan'] = public.GetLan('index') - data['724'] = public.format_date("%m%d") == '0724' public.auto_backup_panel() return render_template( 'index.html',data = data) @@ -305,7 +353,8 @@ def login(): for v in v_list: pv = request.form.get(v,'').strip() if v == 'cdn_url': - if len(pv) > 32: return public.returnMsg(False,'Wrong parameter length!') + if len(pv) > 32: return public.returnMsg(False,'INPUT_ARGS_ERR'),json_header + if not re.match(r"^[\w\.-]+$",pv): public.returnJson(False,'INPUT_ARGS_ERR'),json_header continue if not pv: continue @@ -313,13 +362,14 @@ def login(): if v == 'code': p_len = 4 if v == 'vcode': p_len = 6 if len(pv) != p_len: - return public.returnJson(False,'Wrong parameter length'),json_header + if v == 'code': return public.returnJson(False,'V_CODE_LEN_ERR'),json_header + return public.returnJson(False,'INPUT_ARGS_ERR'),json_header if not re.match(r"^\w+$",pv): - return public.returnJson(False,'Wrong parameter format'),json_header + return public.returnJson(False,'INPUT_ARGS_ERR'),json_header for n in request.form.keys(): if not n in v_list: - return public.returnJson(False,'You cannot have extra parameters in the login parameters'),json_header + return public.returnJson(False,'EXTRA_PARAMETER'),json_header get = get_input() import userlogin @@ -334,10 +384,16 @@ def login(): if session['login'] != False: session['login'] = False cache.set('dologin',True) - public.WriteLog('User LogOut','Client: {}, has manually exited the panel'.format(public.GetClientIp()+ ":" + str(request.environ.get('REMOTE_PORT')))) + public.WriteLog('TYPE_LOGOUT','MANUALLY_LOGOUT', (format(public.GetClientIp()+ ":" + str(request.environ.get('REMOTE_PORT'))),)) session.clear() session_path = r'/dev/shm/session_py' + str(sys.version_info[0]) if os.path.exists(session_path): public.ExecShell("rm -f " + session_path + '/*') + sess_file = 'data/sess_files/' + public.get_sess_key() + if os.path.exists(sess_file): + try: + os.remove(sess_file) + except: + pass return redirect(login_path) if is_auth_path: @@ -351,8 +407,6 @@ def login(): if request.method == method_post[0]: result = userlogin.userlogin().request_post(get) - if result == "1": - return result return is_login(result) if request.method == method_get[0]: @@ -474,14 +528,14 @@ def get_phpmyadmin_dir(): if session['webserver'] == 'nginx': filename =public.GetConfigValue('setup_path') + '/nginx/conf/nginx.conf' conf = public.readFile(filename) - rep = "listen\s+([0-9]+)\s*;" + rep = r"listen\s+([0-9]+)\s*;" rtmp = re.search(rep,conf) if rtmp: phpport = rtmp.groups()[0] if session['webserver'] == 'apache': filename = public.GetConfigValue('setup_path') + '/apache/conf/extra/httpd-vhosts.conf' conf = public.readFile(filename) - rep = "Listen\s+([0-9]+)\s*\n" + rep = r"Listen\s+([0-9]+)\s*\n" rtmp = re.search(rep,conf) if rtmp: phpport = rtmp.groups()[0] @@ -489,7 +543,7 @@ def get_phpmyadmin_dir(): filename = public.GetConfigValue('setup_path') + '/panel/vhost/openlitespeed/listen/888.conf' public.writeFile('/tmp/2',filename) conf = public.readFile(filename) - rep = "address\s*\*\:\s*(\d+)" + rep = r"address\s*\*\:\s*(\d+)" rtmp = re.search(rep,conf) if rtmp: phpport = rtmp.groups()[0] @@ -630,6 +684,16 @@ def panel_password(pdata=None): return publicObject(dataObject, defs, None, pdata) +@app.route('/warning', methods=method_all) +def panel_warning(pdata=None): + comReturn = comm.local() + if comReturn: return comReturn + import panelWarning + dataObject = panelWarning.panelWarning() + defs = ('get_list', 'set_ignore', 'check_find') + return publicObject(dataObject, defs, None, pdata) + + @app.route('/bak', methods=method_all) def backup_bak(pdata=None): comReturn = comm.local() @@ -664,7 +728,7 @@ def files(pdata = None): return render_template('files.html',data=data) import files filesObject = files.files() - defs = ('fix_permissions','get_all_back','restore_path_permissions','del_path_premissions','get_path_premissions','back_path_permissions', + defs = ('get_progress','restore_website','fix_permissions','get_all_back','restore_path_permissions','del_path_premissions','get_path_premissions','back_path_permissions', 'CheckExistsFiles','GetExecLog','GetSearch','ExecShell','GetExecShellMsg','exec_git','exec_composer','create_download_url', 'UploadFile','GetDir','CreateFile','CreateDir','DeleteDir','DeleteFile','get_download_url_list','remove_download_url','modify_download_url', 'CopyFile','CopyDir','MvFile','GetFileBody','SaveFileBody','Zip','UnZip','get_download_url_find', @@ -727,8 +791,8 @@ def config(pdata = None): if c_obj.get_ipv6_listen(None): data['ipv6'] = 'checked' if c_obj.get_token(None)['open']: data['api'] = 'checked' data['basic_auth'] = c_obj.get_basic_auth_stat(None) - data['basic_auth']['value'] = public.GetMsg("CLOSE") - if data['basic_auth']['open']: data['basic_auth']['value'] = public.GetMsg("OPEN") + data['basic_auth']['value'] = public.getMsg('CLOSED') + if data['basic_auth']['open']: data['basic_auth']['value'] = public.getMsg('OPENED') data['debug'] = '' if app.config['DEBUG']: data['debug'] = 'checked' data['is_local'] = '' @@ -898,7 +962,7 @@ def panel_public(): if type(checks) != bool or not checks: return public.getJson(checks),json_header data = public.getJson(eval('pluwx.'+get.fun+'(get)')) return data,json_header - + if get.name != 'app': return abort(404) import panelPlugin plu = panelPlugin.panelPlugin() @@ -941,9 +1005,9 @@ def panel_other(name=None,fun = None,stype=None): if not name: name = 'coll' if not public.path_safe_check("%s/%s/%s" % (name,fun,stype)): return abort(404) - if name.find('./') != -1 or not re.match("^[\w-]+$",name): return abort(404) - if not name: return public.returnJson(False,public.GetMsg("PLUGIN_INPUT_A")),json_header - p_path = '/www/server/panel/plugin/' + name + if name.find('./') != -1 or not re.match(r"^[\w-]+$",name): return abort(404) + if not name: return public.returnJson(False,'PLUGIN_INPUT_ERR'),json_header + p_path = os.path.join('/www/server/panel/plugin/', name) if not os.path.exists(p_path): return abort(404) #是否响插件应静态文件 @@ -951,7 +1015,7 @@ def panel_other(name=None,fun = None,stype=None): if stype.find('./') != -1 or not os.path.exists(p_path + '/static'): return abort(404) s_file = p_path + '/static/' + stype if s_file.find('..') != -1: return abort(404) - if not re.match("^[\w\./-]+$",s_file): return abort(404) + if not re.match(r"^[\w\./-]+$",s_file): return abort(404) if not public.path_safe_check(s_file): return abort(404) if not os.path.exists(s_file): return abort(404) return send_file(s_file,conditional=True,add_etags=True) @@ -1067,12 +1131,16 @@ def install(): elif request.method == method_post[0]: if not os.path.exists('install.pl'): return redirect(ret_login) get = get_input() - if not hasattr(get,'bt_username'): return public.GetMsg("LOGIN_USER_EMPTY") - if not get.bt_username: return public.GetMsg("LOGIN_USER_EMPTY") - if not hasattr(get,'bt_password1'): return public.GetMsg("LOGIN_USER_EMPTY") - if not get.bt_password1: return public.GetMsg("LOGIN_USER_EMPTY") - if get.bt_password1 != get.bt_password2: return public.GetMsg("USER_PASSWORD_CHECK") - public.M('users').where("id=?",(1,)).save('username,password',(get.bt_username,public.md5(get.bt_password1.strip()))) + if not hasattr(get,'bt_username'): return public.getMsg('INSTALL_USER_EMPTY') + if not get.bt_username: return public.getMsg('INSTALL_USER_EMPTY') + if not hasattr(get,'bt_password1'): return public.getMsg('INSTALL_PASS_EMPTY') + if not get.bt_password1: return public.getMsg('INSTALL_PASS_EMPTY') + if get.bt_password1 != get.bt_password2: return public.getMsg('INSTALL_PASS_CHECK') + public.M('users').where("id=?",(1,)).save('username,password', + (get.bt_username, + public.password_salt(public.md5(get.bt_password1.strip()),uid=1) + ) + ) os.remove('install.pl') public.M('config').where("id=?",('1',)).setField('status',1) data = {} @@ -1161,7 +1229,10 @@ def get_dir_down(filename,token,find): pdata['token'] = token pdata['src_path'] = find['filename'] pdata['to_path'] = to_path - pdata['expire'] = public.format_date(times=find['expire']) + if find['expire'] > (time.time() + (86400 * 365 * 10)): + pdata['expire'] = public.format_date(times=find['expire']) + else: + pdata['expire'] = public.getMsg('NEVER_EXPIRES') pdata['filename'] = (find['filename'].split('/')[-1] + '/' + to_path).strip('/') return render_template('down.html',data = pdata,to_size=public.to_size) @@ -1188,11 +1259,11 @@ def down(token=None,fname=None): args = get_input() if 'file_password' in args: if not re.match(r"^\w+$",args.file_password): - return public.ReturnJson(False,'Wrong password!'),json_header + return public.ReturnJson(False,'WRONG_PASSWD'),json_header if re.match(r"^\d+$",args.file_password): args.file_password += '.0' if args.file_password != str(find['password']): - return public.ReturnJson(False,'Wrong password!'),json_header + return public.ReturnJson(False,'WRONG_PASSWD'),json_header session[token] = 1 session['down'] = True else: @@ -1280,7 +1351,7 @@ def check_csrf(): def publicObject(toObject,defs,action=None,get = None): if 'request_token' in session and 'login' in session: - if not check_csrf(): return public.ReturnJson(False,'Csrf-Token error.'),json_header + if not check_csrf(): return public.ReturnJson(False,'INIT_CSRF_ERR'),json_header if not get: get = get_input() if action: get.action = action @@ -1296,8 +1367,7 @@ def publicObject(toObject,defs,action=None,get = None): get.dfile = get.dfile.replace('//','/').replace('\\','/') if hasattr(toObject,'site_path_check'): - if not toObject.site_path_check(get): return public.ReturnJson(False,'Excessive operation!'),json_header - + if not toObject.site_path_check(get): return public.ReturnJson(False,'INIT_ACCEPT_NOT'),json_header p = run_exec() result = p.run(toObject,defs,get) del p @@ -1317,7 +1387,9 @@ def get_pd(): tmp = -1 try: import panelPlugin - tmp1 = panelPlugin.panelPlugin().get_cloud_list() + get = public.dict_obj() + get.init = 1 + tmp1 = panelPlugin.panelPlugin().get_cloud_list(get) except: tmp1 = None if tmp1: @@ -1409,17 +1481,19 @@ def get_pd(): @app.errorhandler(404) def notfound(e): - errorStr = public.ReadFile('./BTPanel/templates/' + public.GetConfigValue('template') + '/error.html') - try: - errorStr = errorStr.format(public.getMsg('PAGE_ERR_404_TITLE'), - public.getMsg('PAGE_ERR_404_H1'), - public.getMsg('PAGE_ERR_404_P1'), - public.getMsg('NAME'), - public.getMsg('PAGE_ERR_HELP')) - except IndexError: pass - return errorStr,404 + errorStr = ''' +404 Not Found + +

404 Not Found

+
server
+ +''' + headers={ + "Content-Type":"text/html" + } + return Response(errorStr,status=404,headers=headers) -@app.errorhandler(500) +#@app.errorhandler(500) def internalerror(e): #if str(e).find('Permanent Redirect') != -1: return e errorStr = public.ReadFile('./BTPanel/templates/' + public.GetConfigValue('template') + '/error.html') @@ -1431,7 +1505,10 @@ def internalerror(e): public.getMsg('NAME'), public.getMsg('PAGE_ERR_HELP')) else: - errorStr = errorStr.format(public.getMsg('PAGE_ERR_500_TITLE'),str(e),'
'+public.get_error_info() + '
','The above debugging information is only displayed in developer mode','Version: ' + public.version()) + errorStr = errorStr.format(public.getMsg('PAGE_ERR_500_TITLE'), + str(e), + '
'+public.get_error_info() + '
', + public.getMsg('INIT_DEBUG_INFO'),public.getMsg('INIT_VERSION_LAST') + public.version()) except IndexError:pass return errorStr,500 @@ -1443,9 +1520,17 @@ def get_input(): for key in request.args.keys(): data[key] = str(request.args.get(key,'')) try: + x_token = request.headers.get('x-http-token') + if x_token: + aes_pwd = x_token[:8] + x_token[40:48] + for key in request.form.keys(): if key in exludes: continue data[key] = str(request.form.get(key,'')) + if x_token: + if len(data[key]) > 5: + if data[key][:6] == 'BT-CRT': + data[key] = public.aes_decrypt(data[key][6:],aes_pwd) except: try: post = request.form.to_dict() @@ -1484,4 +1569,11 @@ class run_exec: result = public.ReturnJson(False,'ARGS_ERR'),json_header if g.is_aes: result = public.aes_encrypt(result[0],g.aes_key),json_header + else: + if os.path.exists('pyenv/bin/python'): + if not os.path.exists('data/debug.pl'): + x_token = request.headers.get('x-http-token') + if x_token: + aes_pwd = x_token[:8] + x_token[40:48] + result = "BT-CRT"+public.aes_encrypt(result[0],aes_pwd),{'Content-Type':'text/plain; charset=utf-8'} return result \ No newline at end of file diff --git a/BTPanel/static/ace/ace.editor.config.json b/BTPanel/static/ace/ace.editor.config.json index 3bd23379..22623a1d 100644 --- a/BTPanel/static/ace/ace.editor.config.json +++ b/BTPanel/static/ace/ace.editor.config.json @@ -1 +1 @@ -{"supportedModes":{"Apache_Conf":["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],"BatchFile":["bat|cmd"],"C_Cpp":["cpp|c|cc|cxx|h|hh|hpp|ino"],"CSharp":["cs"],"CSS":["css"],"Dockerfile":["^Dockerfile"],"golang":["go"],"HTML":["html|htm|xhtml|vue|we|wpy"],"Java":["java"],"JavaScript":["js|jsm|jsx"],"JSON":["json"],"JSP":["jsp"],"LESS":["less"],"Lua":["lua"],"Makefile":["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],"Markdown":["md|markdown"],"MySQL":["mysql"],"Nginx":["nginx|conf"],"INI":["ini|conf|cfg|prefs"],"ObjectiveC":["m|mm"],"Perl":["pl|pm"],"Perl6":["p6|pl6|pm6"],"pgSQL":["pgsql"],"PHP_Laravel_blade":["blade.php"],"PHP":["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],"Powershell":["ps1"],"Python":["py"],"R":["r"],"Ruby":["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],"Rust":["rs"],"SASS":["sass"],"SCSS":["scss"],"SH":["sh|bash|^.bashrc"],"SQL":["sql"],"SQLServer":["sqlserver"],"Swift":["swift"],"Text":["txt"],"Typescript":["ts|typescript|str"],"VBScript":["vbs|vb"],"Verilog":["v|vh|sv|svh"],"XML":["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],"YAML":["yaml|yml"],"Compress":["tar|zip|7z|rar|gz|arj|z"],"images":["icon|jpg|jpeg|png|bmp|gif|tif|emf"]},"nameOverrides":{"ObjectiveC":"Objective-C","CSharp":"C#","golang":"Go","C_Cpp":"C and C++","PHP_Laravel_blade":"PHP (Blade Template)","Perl6":"Perl 6"},"encodingList":["ASCII","UTF-8","GBK","GB2312","BIG5"],"themeList":["chrome","monokai"],"aceEditor":{"editorTheme":"monokai","fontSize":13,"softLabel":false,"useSoftTabs":false,"tabSize":4,"wrap":true,"enableSnippets":true,"enableLiveAutocompletion":true,"highlightActiveLine":true,"highlightSelectedWord":true,"animatedScroll":false,"showInvisibles":false,"showFoldWidgets":true,"showLineNumbers":true,"showGutter":true,"displayIndentGuides":false},"showUpdate":true} \ No newline at end of file +{"supportedModes":{"Apache_Conf":["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],"BatchFile":["bat|cmd"],"C_Cpp":["cpp|c|cc|cxx|h|hh|hpp|ino"],"CSharp":["cs"],"CSS":["css"],"Dockerfile":["^Dockerfile"],"golang":["go"],"HTML":["html|htm|xhtml|vue|we|wpy"],"Java":["java"],"JavaScript":["js|jsm|jsx"],"JSON":["json"],"JSP":["jsp"],"LESS":["less"],"Lua":["lua"],"Makefile":["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],"Markdown":["md|markdown"],"MySQL":["mysql"],"Nginx":["nginx|conf"],"INI":["ini|conf|cfg|prefs"],"ObjectiveC":["m|mm"],"Perl":["pl|pm"],"Perl6":["p6|pl6|pm6"],"pgSQL":["pgsql"],"PHP_Laravel_blade":["blade.php"],"PHP":["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],"Powershell":["ps1"],"Python":["py"],"R":["r"],"Ruby":["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],"Rust":["rs"],"SASS":["sass"],"SCSS":["scss"],"SH":["sh|bash|^.bashrc"],"SQL":["sql"],"SQLServer":["sqlserver"],"Swift":["swift"],"Text":["txt"],"Typescript":["ts|typescript|str"],"VBScript":["vbs|vb"],"Verilog":["v|vh|sv|svh"],"XML":["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],"YAML":["yaml|yml"],"Compress":["tar|zip|7z|rar|gz|arj|z"],"images":["icon|jpg|jpeg|png|bmp|gif|tif|emf"]},"nameOverrides":{"ObjectiveC":"Objective-C","CSharp":"C#","golang":"Go","C_Cpp":"C and C++","PHP_Laravel_blade":"PHP (Blade Template)","Perl6":"Perl 6"},"encodingList":["ASCII","UTF-8","GBK","GB2312","BIG5"],"themeList":["chrome","monokai"],"aceEditor":{"editorTheme":"monokai","fontSize":13,"softLabel":false,"useSoftTabs":true,"tabSize":"4","wrap":true,"enableSnippets":true,"enableLiveAutocompletion":true,"highlightActiveLine":true,"highlightSelectedWord":true,"animatedScroll":false,"showInvisibles":false,"showFoldWidgets":true,"showLineNumbers":true,"showGutter":true,"displayIndentGuides":false},"showUpdate":true} \ No newline at end of file diff --git a/BTPanel/static/css/site.css b/BTPanel/static/css/site.css index 6ae062e5..38030024 100644 --- a/BTPanel/static/css/site.css +++ b/BTPanel/static/css/site.css @@ -2130,22 +2130,18 @@ html .menu .menu_exit:hover { .soft-man-con .user_pw_tit .tit { float: left; - line-height: 22px + line-height: 22px; + padding-right: 20px; } .soft-man-con .user_pw span, .soft-man-con .user_pw_tit span { - width: 165px; + width: 135px; display: inline-block; - text-align: left; + text-align: right; } - -.soft-man-con .user_pw span { - margin-right: 10px -} - -.btswitch-p { - margin-left: 10px +.soft-man-con .user_pw .btn_password_get{ + margin-left: 135px; } .soft-man-con .user_pw input { @@ -4925,7 +4921,7 @@ select[disabled]{ ::-webkit-scrollbar { /*滚动条整体样式*/ width : 10px; /*高宽分别对应横竖滚动条的尺寸*/ - height: 5px; + height: 10px; } ::-webkit-scrollbar-thumb { /*滚动条里面小方块*/ @@ -5382,7 +5378,7 @@ select[disabled]{ .ace_catalogue_list::-webkit-scrollbar { /*滚动条整体样式*/ width: 9px; /*高宽分别对应横竖滚动条的尺寸*/ - height: 1px; + height: 10px; } .ace_catalogue_list::-webkit-scrollbar-thumb { /*滚动条里面小方块*/ @@ -5465,7 +5461,7 @@ select[disabled]{ } .ace_scrollbar::-webkit-scrollbar { /*滚动条整体样式*/ - width : 15px; /*高宽分别对应横竖滚动条的尺寸*/ + width : 10px; /*高宽分别对应横竖滚动条的尺寸*/ height: 10px; } .ace_scrollbar::-webkit-scrollbar-thumb { @@ -5478,7 +5474,7 @@ select[disabled]{ /*滚动条里面轨道*/ box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); background: #333; - border-radius: 0; + border-radius: 10px; } .ace_editors.active { display: block; @@ -6651,6 +6647,24 @@ select[disabled]{ background-size: auto !important; background-repeat: no-repeat; } +.ace_config_editor_scroll ::-webkit-scrollbar { + /*滚动条整体样式*/ + width : 10px; /*高宽分别对应横竖滚动条的尺寸*/ + height: 10px; +} +.ace_config_editor_scroll ::-webkit-scrollbar-thumb { + /*滚动条里面小方块*/ + border-radius: 10px; + box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2); + background : #999; +} +.ace_config_editor_scroll ::-webkit-scrollbar-track { + /*滚动条里面轨道*/ + box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2); + border-radius: 10px; + background : #ededed; + border-radius: 5px; +} /*外链分享 */ .checkbox_grourd input { margin-right: 2px; @@ -6769,7 +6783,7 @@ select[disabled]{ .dropUpLoadFile::-webkit-scrollbar { /*滚动条整体样式*/ width : 15px; /*高宽分别对应横竖滚动条的尺寸*/ - height: 1px; + height: 10px; } .dropUpLoadFile::-webkit-scrollbar-thumb { /*滚动条里面小方块*/ @@ -6981,4 +6995,242 @@ select[disabled]{ } .upload_warning{ color:#409EFF !important; -} \ No newline at end of file +} +/*安全风险*/ +.warning_scan_view{ + padding: 20px; + position: relative; + color: #666; +} +.warning_scan_head { + padding: 15px 10px 20px 10px; +} +.warning_scan_head span{ + display: inline-block; + width: 450px; + font-size: 18px; + margin-bottom: 5px; +} +.warning_scan_head button{ + position: absolute; + right: 40px; + top: 35px; + border: none; + background: #20a53a; + border-radius: 20px; + height: 38px; + line-height: 38px; + font-size: 15px; + width: 110px; + color: #fff; + transition: all 500ms; +} +.warning_scan_head button:hover{ + background:#10952a; +} +.warning_scan_head button:focus, +.warning_scan_head button:active{ + outline: none; +} +.warning_scan_ps i{ + font-style: inherit; + color: red; + margin: 0 5px; +} +.warning_scan_time{ + font-size: 15px !important; +} +.warning_scan_body .module_head{ + height: 42px; + line-height: 42px; + padding-left: 15px; + color: #555; + background: #f5f5f5; + font-size: 13px; + border-top: 1px solid #e8e8e8; +} +.module_details_list{ + display: none; +} +.module_details_list.active{ + display: block; + height: 400px; + overflow: auto; + transition: height 500ms; +} +.module_details_list::-webkit-scrollbar { + /*滚动条整体样式*/ + width: 10px; + height: 5px; +} +.module_details_list::-webkit-scrollbar-thumb { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); + background: #999; +} +.module_details_list ::-webkit-scrollbar-track { + /*滚动条里面轨道*/ + box-shadow:inset 0 0 5px rgba(0, 0, 0, 0.2); + background:#ededed; +} +.module_details_item{ + position:relative; + border-bottom: 1px solid #ececec; +} +.module_details_item:hover .module_details_head{ + background: #effffa; +} +.module_details_item:hover .module_details_body{ + background: #f8fffd; +} +.module_details_item:before{ + /*content:'';*/ + display: block; + width: 100%; + height: 6px; + position: absolute; + bottom: 0; + background: -webkit-linear-gradient(top,rgba(255, 255, 255, 0),rgba(220, 220, 220, .3)); + background: -moz-linear-gradient(top,rgba(255, 255, 255, 0),rgba(220, 220, 220, .3)); + background: -o-linear-gradient(top,rgba(255, 255, 255, 0),rgba(220, 220, 220, .3)); + background: linear-gradient(top,rgba(255, 255, 255, 0),rgba(220, 220, 220, .3)); + clear: both; +} +.module_details_item:after{ + content:''; + display: block; + width: 100%; + height: 6px; + top: 40px; + position: absolute; + background: -webkit-linear-gradient(top,rgba(220, 220, 220, .3),rgba(255, 255, 255, 0)); + background: -moz-linear-gradient(top,rgba(220, 220, 220, .3),rgba(255, 255, 255, 0)); + background: -o-linear-gradient(top,rgba(220, 220, 220, .3),rgba(255, 255, 255, 0)); + background: linear-gradient(top,rgba(220, 220, 220, .3),rgba(255, 255, 255, 0)); + clear: both; +} +.warning_scan_body .module_head:last-child{ + border-top: none; +} +.module_item .module_head{ + cursor: pointer; +} +.module_title{ + font-size: 14px; +} +.risk .module_num, +.security .module_num, +.ignore .module_num{ + display: inline-block; + height: 20px; + line-height: 21px; + width: 20px; + text-align: center; + margin-left: 5px; + border-radius: 3px; + color: #fff; +} +.risk .module_num{ + background:red; +} +.security .module_num{ + background:#20A53A; +} +.ignore .module_num{ + background:#FFBA66; +} +.module_cut_show{ + float: right; + padding-right: 10px; + height: 40px; + line-height: 40px; +} +.module_cut_show i{ + color: #bbb; + font-style: initial; + margin-right: 5px; +} +.module_cut_show .glyphicon{ + color: #20a53a; +} +.module_details_item{ + +} +.module_details_head{ + height: 40px; + line-height: 40px; + font-size: 13px; + padding-left: 15px; + position: relative; + background: #fbfbfb; + clear: both; + /*border-top: 1px solid #ececec;*/ +} +.module_details_head:before{ + content: ''; + display: inline-block; + height: 5px; + width: 5px; + border-radius: 2.5px; + position: absolute; + /* background-color: #666; */ + top: 50%; + margin-top: -3.5px; + left: 15px; +} +.operate_tools{ + float: right; + padding-right: 15px; + font-size: 12.5px; +} +.operate_tools a{ + color: #9a9a9a; +} +.operate_tools a.btlink{ + color: #20a53a; +} +.module_details_title{ + font-weight: 500; +} +.module_details_title i{ + color: #bbb; + font-style: initial; + font-weight: 400; +} +.module_details_body{ + padding: 10px 15px; + display: none; +} +.module_details_body .module_details_line{ + line-height: 25px; + margin-bottom: 5px; + clear: both; +} +.module_details_body .line_content, +.module_details_body .line_title{ + display: inline-block; + font-size: 12.5px; +} +.module_details_body .line_title{ + height: 100%; + width: 75px; + vertical-align: top; + color: #999; + text-align: right; + padding-right: 5px; +} +.module_details_body .line_content i{ + font-style:initial; +} +.module_details_body .line_content{ + width: 580px; + word-wrap:break-word; +} +.module_details_block{ + display: inline-block; +} +.module_details_block .line_content{ + width:250px; + +} +/*END*/ + diff --git a/BTPanel/static/js/aes.js b/BTPanel/static/js/aes.js new file mode 100644 index 00000000..724114c1 --- /dev/null +++ b/BTPanel/static/js/aes.js @@ -0,0 +1,13 @@ +var CryptoJS=CryptoJS||(function(Math,undefined){var crypto;if(typeof window!=="undefined"&&window.crypto){crypto=window.crypto}if(!crypto&&typeof window!=="undefined"&&window.msCrypto){crypto=window.msCrypto}if(!crypto&&typeof global!=="undefined"&&global.crypto){crypto=global.crypto}if(!crypto&&typeof require==="function"){try{crypto=require("crypto")}catch(err){}}var cryptoSecureRandomInt=function(){if(crypto){if(typeof crypto.getRandomValues==="function"){try{return crypto.getRandomValues(new Uint32Array(1))[0]}catch(err){}}if(typeof crypto.randomBytes==="function"){try{return crypto.randomBytes(4).readInt32LE()}catch(err){}}}throw new Error("Native crypto module could not be used to get secure random number.")};var create=Object.create||(function(){function F(){}return function(obj){var subtype;F.prototype=obj;subtype=new F();F.prototype=null;return subtype}}());var C={};var C_lib=C.lib={};var Base=C_lib.Base=(function(){return{extend:function(overrides){var subtype=create(this);if(overrides){subtype.mixIn(overrides)}if(!subtype.hasOwnProperty("init")||this.init===subtype.init){subtype.init=function(){subtype.$super.init.apply(this,arguments)}}subtype.init.prototype=subtype;subtype.$super=this;return subtype},create:function(){var instance=this.extend();instance.init.apply(instance,arguments);return instance},init:function(){},mixIn:function(properties){for(var propertyName in properties){if(properties.hasOwnProperty(propertyName)){this[propertyName]=properties[propertyName]}}if(properties.hasOwnProperty("toString")){this.toString=properties.toString}},clone:function(){return this.init.prototype.extend(this)}}}());var WordArray=C_lib.WordArray=Base.extend({init:function(words,sigBytes){words=this.words=words||[];if(sigBytes!=undefined){this.sigBytes=sigBytes}else{this.sigBytes=words.length*4}},toString:function(encoder){return(encoder||Hex).stringify(this)},concat:function(wordArray){var thisWords=this.words;var thatWords=wordArray.words;var thisSigBytes=this.sigBytes; + var thatSigBytes=wordArray.sigBytes;this.clamp();if(thisSigBytes%4){for(var i=0;i>>2]>>>(24-(i%4)*8))&255;thisWords[(thisSigBytes+i)>>>2]|=thatByte<<(24-((thisSigBytes+i)%4)*8)}}else{for(var i=0;i>>2]=thatWords[i>>>2]}}this.sigBytes+=thatSigBytes;return this},clamp:function(){var words=this.words;var sigBytes=this.sigBytes;words[sigBytes>>>2]&=4294967295<<(32-(sigBytes%4)*8);words.length=Math.ceil(sigBytes/4)},clone:function(){var clone=Base.clone.call(this);clone.words=this.words.slice(0);return clone},random:function(nBytes){var words=[];for(var i=0;i>>2]>>>(24-(i%4)*8))&255;hexChars.push((bite>>>4).toString(16));hexChars.push((bite&15).toString(16))}return hexChars.join("")},parse:function(hexStr){var hexStrLength=hexStr.length;var words=[];for(var i=0;i>>3]|=parseInt(hexStr.substr(i,2),16)<<(24-(i%8)*4)}return new WordArray.init(words,hexStrLength/2)}};var Latin1=C_enc.Latin1={stringify:function(wordArray){var words=wordArray.words;var sigBytes=wordArray.sigBytes;var latin1Chars=[];for(var i=0;i>>2]>>>(24-(i%4)*8))&255;latin1Chars.push(String.fromCharCode(bite))}return latin1Chars.join("")},parse:function(latin1Str){var latin1StrLength=latin1Str.length;var words=[];for(var i=0;i>>2]|=(latin1Str.charCodeAt(i)&255)<<(24-(i%4)*8)}return new WordArray.init(words,latin1StrLength)}};var Utf8=C_enc.Utf8={stringify:function(wordArray){try{return decodeURIComponent(escape(Latin1.stringify(wordArray)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(utf8Str){return Latin1.parse(unescape(encodeURIComponent(utf8Str))) + }};var BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm=Base.extend({reset:function(){this._data=new WordArray.init();this._nDataBytes=0},_append:function(data){if(typeof data=="string"){data=Utf8.parse(data)}this._data.concat(data);this._nDataBytes+=data.sigBytes},_process:function(doFlush){var processedWords;var data=this._data;var dataWords=data.words;var dataSigBytes=data.sigBytes;var blockSize=this.blockSize;var blockSizeBytes=blockSize*4;var nBlocksReady=dataSigBytes/blockSizeBytes;if(doFlush){nBlocksReady=Math.ceil(nBlocksReady)}else{nBlocksReady=Math.max((nBlocksReady|0)-this._minBufferSize,0)}var nWordsReady=nBlocksReady*blockSize;var nBytesReady=Math.min(nWordsReady*4,dataSigBytes);if(nWordsReady){for(var offset=0;offset>>2]>>>(24-(i%4)*8))&255;var byte2=(words[(i+1)>>>2]>>>(24-((i+1)%4)*8))&255;var byte3=(words[(i+2)>>>2]>>>(24-((i+2)%4)*8))&255;var triplet=(byte1<<16)|(byte2<<8)|byte3;for(var j=0;(j<4)&&(i+j*0.75>>(6*(3-j)))&63))}}var paddingChar=map.charAt(64);if(paddingChar){while(base64Chars.length%4){base64Chars.push(paddingChar)}}return base64Chars.join("")},parse:function(base64Str){var base64StrLength=base64Str.length;var map=this._map;var reverseMap=this._reverseMap;if(!reverseMap){reverseMap=this._reverseMap=[];for(var j=0;j>>(6-(i%4)*2);var bitsCombined=bits1|bits2;words[nBytes>>>2]|=bitsCombined<<(24-(nBytes%4)*8);nBytes++}}return WordArray.create(words,nBytes)}}());CryptoJS.lib.Cipher||(function(undefined){var C=CryptoJS;var C_lib=C.lib;var Base=C_lib.Base;var WordArray=C_lib.WordArray;var BufferedBlockAlgorithm=C_lib.BufferedBlockAlgorithm;var C_enc=C.enc;var Utf8=C_enc.Utf8;var Base64=C_enc.Base64;var C_algo=C.algo;var EvpKDF=C_algo.EvpKDF;var Cipher=C_lib.Cipher=BufferedBlockAlgorithm.extend({cfg:Base.extend(),createEncryptor:function(key,cfg){return this.create(this._ENC_XFORM_MODE,key,cfg)},createDecryptor:function(key,cfg){return this.create(this._DEC_XFORM_MODE,key,cfg)},init:function(xformMode,key,cfg){this.cfg=this.cfg.extend(cfg);this._xformMode=xformMode;this._key=key;this.reset()},reset:function(){BufferedBlockAlgorithm.reset.call(this); + this._doReset()},process:function(dataUpdate){this._append(dataUpdate);return this._process()},finalize:function(dataUpdate){if(dataUpdate){this._append(dataUpdate)}var finalProcessedData=this._doFinalize();return finalProcessedData},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function selectCipherStrategy(key){if(typeof key=="string"){return PasswordBasedCipher}else{return SerializableCipher}}return function(cipher){return{encrypt:function(message,key,cfg){return selectCipherStrategy(key).encrypt(cipher,message,key,cfg)},decrypt:function(ciphertext,key,cfg){return selectCipherStrategy(key).decrypt(cipher,ciphertext,key,cfg)}}}}())});var StreamCipher=C_lib.StreamCipher=Cipher.extend({_doFinalize:function(){var finalProcessedBlocks=this._process(!!"flush");return finalProcessedBlocks},blockSize:1});var C_mode=C.mode={};var BlockCipherMode=C_lib.BlockCipherMode=Base.extend({createEncryptor:function(cipher,iv){return this.Encryptor.create(cipher,iv)},createDecryptor:function(cipher,iv){return this.Decryptor.create(cipher,iv)},init:function(cipher,iv){this._cipher=cipher;this._iv=iv}});var CBC=C_mode.CBC=(function(){var CBC=BlockCipherMode.extend();CBC.Encryptor=CBC.extend({processBlock:function(words,offset){var cipher=this._cipher;var blockSize=cipher.blockSize;xorBlock.call(this,words,offset,blockSize);cipher.encryptBlock(words,offset);this._prevBlock=words.slice(offset,offset+blockSize)}});CBC.Decryptor=CBC.extend({processBlock:function(words,offset){var cipher=this._cipher;var blockSize=cipher.blockSize;var thisBlock=words.slice(offset,offset+blockSize);cipher.decryptBlock(words,offset);xorBlock.call(this,words,offset,blockSize);this._prevBlock=thisBlock}});function xorBlock(words,offset,blockSize){var block;var iv=this._iv;if(iv){block=iv;this._iv=undefined}else{block=this._prevBlock}for(var i=0;i>>2]&255;data.sigBytes-=nPaddingBytes}};var BlockCipher=C_lib.BlockCipher=Cipher.extend({cfg:Cipher.cfg.extend({mode:CBC,padding:Pkcs7}),reset:function(){var modeCreator;Cipher.reset.call(this);var cfg=this.cfg;var iv=cfg.iv;var mode=cfg.mode;if(this._xformMode==this._ENC_XFORM_MODE){modeCreator=mode.createEncryptor}else{modeCreator=mode.createDecryptor;this._minBufferSize=1}if(this._mode&&this._mode.__creator==modeCreator){this._mode.init(this,iv&&iv.words)}else{this._mode=modeCreator.call(mode,this,iv&&iv.words);this._mode.__creator=modeCreator}},_doProcessBlock:function(words,offset){this._mode.processBlock(words,offset)},_doFinalize:function(){var finalProcessedBlocks;var padding=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){padding.pad(this._data,this.blockSize);finalProcessedBlocks=this._process(!!"flush")}else{finalProcessedBlocks=this._process(!!"flush");padding.unpad(finalProcessedBlocks)}return finalProcessedBlocks},blockSize:128/32});var CipherParams=C_lib.CipherParams=Base.extend({init:function(cipherParams){this.mixIn(cipherParams)},toString:function(formatter){return(formatter||this.formatter).stringify(this)}});var C_format=C.format={};var OpenSSLFormatter=C_format.OpenSSL={stringify:function(cipherParams){var wordArray;var ciphertext=cipherParams.ciphertext;var salt=cipherParams.salt;if(salt){wordArray=WordArray.create([1398893684,1701076831]).concat(salt).concat(ciphertext)}else{wordArray=ciphertext}return wordArray.toString(Base64)},parse:function(openSSLStr){var salt;var ciphertext=Base64.parse(openSSLStr);var ciphertextWords=ciphertext.words;if(ciphertextWords[0]==1398893684&&ciphertextWords[1]==1701076831){salt=WordArray.create(ciphertextWords.slice(2,4)); + ciphertextWords.splice(0,4);ciphertext.sigBytes-=16}return CipherParams.create({ciphertext:ciphertext,salt:salt})}};var SerializableCipher=C_lib.SerializableCipher=Base.extend({cfg:Base.extend({format:OpenSSLFormatter}),encrypt:function(cipher,message,key,cfg){cfg=this.cfg.extend(cfg);var encryptor=cipher.createEncryptor(key,cfg);var ciphertext=encryptor.finalize(message);var cipherCfg=encryptor.cfg;return CipherParams.create({ciphertext:ciphertext,key:key,iv:cipherCfg.iv,algorithm:cipher,mode:cipherCfg.mode,padding:cipherCfg.padding,blockSize:cipher.blockSize,formatter:cfg.format})},decrypt:function(cipher,ciphertext,key,cfg){cfg=this.cfg.extend(cfg);ciphertext=this._parse(ciphertext,cfg.format);var plaintext=cipher.createDecryptor(key,cfg).finalize(ciphertext.ciphertext);return plaintext},_parse:function(ciphertext,format){if(typeof ciphertext=="string"){return format.parse(ciphertext,this)}else{return ciphertext}}});var C_kdf=C.kdf={};var OpenSSLKdf=C_kdf.OpenSSL={execute:function(password,keySize,ivSize,salt){if(!salt){salt=WordArray.random(64/8)}var key=EvpKDF.create({keySize:keySize+ivSize}).compute(password,salt);var iv=WordArray.create(key.words.slice(keySize),ivSize*4);key.sigBytes=keySize*4;return CipherParams.create({key:key,iv:iv,salt:salt})}};var PasswordBasedCipher=C_lib.PasswordBasedCipher=SerializableCipher.extend({cfg:SerializableCipher.cfg.extend({kdf:OpenSSLKdf}),encrypt:function(cipher,message,password,cfg){cfg=this.cfg.extend(cfg);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize);cfg.iv=derivedParams.iv;var ciphertext=SerializableCipher.encrypt.call(this,cipher,message,derivedParams.key,cfg);ciphertext.mixIn(derivedParams);return ciphertext},decrypt:function(cipher,ciphertext,password,cfg){cfg=this.cfg.extend(cfg);ciphertext=this._parse(ciphertext,cfg.format);var derivedParams=cfg.kdf.execute(password,cipher.keySize,cipher.ivSize,ciphertext.salt);cfg.iv=derivedParams.iv;var plaintext=SerializableCipher.decrypt.call(this,cipher,ciphertext,derivedParams.key,cfg); + return plaintext}})}());(function(){var C=CryptoJS;var C_lib=C.lib;var BlockCipher=C_lib.BlockCipher;var C_algo=C.algo;var SBOX=[];var INV_SBOX=[];var SUB_MIX_0=[];var SUB_MIX_1=[];var SUB_MIX_2=[];var SUB_MIX_3=[];var INV_SUB_MIX_0=[];var INV_SUB_MIX_1=[];var INV_SUB_MIX_2=[];var INV_SUB_MIX_3=[];(function(){var d=[];for(var i=0;i<256;i++){if(i<128){d[i]=i<<1}else{d[i]=(i<<1)^283}}var x=0;var xi=0;for(var i=0;i<256;i++){var sx=xi^(xi<<1)^(xi<<2)^(xi<<3)^(xi<<4);sx=(sx>>>8)^(sx&255)^99;SBOX[x]=sx;INV_SBOX[sx]=x;var x2=d[x];var x4=d[x2];var x8=d[x4];var t=(d[sx]*257)^(sx*16843008);SUB_MIX_0[x]=(t<<24)|(t>>>8);SUB_MIX_1[x]=(t<<16)|(t>>>16);SUB_MIX_2[x]=(t<<8)|(t>>>24);SUB_MIX_3[x]=t;var t=(x8*16843009)^(x4*65537)^(x2*257)^(x*16843008);INV_SUB_MIX_0[sx]=(t<<24)|(t>>>8);INV_SUB_MIX_1[sx]=(t<<16)|(t>>>16);INV_SUB_MIX_2[sx]=(t<<8)|(t>>>24);INV_SUB_MIX_3[sx]=t;if(!x){x=xi=1}else{x=x2^d[d[d[x8^x2]]];xi^=d[d[xi]]}}}());var RCON=[0,1,2,4,8,16,32,64,128,27,54];var AES=C_algo.AES=BlockCipher.extend({_doReset:function(){var t;if(this._nRounds&&this._keyPriorReset===this._key){return}var key=this._keyPriorReset=this._key;var keyWords=key.words;var keySize=key.sigBytes/4;var nRounds=this._nRounds=keySize+6;var ksRows=(nRounds+1)*4;var keySchedule=this._keySchedule=[];for(var ksRow=0;ksRow>>24);t=(SBOX[t>>>24]<<24)|(SBOX[(t>>>16)&255]<<16)|(SBOX[(t>>>8)&255]<<8)|SBOX[t&255];t^=RCON[(ksRow/keySize)|0]<<24}else{if(keySize>6&&ksRow%keySize==4){t=(SBOX[t>>>24]<<24)|(SBOX[(t>>>16)&255]<<16)|(SBOX[(t>>>8)&255]<<8)|SBOX[t&255]}}keySchedule[ksRow]=keySchedule[ksRow-keySize]^t}}var invKeySchedule=this._invKeySchedule=[];for(var invKsRow=0;invKsRow>>24]]^INV_SUB_MIX_1[SBOX[(t>>>16)&255]]^INV_SUB_MIX_2[SBOX[(t>>>8)&255]]^INV_SUB_MIX_3[SBOX[t&255]] + }}},encryptBlock:function(M,offset){this._doCryptBlock(M,offset,this._keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX)},decryptBlock:function(M,offset){var t=M[offset+1];M[offset+1]=M[offset+3];M[offset+3]=t;this._doCryptBlock(M,offset,this._invKeySchedule,INV_SUB_MIX_0,INV_SUB_MIX_1,INV_SUB_MIX_2,INV_SUB_MIX_3,INV_SBOX);var t=M[offset+1];M[offset+1]=M[offset+3];M[offset+3]=t},_doCryptBlock:function(M,offset,keySchedule,SUB_MIX_0,SUB_MIX_1,SUB_MIX_2,SUB_MIX_3,SBOX){var nRounds=this._nRounds;var s0=M[offset]^keySchedule[0];var s1=M[offset+1]^keySchedule[1];var s2=M[offset+2]^keySchedule[2];var s3=M[offset+3]^keySchedule[3];var ksRow=4;for(var round=1;round>>24]^SUB_MIX_1[(s1>>>16)&255]^SUB_MIX_2[(s2>>>8)&255]^SUB_MIX_3[s3&255]^keySchedule[ksRow++];var t1=SUB_MIX_0[s1>>>24]^SUB_MIX_1[(s2>>>16)&255]^SUB_MIX_2[(s3>>>8)&255]^SUB_MIX_3[s0&255]^keySchedule[ksRow++];var t2=SUB_MIX_0[s2>>>24]^SUB_MIX_1[(s3>>>16)&255]^SUB_MIX_2[(s0>>>8)&255]^SUB_MIX_3[s1&255]^keySchedule[ksRow++];var t3=SUB_MIX_0[s3>>>24]^SUB_MIX_1[(s0>>>16)&255]^SUB_MIX_2[(s1>>>8)&255]^SUB_MIX_3[s2&255]^keySchedule[ksRow++];s0=t0;s1=t1;s2=t2;s3=t3}var t0=((SBOX[s0>>>24]<<24)|(SBOX[(s1>>>16)&255]<<16)|(SBOX[(s2>>>8)&255]<<8)|SBOX[s3&255])^keySchedule[ksRow++];var t1=((SBOX[s1>>>24]<<24)|(SBOX[(s2>>>16)&255]<<16)|(SBOX[(s3>>>8)&255]<<8)|SBOX[s0&255])^keySchedule[ksRow++];var t2=((SBOX[s2>>>24]<<24)|(SBOX[(s3>>>16)&255]<<16)|(SBOX[(s0>>>8)&255]<<8)|SBOX[s1&255])^keySchedule[ksRow++];var t3=((SBOX[s3>>>24]<<24)|(SBOX[(s0>>>16)&255]<<16)|(SBOX[(s1>>>8)&255]<<8)|SBOX[s2&255])^keySchedule[ksRow++];M[offset]=t0;M[offset+1]=t1;M[offset+2]=t2;M[offset+3]=t3},keySize:256/32});C.AES=BlockCipher._createHelper(AES)}());CryptoJS.pad.ZeroPadding={pad:function(data,blockSize){var blockSizeBytes=blockSize*4;data.clamp();data.sigBytes+=blockSizeBytes-((data.sigBytes%blockSizeBytes)||blockSizeBytes)},unpad:function(data){var dataWords=data.words;var i=data.sigBytes-1;for(var i=data.sigBytes-1; + i>=0;i--){if(((dataWords[i>>>2]>>>(24-(i%4)*8))&255)){data.sigBytes=i+1;break}}}};CryptoJS.mode.ECB=(function(){var ECB=CryptoJS.lib.BlockCipherMode.extend();ECB.Encryptor=ECB.extend({processBlock:function(words,offset){this._cipher.encryptBlock(words,offset)}});ECB.Decryptor=ECB.extend({processBlock:function(words,offset){this._cipher.decryptBlock(words,offset)}});return ECB}());CryptoJS.mode.CFB=(function(){var CFB=CryptoJS.lib.BlockCipherMode.extend();CFB.Encryptor=CFB.extend({processBlock:function(words,offset){var cipher=this._cipher;var blockSize=cipher.blockSize;generateKeystreamAndEncrypt.call(this,words,offset,blockSize,cipher);this._prevBlock=words.slice(offset,offset+blockSize)}});CFB.Decryptor=CFB.extend({processBlock:function(words,offset){var cipher=this._cipher;var blockSize=cipher.blockSize;var thisBlock=words.slice(offset,offset+blockSize);generateKeystreamAndEncrypt.call(this,words,offset,blockSize,cipher);this._prevBlock=thisBlock}});function generateKeystreamAndEncrypt(words,offset,blockSize,cipher){var keystream;var iv=this._iv;if(iv){keystream=iv.slice(0);this._iv=undefined}else{keystream=this._prevBlock}cipher.encryptBlock(keystream,0);for(var i=0;i>24)&255)===255){var b1=(word>>16)&255;var b2=(word>>8)&255;var b3=word&255;if(b1===255){b1=0;if(b2===255){b2=0; + if(b3===255){b3=0}else{++b3}}else{++b2}}else{++b1}word=0;word+=(b1<<16);word+=(b2<<8);word+=b3}else{word+=(1<<24)}return word}function incCounter(counter){if((counter[0]=incWord(counter[0]))===0){counter[1]=incWord(counter[1])}return counter}var Encryptor=CTRGladman.Encryptor=CTRGladman.extend({processBlock:function(words,offset){var cipher=this._cipher;var blockSize=cipher.blockSize;var iv=this._iv;var counter=this._counter;if(iv){counter=this._counter=iv.slice(0);this._iv=undefined}incCounter(counter);var keystream=counter.slice(0);cipher.encryptBlock(keystream,0);for(var i=0;i>>2]|=nPaddingBytes<<(24-(lastBytePos%4)*8);data.sigBytes+=nPaddingBytes},unpad:function(data){var nPaddingBytes=data.words[(data.sigBytes-1)>>>2]&255;data.sigBytes-=nPaddingBytes}};CryptoJS.pad.Iso10126={pad:function(data,blockSize){var blockSizeBytes=blockSize*4;var nPaddingBytes=blockSizeBytes-data.sigBytes%blockSizeBytes;data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes-1)).concat(CryptoJS.lib.WordArray.create([nPaddingBytes<<24],1))},unpad:function(data){var nPaddingBytes=data.words[(data.sigBytes-1)>>>2]&255;data.sigBytes-=nPaddingBytes}};CryptoJS.pad.Iso97971={pad:function(data,blockSize){data.concat(CryptoJS.lib.WordArray.create([2147483648],1)); + CryptoJS.pad.ZeroPadding.pad(data,blockSize)},unpad:function(data){CryptoJS.pad.ZeroPadding.unpad(data);data.sigBytes--}};CryptoJS.pad.NoPadding={pad:function(){},unpad:function(){}}; + \ No newline at end of file diff --git a/BTPanel/static/js/control.js b/BTPanel/static/js/control.js index 90d7ce58..2f28703b 100644 --- a/BTPanel/static/js/control.js +++ b/BTPanel/static/js/control.js @@ -27,51 +27,32 @@ $(".st").hover(function(){ $(".searcTime .gt").click(function(){ $(this).addClass("on").siblings().removeClass("on"); }) -$(".loadbtn").click(function(){ - $(this).parents(".searcTime").find("span").removeClass("on"); +$('.time_range_submit').click(function(){ + $(this).parents(".searcTime").find("span").removeClass("on"); $(this).parents(".searcTime").find(".st").addClass("on"); var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000; var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000; b = Math.round(b); e = Math.round(e); - getload(b,e) -}) -$(".cpubtn").click(function(){ - $(this).parents(".searcTime").find("span").removeClass("on"); - $(this).parents(".searcTime").find(".st").addClass("on"); - var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000; - var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000; - b = Math.round(b); - e = Math.round(e); - cpu(b,e) -}) -$(".membtn").click(function(){ - $(this).parents(".searcTime").find("span").removeClass("on"); - $(this).parents(".searcTime").find(".st").addClass("on"); - var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000; - var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000; - b = Math.round(b); - e = Math.round(e); - mem(b,e) -}) -$(".diskbtn").click(function(){ - $(this).parents(".searcTime").find("span").removeClass("on"); - $(this).parents(".searcTime").find(".st").addClass("on"); - var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000; - var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000; - b = Math.round(b); - e = Math.round(e); - disk(b,e) -}) -$(".networkbtn").click(function(){ - $(this).parents(".searcTime").find("span").removeClass("on"); - $(this).parents(".searcTime").find(".st").addClass("on"); - var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000; - var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000; - b = Math.round(b); - e = Math.round(e); - network(b,e) -}) + console.log(b,e); + switch ($(this).attr('data-type')) { + case 'getload': + getload(b,e); + break; + case 'cpu': + cpu(b,e); + break; + case 'mem': + mem(b,e); + break; + case 'disk': + disk(b,e); + break; + case 'network': + network(b,e); + break; + } +}); //指定天数 function Wday(day,name){ var now = (new Date().getTime())/1000; @@ -392,8 +373,8 @@ function disk(b, e) { //var zData = []; for (var i = 0; i < rdata.length; i++) { - rData.push((rdata[i].read_bytes / 1024 / 60).toFixed(3)); - wData.push((rdata[i].write_bytes / 1024 / 60).toFixed(3)); + rData.push((rdata[i].read_bytes / 1024 / 60).toFixed(2)); + wData.push((rdata[i].write_bytes / 1024 / 60).toFixed(2)); xData.push(rdata[i].addtime); //yData.push(rdata[i].read_count); //zData.push(rdata[i].write_count); @@ -404,7 +385,7 @@ function disk(b, e) { axisPointer: { type: 'cross' }, - formatter: lan.control.time+":{b0}
{a0}: {c0} Kb/s
{a1}: {c1} Kb/s", + //formatter: lan.control.time+":{b0}
{a0}: {c0} Kb/s
{a1}: {c1} Kb/s", }, legend: { data: [lan.control.disk_read_bytes, lan.control.disk_write_bytes] @@ -506,8 +487,8 @@ $.get('/ajax?action=GetNetWorkIo&start='+b+'&end='+e,function(rdata){ cData.push(rdata[i].down_packets); dData.push(rdata[i].up_packets); xData.push(rdata[i].addtime); - yData.push(rdata[i].up); - zData.push(rdata[i].down); + yData.push(rdata[i].up.toFixed(2)); + zData.push(rdata[i].down.toFixed(2)); } option = { tooltip: { diff --git a/BTPanel/static/js/files.js b/BTPanel/static/js/files.js index 16cf739f..5bcf796d 100644 --- a/BTPanel/static/js/files.js +++ b/BTPanel/static/js/files.js @@ -671,7 +671,7 @@ function Recycle_bin(type) { ' + lan.files.recycle_bin_th2 + '\ ' + lan.files.recycle_bin_th3 + '\ ' + lan.files.recycle_bin_th4 + '\ - ' + lan.files.recycle_bin_th5 + '\ + ' + lan.files.recycle_bin_th5 + '\ \ \ ' + body + '\ diff --git a/BTPanel/static/js/index.js b/BTPanel/static/js/index.js index bb3178df..491610ed 100644 --- a/BTPanel/static/js/index.js +++ b/BTPanel/static/js/index.js @@ -3,6 +3,8 @@ bt.pub.check_install(function (rdata) { }) var interval_stop = false; var index = { + warning_list:[], + warning_num:0, interval: { limit: 10, count: 0, @@ -91,9 +93,9 @@ var index = { }, get_init: function () { var _this = this; - setTimeout(function () { _this.get_disk_list(); }, 500) - setTimeout(function () { _this.get_server_info(); }, 1000) - + setTimeout(function () { _this.get_disk_list(); }, 10); + setTimeout(function () { _this.get_warning_list(); }, 20); + setTimeout(function () { _this.get_server_info(); }, 30); bt.pub.get_user_info(function (rdata) { if (rdata.status) { @@ -200,13 +202,13 @@ var index = { }) }) }); - setTimeout(function () { _this.interval.start(); }, 1600) - setTimeout(function () { index.get_index_list(); }, 1200) + setTimeout(function () { _this.interval.start(); }, 40) + setTimeout(function () { index.get_index_list(); }, 50) setTimeout(function () { _this.net.init(); - }, 200); + }, 60); setTimeout(function () { bt.system.check_update(function (rdata) { @@ -222,7 +224,7 @@ var index = { // } }, false) - }, 1500) + }, 70) }, get_data_info: function (callback) { var _this = $(this); @@ -236,7 +238,7 @@ var index = { index.set_val(_membox, { usage: (net.mem.memRealUsed * 100 / net.mem.memTotal).toFixed(1), items: pub_arr, title: net.mem.memRealUsed + '/' + net.mem.memTotal + '(MB)' }) bt.set_cookie('memSize', net.mem.memTotal) for (var i = 0; i < _diskbox.length; i++) { - index.set_val(_diskbox.eq(i), { usage: net.disk[i].size[3].split('%')[0], title: net.disk[i].size[1]+'/'+net.disk[0].size[0], items: pub_arr }) + index.set_val(_diskbox.eq(i), { usage: net.disk[i].size[3].split('%')[0], title: net.disk[i].size[1]+'/'+net.disk[i].size[0], items: pub_arr }) } var _lval = Math.round((net.load.one / net.load.max) * 100); @@ -366,6 +368,7 @@ var index = { color = '#dd2f00' break; } + index.set_val(_li, { usage: item.rate, color: color }) _tab.append(_li); } @@ -468,28 +471,34 @@ var index = { bt.msg(rdata); return; } - var loading = bt.open({ + var result = rdata, + is_beta = rdata.msg.is_beta, + loading = bt.open({ type: 1, title: '[Linux' + (rdata.msg.is_beta == 1 ? lan.index.test_version : lan.index.final_version) + ']-'+lan.index.update_log, - area: '520px', + area: '550px', shadeClose: false, skin: 'layui-layer-dialog', closeBtn: 2, content: '
\
'+lan.index.last_version_now+'
\ -
'+lan.index.this_version+''+lan.index.bt_linux+ (rdata.msg.is_beta == 1 ? lan.index.test_version+' ' + rdata.msg.beta.version : lan.index.final_version+' ' + rdata.msg.version) + ' &n'+ lan.index.release_time + (rdata.msg.is_beta == 1 ? rdata.msg.beta.uptime : rdata.msg.uptime) + '
\ +
'+lan.index.this_version+''+lan.index.bt_linux+ (rdata.msg.is_beta == 1 ? lan.index.test_version+' ' + rdata.msg.beta.version : lan.index.final_version+' ' + rdata.msg.version) + '  '+ lan.index.release_time + (rdata.msg.is_beta == 1 ? rdata.msg.beta.uptime : rdata.msg.uptime) + '
\ +
\ +
'+ (is_beta != 1 ? lan.index.test_version : lan.index.final_version) + lan.index.last_version_is + (result.msg.is_beta != 1 ? result.msg.beta.version : result.msg.version) + '       '+lan.index.update_time+'  ' + (is_beta != 1 ? result.msg.beta.uptime : result.msg.uptime) + '
\ + '+ (is_beta !== 1 ? ''+lan.index.update_verison_click+''+lan.index.check_detail+'' : ''+lan.index.change_final_click+''+lan.index.change_final+'') + '\ +
\
\ \ \
\
\