Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
c0ea19e1
Commit
c0ea19e1
authored
May 12, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance:Setting)编码管理」新增解码器管理, 可创建自定义解码器
parent
45c764b3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
223 additions
and
54 deletions
+223
-54
CHANGELOG.md
CHANGELOG.md
+1
-0
en.js
source/language/en.js
+17
-8
zh.js
source/language/zh.js
+17
-8
zh_hk.js
source/language/zh_hk.js
+16
-8
zh_tw.js
source/language/zh_tw.js
+17
-8
encoders.js
source/modules/settings/encoders.js
+155
-22
No files found.
CHANGELOG.md
View file @
c0ea19e1
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
*
新增第三方库 marked 0.6.2 用于 markdown 渲染
*
新增第三方库 marked 0.6.2 用于 markdown 渲染
*
更新提示窗口新增 ReleaseNote 显示(缩放显示,图片看不清可直接前往 github 查看详细更新日志), 新增 「更新日志」按钮(点击后直接打开 github release 页)
*
更新提示窗口新增 ReleaseNote 显示(缩放显示,图片看不清可直接前往 github 查看详细更新日志), 新增 「更新日志」按钮(点击后直接打开 github release 页)
*
「编码管理」新增「获取更多」按钮, 打开浏览器访问 AwesomeEncoder(自定义编码器分享), 如果你有比较好的 Encoder, 欢迎向这个仓库提PR
*
「编码管理」新增「获取更多」按钮, 打开浏览器访问 AwesomeEncoder(自定义编码器分享), 如果你有比较好的 Encoder, 欢迎向这个仓库提PR
*
「编码管理」新增解码器管理, 可创建自定义解码器
## 2019/04/27 `v(2.1.1)`
## 2019/04/27 `v(2.1.1)`
...
...
source/language/en.js
View file @
c0ea19e1
...
@@ -653,8 +653,11 @@ Hot Keys:
...
@@ -653,8 +653,11 @@ Hot Keys:
},
},
encoders
:
{
encoders
:
{
title
:
'Encoder Manager'
,
title
:
'Encoder Manager'
,
encoder
:
"Encoder"
,
decoder
:
"Decoder"
,
toolbar
:
{
toolbar
:
{
new
:
"New"
,
new
:
"New Encoder"
,
new_decoder
:
"New Decoder"
,
edit
:
"Edit"
,
edit
:
"Edit"
,
delete
:
"Delete"
,
delete
:
"Delete"
,
help
:
"Help"
,
help
:
"Help"
,
...
@@ -665,7 +668,12 @@ Hot Keys:
...
@@ -665,7 +668,12 @@ Hot Keys:
},
},
grid
:
{
grid
:
{
ename
:
"Name"
,
ename
:
"Name"
,
etype
:
"Type"
etype
:
"Shell Type"
,
edtype
:
{
title
:
"Type"
,
encoder
:
"Encoder"
,
decoder
:
"Decoder"
,
},
},
},
form
:
{
form
:
{
public_key
:
"Public Key"
,
public_key
:
"Public Key"
,
...
@@ -673,17 +681,17 @@ Hot Keys:
...
@@ -673,17 +681,17 @@ Hot Keys:
php_code
:
"PHP Code"
php_code
:
"PHP Code"
},
},
rsa_config_win_title
:
"RSA Encoder Config"
,
rsa_config_win_title
:
"RSA Encoder Config"
,
edit_win_title
:
"Edit
Encoder
"
,
edit_win_title
:
"Edit"
,
delete_title
:
"Delete
Encoder
"
,
delete_title
:
"Delete"
,
message
:
{
message
:
{
ename_duplicate
:
"The
encoder
name cannot be duplicated"
,
ename_duplicate
:
"The name cannot be duplicated"
,
rename_success
:
"Rename success"
,
rename_success
:
"Rename success"
,
etype_error
:
"
Encoder t
ype error"
,
etype_error
:
"
T
ype error"
,
retype_success
:
"Modify type success"
,
retype_success
:
"Modify type success"
,
create_success
:
"Create
encoder
success"
,
create_success
:
"Create success"
,
edit_not_select
:
"Please select the row you want to edit first"
,
edit_not_select
:
"Please select the row you want to edit first"
,
edit_only_single
:
"You can only edit one"
,
edit_only_single
:
"You can only edit one"
,
edit_null_value
:
"
Encoder c
ontent can not be empty"
,
edit_null_value
:
"
C
ontent can not be empty"
,
edit_save_success
:
"Save success"
,
edit_save_success
:
"Save success"
,
delete_not_select
:
"Please select the row you want to delete first"
,
delete_not_select
:
"Please select the row you want to delete first"
,
delete_success
:
"Delete success"
,
delete_success
:
"Delete success"
,
...
@@ -693,6 +701,7 @@ Hot Keys:
...
@@ -693,6 +701,7 @@ Hot Keys:
},
},
prompt
:
{
prompt
:
{
create_encoder
:
"Create Encoder"
,
create_encoder
:
"Create Encoder"
,
create_decoder
:
"Create Decoder"
,
},
},
confirm
:
{
confirm
:
{
generate
:
'Are you sure to regemerate RSA?'
,
generate
:
'Are you sure to regemerate RSA?'
,
...
...
source/language/zh.js
View file @
c0ea19e1
...
@@ -655,8 +655,11 @@ module.exports = {
...
@@ -655,8 +655,11 @@ module.exports = {
},
},
encoders
:
{
encoders
:
{
title
:
'编码管理'
,
title
:
'编码管理'
,
encoder
:
"编码器"
,
decoder
:
"解码器"
,
toolbar
:
{
toolbar
:
{
new
:
"新建"
,
new
:
"新建编码器"
,
new_decoder
:
"新建解码器"
,
edit
:
"编辑"
,
edit
:
"编辑"
,
delete
:
"删除"
,
delete
:
"删除"
,
help
:
"帮助"
,
help
:
"帮助"
,
...
@@ -667,7 +670,12 @@ module.exports = {
...
@@ -667,7 +670,12 @@ module.exports = {
},
},
grid
:
{
grid
:
{
ename
:
"名称"
,
ename
:
"名称"
,
etype
:
"类型"
etype
:
"Shell类型"
,
edtype
:
{
title
:
"类型"
,
encoder
:
"编码器"
,
decoder
:
"解码器"
,
},
},
},
form
:
{
form
:
{
public_key
:
"公钥"
,
public_key
:
"公钥"
,
...
@@ -675,17 +683,17 @@ module.exports = {
...
@@ -675,17 +683,17 @@ module.exports = {
php_code
:
"PHP 代码"
php_code
:
"PHP 代码"
},
},
rsa_config_win_title
:
"RSA编码器配置"
,
rsa_config_win_title
:
"RSA编码器配置"
,
edit_win_title
:
"编辑
编码器
"
,
edit_win_title
:
"编辑"
,
delete_title
:
"删除
编码器
"
,
delete_title
:
"删除"
,
message
:
{
message
:
{
ename_duplicate
:
"
编码器
名称不能重复"
,
ename_duplicate
:
"名称不能重复"
,
rename_success
:
"重命名成功"
,
rename_success
:
"重命名成功"
,
etype_error
:
"
编码器
类型错误"
,
etype_error
:
"类型错误"
,
retype_success
:
"类型修改成功"
,
retype_success
:
"类型修改成功"
,
create_success
:
"新增
编码器
成功"
,
create_success
:
"新增成功"
,
edit_not_select
:
"请先选中要编辑的行"
,
edit_not_select
:
"请先选中要编辑的行"
,
edit_only_single
:
"只能编辑一个"
,
edit_only_single
:
"只能编辑一个"
,
edit_null_value
:
"
编码器
内容不能为空"
,
edit_null_value
:
"内容不能为空"
,
edit_save_success
:
"保存成功"
,
edit_save_success
:
"保存成功"
,
delete_not_select
:
"请先选中要删除的行"
,
delete_not_select
:
"请先选中要删除的行"
,
delete_success
:
"删除成功"
,
delete_success
:
"删除成功"
,
...
@@ -695,6 +703,7 @@ module.exports = {
...
@@ -695,6 +703,7 @@ module.exports = {
},
},
prompt
:
{
prompt
:
{
create_encoder
:
"创建编码器"
,
create_encoder
:
"创建编码器"
,
create_decoder
:
"创建解码器"
,
},
},
confirm
:
{
confirm
:
{
generate
:
'你确定要重新生成?'
,
generate
:
'你确定要重新生成?'
,
...
...
source/language/zh_hk.js
View file @
c0ea19e1
...
@@ -654,8 +654,11 @@ module.exports = {
...
@@ -654,8 +654,11 @@ module.exports = {
},
},
encoders
:
{
encoders
:
{
title
:
'編碼管理'
,
title
:
'編碼管理'
,
encoder
:
"編碼器"
,
decoder
:
"解碼器"
,
toolbar
:
{
toolbar
:
{
new
:
"新建"
,
new
:
"新建編碼器"
,
new_decoder
:
"新建解碼器"
,
edit
:
"編輯"
,
edit
:
"編輯"
,
delete
:
"刪除"
,
delete
:
"刪除"
,
help
:
"幫助"
,
help
:
"幫助"
,
...
@@ -666,7 +669,12 @@ module.exports = {
...
@@ -666,7 +669,12 @@ module.exports = {
},
},
grid
:
{
grid
:
{
ename
:
"名稱"
,
ename
:
"名稱"
,
etype
:
"類型"
etype
:
"Shell類型"
,
edtype
:
{
title
:
"類型"
,
encoder
:
"編碼器"
,
decoder
:
"解碼器"
,
},
},
},
form
:
{
form
:
{
public_key
:
"公鑰"
,
public_key
:
"公鑰"
,
...
@@ -674,17 +682,17 @@ module.exports = {
...
@@ -674,17 +682,17 @@ module.exports = {
php_code
:
"PHP 代碼"
php_code
:
"PHP 代碼"
},
},
rsa_config_win_title
:
"RSA編碼器配置"
,
rsa_config_win_title
:
"RSA編碼器配置"
,
edit_win_title
:
"編輯
編碼器
"
,
edit_win_title
:
"編輯"
,
delete_title
:
"刪除
編碼器
"
,
delete_title
:
"刪除"
,
message
:
{
message
:
{
ename_duplicate
:
"
編碼器
名稱不能重複"
,
ename_duplicate
:
"名稱不能重複"
,
rename_success
:
"重命名成功"
,
rename_success
:
"重命名成功"
,
etype_error
:
"
編碼器
類型錯誤"
,
etype_error
:
"類型錯誤"
,
retype_success
:
"類型修改成功"
,
retype_success
:
"類型修改成功"
,
create_success
:
"新增
編碼器
成功"
,
create_success
:
"新增成功"
,
edit_not_select
:
"請先選中要編輯的行"
,
edit_not_select
:
"請先選中要編輯的行"
,
edit_only_single
:
"只能編輯一個"
,
edit_only_single
:
"只能編輯一個"
,
edit_null_value
:
"
編碼器
內容不能為空"
,
edit_null_value
:
"內容不能為空"
,
edit_save_success
:
"保存成功"
,
edit_save_success
:
"保存成功"
,
delete_not_select
:
"請先選中要刪除的行"
,
delete_not_select
:
"請先選中要刪除的行"
,
delete_success
:
"刪除成功"
,
delete_success
:
"刪除成功"
,
...
...
source/language/zh_tw.js
View file @
c0ea19e1
...
@@ -654,8 +654,11 @@ module.exports = {
...
@@ -654,8 +654,11 @@ module.exports = {
},
},
encoders
:
{
encoders
:
{
title
:
'編碼管理'
,
title
:
'編碼管理'
,
encoder
:
"編碼器"
,
decoder
:
"解碼器"
,
toolbar
:
{
toolbar
:
{
new
:
"新建"
,
new
:
"新建編碼器"
,
new_decoder
:
"新建解碼器"
,
edit
:
"編輯"
,
edit
:
"編輯"
,
delete
:
"刪除"
,
delete
:
"刪除"
,
help
:
"幫助"
,
help
:
"幫助"
,
...
@@ -666,7 +669,12 @@ module.exports = {
...
@@ -666,7 +669,12 @@ module.exports = {
},
},
grid
:
{
grid
:
{
ename
:
"名稱"
,
ename
:
"名稱"
,
etype
:
"類型"
etype
:
"Shell類型"
,
edtype
:
{
title
:
"類型"
,
encoder
:
"編碼器"
,
decoder
:
"解碼器"
,
},
},
},
form
:
{
form
:
{
public_key
:
"公鑰"
,
public_key
:
"公鑰"
,
...
@@ -674,17 +682,17 @@ module.exports = {
...
@@ -674,17 +682,17 @@ module.exports = {
php_code
:
"PHP 代碼"
php_code
:
"PHP 代碼"
},
},
rsa_config_win_title
:
"RSA編碼器配置"
,
rsa_config_win_title
:
"RSA編碼器配置"
,
edit_win_title
:
"編輯
編碼器
"
,
edit_win_title
:
"編輯"
,
delete_title
:
"刪除
編碼器
"
,
delete_title
:
"刪除"
,
message
:
{
message
:
{
ename_duplicate
:
"
編碼器
名稱不能重複"
,
ename_duplicate
:
"名稱不能重複"
,
rename_success
:
"重命名成功"
,
rename_success
:
"重命名成功"
,
etype_error
:
"
編碼器
類型錯誤"
,
etype_error
:
"類型錯誤"
,
retype_success
:
"類型修改成功"
,
retype_success
:
"類型修改成功"
,
create_success
:
"新增
編碼器
成功"
,
create_success
:
"新增成功"
,
edit_not_select
:
"請先選中要編輯的行"
,
edit_not_select
:
"請先選中要編輯的行"
,
edit_only_single
:
"只能編輯一個"
,
edit_only_single
:
"只能編輯一個"
,
edit_null_value
:
"
編碼器
內容不能為空"
,
edit_null_value
:
"內容不能為空"
,
edit_save_success
:
"保存成功"
,
edit_save_success
:
"保存成功"
,
delete_not_select
:
"請先選中要刪除的行"
,
delete_not_select
:
"請先選中要刪除的行"
,
delete_success
:
"刪除成功"
,
delete_success
:
"刪除成功"
,
...
@@ -694,6 +702,7 @@ module.exports = {
...
@@ -694,6 +702,7 @@ module.exports = {
},
},
prompt
:
{
prompt
:
{
create_encoder
:
"創建編碼器"
,
create_encoder
:
"創建編碼器"
,
create_decoder
:
"创建解碼器"
,
},
},
confirm
:
{
confirm
:
{
generate
:
'妳確定要重新生成?'
,
generate
:
'妳確定要重新生成?'
,
...
...
source/modules/settings/encoders.js
View file @
c0ea19e1
...
@@ -18,6 +18,7 @@ class Encoders {
...
@@ -18,6 +18,7 @@ class Encoders {
constructor
(
sidebar
)
{
constructor
(
sidebar
)
{
var
that
=
this
;
var
that
=
this
;
this
.
encoders
=
antSword
[
"encoders"
];
this
.
encoders
=
antSword
[
"encoders"
];
this
.
decoders
=
antSword
[
"decoders"
];
let
keyPath
=
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/`
);
let
keyPath
=
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/`
);
this
.
rsa
=
{
this
.
rsa
=
{
...
@@ -48,6 +49,14 @@ class Encoders {
...
@@ -48,6 +49,14 @@ class Encoders {
{
id
:
'new_php_rsa'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"PHP RSA"
}
{
id
:
'new_php_rsa'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"PHP RSA"
}
]
]
},
},
{
type
:
'buttonSelect'
,
text
:
LANG
[
'toolbar'
][
'new_decoder'
],
icon
:
'plus-circle'
,
id
:
'new_decoder'
,
openAll
:
true
,
options
:
[
{
id
:
'new_php_decoder'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"PHP"
},
{
type
:
'separator'
},
{
id
:
'new_custom_decoder'
,
icon
:
'file-code-o'
,
type
:
'button'
,
text
:
"Custom"
},
]
},
{
type
:
'separator'
},
{
type
:
'separator'
},
{
type
:
'button'
,
text
:
LANG
[
'toolbar'
][
'edit'
],
icon
:
'fa fa-edit'
,
id
:
'edit'
},
{
type
:
'button'
,
text
:
LANG
[
'toolbar'
][
'edit'
],
icon
:
'fa fa-edit'
,
id
:
'edit'
},
{
type
:
'button'
,
text
:
LANG
[
'toolbar'
][
'delete'
],
icon
:
'fa fa-trash-o'
,
id
:
'delete'
},
{
type
:
'button'
,
text
:
LANG
[
'toolbar'
][
'delete'
],
icon
:
'fa fa-trash-o'
,
id
:
'delete'
},
...
@@ -72,6 +81,12 @@ class Encoders {
...
@@ -72,6 +81,12 @@ class Encoders {
case
"new_custom"
:
case
"new_custom"
:
that
.
createEncoder
(
id
);
that
.
createEncoder
(
id
);
break
;
break
;
case
"new_php_decoder"
:
that
.
createEncoder
(
id
,
'decoder'
);
break
;
case
"new_custom_decoder"
:
that
.
createEncoder
(
id
,
'decoder'
);
break
;
case
"edit"
:
case
"edit"
:
that
.
editEncoder
();
that
.
editEncoder
();
break
;
break
;
...
@@ -91,12 +106,13 @@ class Encoders {
...
@@ -91,12 +106,13 @@ class Encoders {
grid
.
setHeader
(
`
grid
.
setHeader
(
`
,
,
${
LANG
[
'grid'
][
'ename'
]}
,
${
LANG
[
'grid'
][
'ename'
]}
,
${
LANG
[
'grid'
][
'etype'
]}
${
LANG
[
'grid'
][
'etype'
]}
,
${
LANG
[
'grid'
][
'edtype'
][
'title'
]}
`
);
`
);
grid
.
setColTypes
(
"ro,edtxt,coro"
);
grid
.
setColTypes
(
"ro,edtxt,coro
,ro
"
);
grid
.
setColSorting
(
'str,str,str'
);
grid
.
setColSorting
(
'str,str,str
,str
'
);
grid
.
setInitWidths
(
"40,*,150"
);
grid
.
setInitWidths
(
"40,*,150
,150
"
);
grid
.
setColAlign
(
"center,left,center"
);
grid
.
setColAlign
(
"center,left,center
,center
"
);
grid
.
enableMultiselect
(
true
);
grid
.
enableMultiselect
(
true
);
var
combobox
=
grid
.
getCombo
(
2
);
var
combobox
=
grid
.
getCombo
(
2
);
combobox
.
put
(
"asp"
,
"ASP"
);
combobox
.
put
(
"asp"
,
"ASP"
);
...
@@ -113,6 +129,7 @@ class Encoders {
...
@@ -113,6 +129,7 @@ class Encoders {
var
oename
=
grid
.
getRowAttribute
(
rId
,
"ename"
);
var
oename
=
grid
.
getRowAttribute
(
rId
,
"ename"
);
var
oepath
=
grid
.
getRowAttribute
(
rId
,
"epath"
);
var
oepath
=
grid
.
getRowAttribute
(
rId
,
"epath"
);
var
oetype
=
grid
.
getRowAttribute
(
rId
,
"etype"
);
var
oetype
=
grid
.
getRowAttribute
(
rId
,
"etype"
);
var
oedtype
=
grid
.
getRowAttribute
(
rId
,
"edtype"
);
oepath
=
oepath
+
".js"
;
oepath
=
oepath
+
".js"
;
switch
(
cInd
)
{
switch
(
cInd
)
{
case
1
:
case
1
:
...
@@ -125,7 +142,7 @@ class Encoders {
...
@@ -125,7 +142,7 @@ class Encoders {
toastr
.
error
(
LANG
[
'message'
][
'ename_duplicate'
],
LANG_T
[
'error'
]);
toastr
.
error
(
LANG
[
'message'
][
'ename_duplicate'
],
LANG_T
[
'error'
]);
return
;
return
;
}
}
fs
.
renameSync
(
oepath
,
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
oetype
}
/
encoder
/
${
nValue
}
.js`
));
fs
.
renameSync
(
oepath
,
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
oetype
}
/
${
oedtype
}
/
${
nValue
}
.js`
));
toastr
.
success
(
LANG
[
'message'
][
"rename_success"
],
LANG_T
[
"success"
]);
toastr
.
success
(
LANG
[
'message'
][
"rename_success"
],
LANG_T
[
"success"
]);
break
break
case
2
:
case
2
:
...
@@ -138,11 +155,16 @@ class Encoders {
...
@@ -138,11 +155,16 @@ class Encoders {
toastr
.
error
(
LANG
[
'message'
][
'ename_duplicate'
],
LANG_T
[
'error'
]);
toastr
.
error
(
LANG
[
'message'
][
'ename_duplicate'
],
LANG_T
[
'error'
]);
return
;
return
;
}
}
fs
.
renameSync
(
oepath
,
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
nValue
}
/encoder/
${
oename
}
.js`
));
if
(
oedtype
===
"decoder"
&&
nValue
!=
"php"
&&
nValue
!=
"custom"
)
{
toastr
.
error
(
"Not Support"
,
LANG_T
[
"error"
]);
return
;
}
fs
.
renameSync
(
oepath
,
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
nValue
}
/
${
oedtype
}
/
${
oename
}
.js`
));
toastr
.
success
(
LANG
[
'message'
][
"retype_success"
],
LANG_T
[
"success"
]);
toastr
.
success
(
LANG
[
'message'
][
"retype_success"
],
LANG_T
[
"success"
]);
break
break
}
}
that
.
syncencoders
();
that
.
syncencoders
();
that
.
syncdecoders
();
}
}
});
});
grid
.
init
();
grid
.
init
();
...
@@ -153,14 +175,15 @@ class Encoders {
...
@@ -153,14 +175,15 @@ class Encoders {
}
}
// 创建新的编码器
// 创建新的编码器
createEncoder
(
id
)
{
createEncoder
(
id
,
edtype
=
"encoder"
)
{
let
self
=
this
;
let
self
=
this
;
let
idArr
=
id
.
split
(
'_'
);
let
idArr
=
id
.
split
(
'_'
);
let
type
=
idArr
[
1
];
let
type
=
idArr
[
1
];
let
rsa
=
idArr
.
length
>=
3
?
'_rsa'
:
''
;
let
rsa
=
idArr
.
length
>=
3
?
(
idArr
[
2
]
===
'rsa'
?
'_rsa'
:
''
)
:
''
;
layer
.
prompt
({
layer
.
prompt
({
value
:
`my
encoder
`
,
value
:
`my
${
edtype
}
`
,
title
:
`<i class="fa fa-file-code-o"></i>
${
LANG
[
"prompt"
][
"create_encoder"
]}
`
title
:
`<i class="fa fa-file-code-o"></i>
`
+
LANG
[
"prompt"
][
`create_
${
edtype
}
`
]
},
(
value
,
i
,
e
)
=>
{
},
(
value
,
i
,
e
)
=>
{
value
=
value
.
toLocaleLowerCase
();
value
=
value
.
toLocaleLowerCase
();
if
(
!
value
.
match
(
/^
[
a-zA-Z0-9_
]
+$/
))
{
if
(
!
value
.
match
(
/^
[
a-zA-Z0-9_
]
+$/
))
{
...
@@ -172,9 +195,19 @@ class Encoders {
...
@@ -172,9 +195,19 @@ class Encoders {
layer
.
close
(
i
);
layer
.
close
(
i
);
return
return
}
}
let
savePath
=
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
type
}
/encoder/
${
value
}${
rsa
}
.js`
);
let
savePath
=
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
type
}
/
${
edtype
}
/
${
value
}${
rsa
}
.js`
);
fs
.
writeFileSync
(
savePath
,
rsa
?
self
.
default_rsa_template
:
self
.
default_template
);
let
filedata
=
''
;
if
(
edtype
===
'encoder'
)
{
if
(
rsa
)
{
filedata
=
self
.
default_rsa_template
;
}
else
{
filedata
=
self
.
default_template
;
}
}
else
{
filedata
=
self
.
default_decoder_template
;
}
fs
.
writeFileSync
(
savePath
,
filedata
);
var
ids
=
self
.
grid
.
getAllRowIds
();
var
ids
=
self
.
grid
.
getAllRowIds
();
let
_id
=
1
;
let
_id
=
1
;
...
@@ -182,11 +215,15 @@ class Encoders {
...
@@ -182,11 +215,15 @@ class Encoders {
_id
=
parseInt
(
ids
[
ids
.
length
-
1
]);
_id
=
parseInt
(
ids
[
ids
.
length
-
1
]);
}
}
_id
++
;
_id
++
;
self
.
grid
.
addRow
(
_id
,
`
${
_id
}
,
${
antSword
.
noxss
(
value
)}
,
${
type
}
`
);
self
.
grid
.
addRow
(
_id
,
`
${
_id
}
,
${
antSword
.
noxss
(
value
)}
,
${
type
}
,
${
edtype
}
`
);
toastr
.
success
(
LANG
[
"message"
][
"create_success"
],
LANG_T
[
"success"
]);
toastr
.
success
(
LANG
[
"message"
][
"create_success"
],
LANG_T
[
"success"
]);
self
.
cell
.
progressOff
();
self
.
cell
.
progressOff
();
layer
.
close
(
i
);
layer
.
close
(
i
);
self
.
syncencoders
();
if
(
edtype
===
'encoder'
)
{
self
.
syncencoders
();
}
else
{
self
.
syncdecoders
();
}
});
});
}
}
...
@@ -207,9 +244,10 @@ class Encoders {
...
@@ -207,9 +244,10 @@ class Encoders {
let
_id
=
_ids
[
0
];
let
_id
=
_ids
[
0
];
const
ename
=
self
.
grid
.
getRowAttribute
(
_id
,
'ename'
);
const
ename
=
self
.
grid
.
getRowAttribute
(
_id
,
'ename'
);
const
epath
=
self
.
grid
.
getRowAttribute
(
_id
,
'epath'
);
const
epath
=
self
.
grid
.
getRowAttribute
(
_id
,
'epath'
);
const
edtype
=
self
.
grid
.
getRowAttribute
(
_id
,
'edtype'
);
let
buff
=
fs
.
readFileSync
(
epath
+
".js"
);
let
buff
=
fs
.
readFileSync
(
epath
+
".js"
);
let
opt
=
{
let
opt
=
{
title
:
`
${
LANG
[
"edit_win_title"
]}
:
${
ename
}
`
,
title
:
`
${
LANG
[
"edit_win_title"
]}
${
LANG
[
edtype
]}
:
${
ename
}
`
,
width
:
800
,
width
:
800
,
height
:
600
,
height
:
600
,
};
};
...
@@ -265,7 +303,11 @@ class Encoders {
...
@@ -265,7 +303,11 @@ class Encoders {
// 定时刷新
// 定时刷新
const
inter
=
setInterval
(
editor
.
resize
.
bind
(
editor
),
200
);
const
inter
=
setInterval
(
editor
.
resize
.
bind
(
editor
),
200
);
_win
.
win
.
attachEvent
(
'onClose'
,
()
=>
{
_win
.
win
.
attachEvent
(
'onClose'
,
()
=>
{
self
.
syncencoders
();
if
(
edtype
===
'encoder'
)
{
self
.
syncencoders
();
}
else
{
self
.
syncdecoders
();
}
clearInterval
(
inter
);
clearInterval
(
inter
);
return
true
;
return
true
;
});
});
...
@@ -404,6 +446,7 @@ eval($cmd);`);
...
@@ -404,6 +446,7 @@ eval($cmd);`);
});
});
toastr
.
success
(
LANG
[
"message"
][
"delete_success"
],
LANG_T
[
"success"
]);
toastr
.
success
(
LANG
[
"message"
][
"delete_success"
],
LANG_T
[
"success"
]);
self
.
syncencoders
();
self
.
syncencoders
();
self
.
syncdecoders
();
});
});
}
}
...
@@ -420,7 +463,7 @@ eval($cmd);`);
...
@@ -420,7 +463,7 @@ eval($cmd);`);
* @param {Array} data 编码器处理前的 payload 数组
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
*/
module.exports = (pwd, data) => {
module.exports = (pwd, data
, ext={}
) => {
// ########## 请在下方编写你自己的代码 ###################
// ########## 请在下方编写你自己的代码 ###################
// 以下代码为 PHP Base64 样例
// 以下代码为 PHP Base64 样例
...
@@ -455,7 +498,7 @@ module.exports = (pwd, data) => {
...
@@ -455,7 +498,7 @@ module.exports = (pwd, data) => {
* @param {Array} data 编码器处理前的 payload 数组
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
*/
module.exports = (pwd, data, ext) => {
module.exports = (pwd, data, ext
={}
) => {
let n = Math.ceil(data['_'].length / 80);
let n = Math.ceil(data['_'].length / 80);
let l = Math.ceil(data['_'].length / n);
let l = Math.ceil(data['_'].length / n);
let r = []
let r = []
...
@@ -465,6 +508,44 @@ module.exports = (pwd, data, ext) => {
...
@@ -465,6 +508,44 @@ module.exports = (pwd, data, ext) => {
data[pwd] = r.join("|");
data[pwd] = r.join("|");
delete data['_'];
delete data['_'];
return data;
return data;
}`
;
}
get
default_decoder_template
()
{
return
`/**
* php::base64解码器
* Create at:
${
new
Date
().
format
(
"yyyy/MM/dd hh:mm:ss"
)}
*/
'use strict';
module.exports = {
/**
* @returns {string} asenc 将返回数据base64编码
* 自定义输出函数名称必须为 asenc
* 该函数使用的语法需要和shell保持一致
*/
asoutput: () => {
return \`function asenc($out){
return @base64_encode($out);
}
\`.replace(/\\n\\s+/g, '');
},
/**
* 解码字符串
* @param {string} data 要被解码的字符串
* @returns {string} 解码后的字符串
*/
decode_str: (data, ext={}) => {
return Buffer.from(data, 'base64').toString();
},
/**
* 解码 Buffer
* @param {string} data 要被解码的 Buffer
* @returns {string} 解码后的 Buffer
*/
decode_buff: (data, ext={}) => {
return Buffer.from(data.toString(), 'base64');
}
}`
;
}`
;
}
}
// 检查 name 是否重复
// 检查 name 是否重复
...
@@ -484,11 +565,32 @@ module.exports = (pwd, data, ext) => {
...
@@ -484,11 +565,32 @@ module.exports = (pwd, data, ext) => {
id
:
_id
,
id
:
_id
,
ename
:
_
,
ename
:
_
,
epath
:
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
t
}
/encoder/
${
_
}
`
),
epath
:
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
t
}
/encoder/
${
_
}
`
),
etype
:
t
,
etype
:
t
,
// shell Type
edtype
:
'encoder'
,
data
:
[
data
:
[
`<i class="fa fa-file-code-o"></i>`
,
`<i class="fa fa-file-code-o"></i>`
,
antSword
.
noxss
(
_
),
antSword
.
noxss
(
_
),
t
t
,
LANG
[
'grid'
][
'edtype'
][
'encoder'
]
]
});
_id
++
;
});
});
Object
.
keys
(
self
.
decoders
).
map
((
t
)
=>
{
self
.
decoders
[
t
].
map
(
_
=>
{
data
.
push
({
id
:
_id
,
ename
:
_
,
epath
:
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
`antData/encoders/
${
t
}
/decoder/
${
_
}
`
),
etype
:
t
,
// shell Type
edtype
:
'decoder'
,
data
:
[
`<i class="fa fa-file-code-o"></i>`
,
antSword
.
noxss
(
_
),
t
,
`<span style="color:green;">
${
LANG
[
'grid'
][
'edtype'
][
'decoder'
]}
</span>`
]
]
});
});
_id
++
;
_id
++
;
...
@@ -531,5 +633,36 @@ module.exports = (pwd, data, ext) => {
...
@@ -531,5 +633,36 @@ module.exports = (pwd, data, ext) => {
this
.
encoders
=
antSword
[
"encoders"
];
this
.
encoders
=
antSword
[
"encoders"
];
this
.
parseData
();
this
.
parseData
();
}
}
// 同步到全局编码器
syncdecoders
()
{
antSword
[
'decoders'
]
=
(
function
()
{
var
decoders
=
{
asp
:
[],
aspx
:
[],
php
:
[],
custom
:
[]
};
var
decoders_path
=
{
asp
:
[],
aspx
:
[],
php
:
[],
custom
:
[]
};
let
userdecoder_path
=
path
.
join
(
remote
.
process
.
env
.
AS_WORKDIR
,
'antData/encoders'
);
// 初始化
!
fs
.
existsSync
(
userdecoder_path
)
?
fs
.
mkdirSync
(
userdecoder_path
)
:
null
;
[
'asp'
,
'aspx'
,
'php'
,
'custom'
].
map
((
t
)
=>
{
!
fs
.
existsSync
(
path
.
join
(
userdecoder_path
,
`
${
t
}
`
))
?
fs
.
mkdirSync
(
path
.
join
(
userdecoder_path
,
`
${
t
}
`
))
:
null
;
let
t_path
=
path
.
join
(
userdecoder_path
,
`
${
t
}
/decoder/`
);
!
fs
.
existsSync
(
t_path
)
?
fs
.
mkdirSync
(
t_path
)
:
null
;
let
es
=
fs
.
readdirSync
(
t_path
);
if
(
es
)
{
es
.
map
((
_
)
=>
{
if
(
!
_
.
endsWith
(
".js"
))
{
return
}
decoders
[
t
].
push
(
_
.
slice
(
0
,
-
3
));
decoders_path
[
t
].
push
(
path
.
join
(
t_path
,
_
.
slice
(
0
,
-
3
)));
});
}
antSword
[
"core"
][
t
].
prototype
.
user_decoders
=
decoders_path
[
t
];
});
return
decoders
;
})();
this
.
decoders
=
antSword
[
"decoders"
];
this
.
parseData
();
}
}
}
module
.
exports
=
Encoders
;
module
.
exports
=
Encoders
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment