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
45c764b3
Commit
45c764b3
authored
May 12, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance:Core) 支持加载用户自定义解码器
parent
22ca72a7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
16 deletions
+75
-16
CHANGELOG.md
CHANGELOG.md
+1
-0
package.json
package.json
+1
-1
app.entry.js
source/app.entry.js
+55
-0
base.js
source/core/base.js
+3
-0
encoders.js
source/modules/settings/encoders.js
+13
-13
form.js
source/modules/shellmanager/list/form.js
+2
-2
No files found.
CHANGELOG.md
View file @
45c764b3
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
> https://github.com/AntSwordProject/AwesomeEncoder/blob/master/php/aes_256_cfb_zero_padding.js
> https://github.com/AntSwordProject/AwesomeEncoder/blob/master/php/aes_256_cfb_zero_padding.js
*
解码器新增 ext 参数, 用于获取 shell 配置和rsa私钥
*
解码器新增 ext 参数, 用于获取 shell 配置和rsa私钥
*
支持加载用户自定义解码器
### 数据管理
### 数据管理
...
...
package.json
View file @
45c764b3
{
{
"name"
:
"antsword"
,
"name"
:
"antsword"
,
"version"
:
"2.1.1.
6
"
,
"version"
:
"2.1.1.
7
"
,
"description"
:
"中国蚁剑是一款跨平台的开源网站管理工具"
,
"description"
:
"中国蚁剑是一款跨平台的开源网站管理工具"
,
"main"
:
"app.js"
,
"main"
:
"app.js"
,
"dependencies"
:
{
"dependencies"
:
{
...
...
source/app.entry.js
View file @
45c764b3
...
@@ -47,6 +47,11 @@ const antSword = window.antSword = {
...
@@ -47,6 +47,11 @@ const antSword = window.antSword = {
* @type {Object}
* @type {Object}
*/
*/
encoders
:
{},
encoders
:
{},
/**
* 自定义解码器
* @type {Object}
*/
decoders
:
{},
/**
/**
* 核心模块
* 核心模块
* @type {Object}
* @type {Object}
...
@@ -176,6 +181,56 @@ antSword['encoders'] = (function(){
...
@@ -176,6 +181,56 @@ antSword['encoders'] = (function(){
return
encoders
;
return
encoders
;
})();
})();
// 加载解码器
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
];
});
// // custom
// let es = fs.readdirSync(userdecoder_path);
// if(es){
// es.map((_)=>{
// console.log(_);
// let farr = _.split("#");
// encoders[farr[0]].push(farr[1].slice(0,-3));
// });
// }
// default
// ['asp','aspx','php','custom'].map((t)=>{
// antSword["core"][t].prototype.encoders.map((e)=>{
// encoders[t].push(e);
// });
// encoders[t] = encoders[t].unique();
// });
// fs.readdirSync(path.join(process.env.AS_WORKDIR,'encoder'),(err,f) => {
// if(err || !f) return ;
// console.debug(f);
// let farr = f.split("#");
// encoders[farr[0]].push(farr[1]);
// });
return
decoders
;
})();
// 加载代理
// 加载代理
const
aproxy
=
{
const
aproxy
=
{
mode
:
antSword
[
'storage'
](
'aproxymode'
,
false
,
'noproxy'
),
mode
:
antSword
[
'storage'
](
'aproxymode'
,
false
,
'noproxy'
),
...
...
source/core/base.js
View file @
45c764b3
...
@@ -58,6 +58,9 @@ class Base {
...
@@ -58,6 +58,9 @@ class Base {
this
.
user_encoders
.
map
((
_
)
=>
{
this
.
user_encoders
.
map
((
_
)
=>
{
this
.
parseEncoder
(
`
${
_
}
`
);
this
.
parseEncoder
(
`
${
_
}
`
);
});
});
this
.
user_decoders
.
map
((
_
)
=>
{
this
.
parseDecoder
(
`
${
_
}
`
);
});
}
}
/**
/**
...
...
source/modules/settings/encoders.js
View file @
45c764b3
...
@@ -413,19 +413,19 @@ eval($cmd);`);
...
@@ -413,19 +413,19 @@ eval($cmd);`);
* Create at:
${
new
Date
().
format
(
"yyyy/MM/dd hh:mm:ss"
)}
* Create at:
${
new
Date
().
format
(
"yyyy/MM/dd hh:mm:ss"
)}
*/
*/
\'use strict\';
\'use strict\';
/*
/*
* @param {String} pwd 连接密码
* @param {String} pwd 连接密码
* @param {Array} data 编码器处理前的 payload 数组
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
*/
module.exports = (pwd, data) => {
module.exports = (pwd, data) => {
// ########## 请在下方编写你自己的代码 ###################
// ########## 请在下方编写你自己的代码 ###################
// 以下代码为 PHP Base64 样例
// 以下代码为 PHP Base64 样例
// 生成一个随机变量名
// 生成一个随机变量名
let randomID = \`_0x\${Math.random().toString(16).substr(2)}\`;
let randomID = \`_0x\${Math.random().toString(16).substr(2)}\`;
// 原有的 payload 在 data['_']中
// 原有的 payload 在 data['_']中
// 取出来之后,转为 base64 编码并放入 randomID key 下
// 取出来之后,转为 base64 编码并放入 randomID key 下
data[randomID] = Buffer.from(data['_']).toString('base64');
data[randomID] = Buffer.from(data['_']).toString('base64');
...
...
source/modules/shellmanager/list/form.js
View file @
45c764b3
...
@@ -294,11 +294,11 @@ class Form {
...
@@ -294,11 +294,11 @@ class Form {
switch
(
c
){
switch
(
c
){
case
'php4'
:
case
'php4'
:
encoders
=
antSword
[
'core'
][
'php4'
].
prototype
.
encoders
.
concat
(
antSword
[
'encoders'
][
'php'
]);
encoders
=
antSword
[
'core'
][
'php4'
].
prototype
.
encoders
.
concat
(
antSword
[
'encoders'
][
'php'
]);
decoders
=
antSword
[
'core'
][
c
].
prototype
.
decoders
;
decoders
=
antSword
[
'core'
][
'php4'
].
prototype
.
decoders
.
concat
(
antSword
[
'decoders'
][
'php'
])
;
break
;
break
;
default
:
default
:
encoders
=
antSword
[
'core'
][
c
].
prototype
.
encoders
.
concat
(
antSword
[
'encoders'
][
c
]);
encoders
=
antSword
[
'core'
][
c
].
prototype
.
encoders
.
concat
(
antSword
[
'encoders'
][
c
]);
decoders
=
antSword
[
'core'
][
c
].
prototype
.
decoders
;
decoders
=
antSword
[
'core'
][
c
].
prototype
.
decoders
.
concat
(
antSword
[
'decoders'
][
c
])
;
break
;
break
;
}
}
ret
.
push
({
ret
.
push
({
...
...
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