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
3555ca98
Commit
3555ca98
authored
Apr 25, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/decoder' into v2.1.x
parents
31f0bb60
c9586e85
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
217 additions
and
12 deletions
+217
-12
database.js
modules/database.js
+2
-0
default.js
source/core/asp/decoder/default.js
+17
-0
index.js
source/core/asp/index.js
+8
-0
default.js
source/core/aspx/decoder/default.js
+17
-0
index.js
source/core/aspx/index.js
+7
-0
base.js
source/core/base.js
+10
-4
default.js
source/core/custom/decoder/default.js
+17
-0
index.js
source/core/custom/index.js
+7
-0
base64.js
source/core/php/decoder/base64.js
+33
-0
default.js
source/core/php/decoder/default.js
+33
-0
rot13.js
source/core/php/decoder/rot13.js
+29
-0
index.js
source/core/php/index.js
+15
-3
zh.js
source/language/zh.js
+2
-1
form.js
source/modules/shellmanager/list/form.js
+20
-4
No files found.
modules/database.js
View file @
3555ca98
...
...
@@ -156,6 +156,7 @@ class Database {
addr
:
ret
[
'addr'
],
encode
:
opts
.
base
[
'encode'
],
encoder
:
opts
.
base
[
'encoder'
],
decoder
:
opts
.
base
[
'decoder'
],
httpConf
:
opts
.
http
,
otherConf
:
opts
.
other
,
ctime
:
+
new
Date
,
...
...
@@ -198,6 +199,7 @@ class Database {
type
:
_new
.
base
[
'type'
],
encode
:
_new
.
base
[
'encode'
],
encoder
:
_new
.
base
[
'encoder'
],
decoder
:
_new
.
base
[
'decoder'
],
httpConf
:
_new
.
http
,
otherConf
:
_new
.
other
,
utime
:
+
new
Date
...
...
source/core/asp/decoder/default.js
0 → 100644
View file @
3555ca98
/**
* asp::default解码器
*/
'use strict'
;
module
.
exports
=
{
asoutput
:
()
=>
{
return
``
.
replace
(
/
\n\s
+/g
,
''
);
},
decode_str
:
(
data
)
=>
{
return
data
;
},
decode_buff
:
(
data
)
=>
{
return
data
;
}
}
\ No newline at end of file
source/core/asp/index.js
View file @
3555ca98
...
...
@@ -27,6 +27,10 @@ class ASP extends Base {
this
.
encoders
.
map
((
_
)
=>
{
this
.
parseEncoder
(
`./asp/encoder/
${
_
}
`
);
});
this
.
decoders
.
map
((
_
)
=>
{
this
.
parseDecoder
(
`./asp/decoder/
${
_
}
`
);
});
}
/**
...
...
@@ -37,6 +41,10 @@ class ASP extends Base {
return
[
'insert_percent'
,
'xxxxdog'
];
}
get
decoders
()
{
return
[
'default'
];
}
/**
* HTTP请求数据组合函数
* @param {Object} data 通过模板解析后的代码对象
...
...
source/core/aspx/decoder/default.js
0 → 100644
View file @
3555ca98
/**
* aspx::default解码器
*/
'use strict'
;
module
.
exports
=
{
asoutput
:
()
=>
{
return
``
.
replace
(
/
\n\s
+/g
,
''
);
},
decode_str
:
(
data
)
=>
{
return
data
;
},
decode_buff
:
(
data
)
=>
{
return
data
;
}
}
\ No newline at end of file
source/core/aspx/index.js
View file @
3555ca98
...
...
@@ -30,6 +30,9 @@ class ASPX extends Base {
this
.
encoders
.
map
((
_
)
=>
{
this
.
parseEncoder
(
`./aspx/encoder/
${
_
}
`
);
});
this
.
decoders
.
map
((
_
)
=>
{
this
.
parseDecoder
(
`./aspx/decoder/
${
_
}
`
);
});
}
/**
...
...
@@ -40,6 +43,10 @@ class ASPX extends Base {
return
[
"base64"
,
"hex"
];
}
get
decoders
()
{
return
[
"default"
];
}
/**
* HTTP请求数据组合函数
* @param {Object} data 通过模板解析后的代码对象
...
...
source/core/base.js
View file @
3555ca98
...
...
@@ -53,6 +53,7 @@ class Base {
](
pwd
,
data
);
}
}
this
[
'__decoder__'
]
=
{}
// 解析自定义编码器
this
.
user_encoders
.
map
((
_
)
=>
{
this
.
parseEncoder
(
`
${
_
}
`
);
...
...
@@ -207,6 +208,11 @@ class Base {
this
[
'__encoder__'
][
enc
.
indexOf
(
`encoder/`
)
>
-
1
?
enc
.
split
(
`encoder/`
)[
1
]
:
enc
.
split
(
`encoder\\`
)[
1
]]
=
require
(
`
${
enc
}
`
);
}
parseDecoder
(
dec
)
{
delete
require
.
cache
[
require
.
resolve
(
`
${
dec
}
`
)];
this
[
'__decoder__'
][
dec
.
indexOf
(
`decoder/`
)
>
-
1
?
dec
.
split
(
`decoder/`
)[
1
]
:
dec
.
split
(
`decoder\\`
)[
1
]]
=
require
(
`
${
dec
}
`
);
}
/**
* 编码处理并返回操作
* @param {String} tag_s 前截断符
...
...
@@ -249,13 +255,13 @@ class Base {
.
once
(
`request-
${
hash
}
`
,
(
event
,
ret
)
=>
{
return
res
({
'encoding'
:
ret
[
'encoding'
]
||
""
,
'text'
:
ret
[
'text'
]
,
'buff'
:
ret
[
'buff'
]
'text'
:
this
.
__decoder__
[
this
.
__opts__
[
'decoder'
]
||
'default'
].
decode_str
(
ret
[
'text'
])
,
'buff'
:
this
.
__decoder__
[
this
.
__opts__
[
'decoder'
]
||
'default'
].
decode_buff
(
ret
[
'buff'
])
});
})
// HTTP请求返回字节流
.
on
(
`request-chunk-
${
hash
}
`
,
(
event
,
ret
)
=>
{
return
chunkCallBack
?
chunkCallBack
(
ret
)
:
null
;
return
chunkCallBack
?
chunkCallBack
(
this
.
__decoder__
[
this
.
__opts__
[
'decoder'
]
||
'default'
].
decode_buff
(
ret
)
)
:
null
;
})
// 数据请求错误
.
once
(
`request-error-
${
hash
}
`
,
(
event
,
ret
)
=>
{
...
...
@@ -289,7 +295,7 @@ class Base {
* @return {Promise} Promise操作对象
*/
download
(
savePath
,
postCode
,
progressCallback
)
{
const
opt
=
this
.
complete
(
postCode
);
const
opt
=
this
.
complete
(
postCode
,
true
);
return
new
Promise
((
ret
,
rej
)
=>
{
// 随机ID(用于监听数据来源)
const
hash
=
(
String
(
+
new
Date
)
+
String
(
Math
.
random
())).
substr
(
10
,
10
).
replace
(
'.'
,
'_'
);
...
...
source/core/custom/decoder/default.js
0 → 100644
View file @
3555ca98
/**
* CUSTOM::default解码器
*/
'use strict'
;
module
.
exports
=
{
asoutput
:
()
=>
{
return
``
.
replace
(
/
\n\s
+/g
,
''
);
},
decode_str
:
(
data
)
=>
{
return
data
;
},
decode_buff
:
(
data
)
=>
{
return
data
;
}
}
\ No newline at end of file
source/core/custom/index.js
View file @
3555ca98
...
...
@@ -23,6 +23,9 @@ class CUSTOM extends Base {
this
.
encoders
.
map
((
_
)
=>
{
this
.
parseEncoder
(
`./custom/encoder/
${
_
}
`
);
});
this
.
decoders
.
map
((
_
)
=>
{
this
.
parseDecoder
(
`./custom/decoder/
${
_
}
`
);
});
}
/**
...
...
@@ -33,6 +36,10 @@ class CUSTOM extends Base {
return
[
'base64'
,
'hex'
];
}
get
decoders
()
{
return
[
"default"
,
"base64"
];
}
/**
* HTTP请求数据组合函数
* @param {Object} data 通过模板解析后的代码对象
...
...
source/core/php/decoder/base64.js
0 → 100644
View file @
3555ca98
/**
* php::base64解码器
*/
'use strict'
;
module
.
exports
=
{
/**
* @returns {string} asenc 将返回数据base64编码
*/
asoutput
:
()
=>
{
return
`function asenc($out){
return @base64_encode($out);
}
`
.
replace
(
/
\n\s
+/g
,
''
);
},
/**
* 解码字符串
* @param {string} data 要被解码的字符串
* @returns {string} 解码后的字符串
*/
decode_str
:
(
data
)
=>
{
return
Buffer
.
from
(
data
,
'base64'
).
toString
();
},
/**
* 解码 Buffer
* @param {string} data 要被解码的 Buffer
* @returns {string} 解码后的 Buffer
*/
decode_buff
:
(
data
)
=>
{
return
Buffer
.
from
(
data
.
toString
(),
'base64'
);
}
}
\ No newline at end of file
source/core/php/decoder/default.js
0 → 100644
View file @
3555ca98
/**
* php::default解码器
*/
'use strict'
;
module
.
exports
=
{
/**
* @returns {string} asenc 加密返回数据的函数
*/
asoutput
:
()
=>
{
return
`function asenc($out){
return $out;
}
`
.
replace
(
/
\n\s
+/g
,
''
);
},
/**
* 解码字符串
* @param {string} data 要被解码的字符串
* @returns {string} 解码后的字符串
*/
decode_str
:
(
data
)
=>
{
return
data
;
},
/**
* 解码 Buffer
* @param {string} data 要被解码的 Buffer
* @returns {string} 解码后的 Buffer
*/
decode_buff
:
(
data
)
=>
{
return
data
;
}
}
\ No newline at end of file
source/core/php/decoder/rot13.js
0 → 100644
View file @
3555ca98
/**
* php::base64解码器
* ? 利用php的base64_decode进行解码处理
*/
'use strict'
;
const
rot13encode
=
(
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
);
});
};
module
.
exports
=
{
asoutput
:
(
tag_s
,
tag_e
)
=>
{
return
`function asenc($out){
return str_rot13($out);
}
`
.
replace
(
/
\n\s
+/g
,
''
);
},
decode_str
:
(
data
)
=>
{
return
rot13encode
(
data
);
},
decode_buff
:
(
data
)
=>
{
return
Buffer
.
from
(
rot13encode
(
data
.
toString
()));
}
}
\ No newline at end of file
source/core/php/index.js
View file @
3555ca98
...
...
@@ -31,6 +31,9 @@ class PHP extends Base {
this
.
encoders
.
map
((
_
)
=>
{
this
.
parseEncoder
(
`./php/encoder/
${
_
}
`
);
});
this
.
decoders
.
map
((
_
)
=>
{
this
.
parseDecoder
(
`./php/decoder/
${
_
}
`
);
});
}
/**
...
...
@@ -42,20 +45,29 @@ class PHP extends Base {
return
[
"base64"
,
"chr"
,
"chr16"
,
"rot13"
];
}
get
decoders
()
{
return
[
"default"
,
"base64"
,
"rot13"
];
}
/**
* HTTP请求数据组合函数
* @param {Object} data 通过模板解析后的代码对象
* @param {bool} force_default 强制使用 default 解码
* @return {Promise} 返回一个Promise操作对象
*/
complete
(
data
)
{
complete
(
data
,
force_default
=
false
)
{
// 分隔符号
let
tag_s
=
Math
.
random
().
toString
(
16
).
substr
(
2
,
5
);
// "->|";
let
tag_e
=
Math
.
random
().
toString
(
16
).
substr
(
2
,
5
);
// "|<-";
let
asencCode
;
if
(
!
force_default
){
asencCode
=
this
.
__decoder__
[
this
.
__opts__
[
'decoder'
]
||
'default'
].
asoutput
();
}
else
{
asencCode
=
this
.
__decoder__
[
'default'
].
asoutput
();
}
// 组合完整的代码
let
tmpCode
=
data
[
'_'
];
data
[
'_'
]
=
`@ini_set("display_errors", "0");@set_time_limit(0);
echo "
${
tag_s
}
";try{
${
tmpCode
}
;}catch(Exception $e){echo "ERROR://".$e->getMessage();};echo "
${
tag_e
}
"
;die();`
;
data
[
'_'
]
=
`@ini_set("display_errors", "0");@set_time_limit(0);
${
asencCode
}
;function asoutput(){$output=ob_get_contents();ob_end_clean();echo "
${
tag_s
}
";echo @asenc($output);echo "
${
tag_e
}
";}register_shutdown_function("asoutput");ob_start();try{
${
tmpCode
}
;}catch(Exception $e){echo "ERROR://".$e->getMessage();}
;die();`
;
// 使用编码器进行处理并返回
return
this
.
encodeComplete
(
tag_s
,
tag_e
,
data
);
...
...
source/language/zh.js
View file @
3555ca98
...
...
@@ -121,7 +121,8 @@ module.exports = {
note
:
'网站备注'
,
encode
:
'编码设置'
,
type
:
'连接类型'
,
encoder
:
'编码器'
encoder
:
'编码器'
,
decoder
:
'解码器'
,
},
test_success
:
'连接成功!'
,
test_warning
:
'返回数据为空'
,
...
...
source/modules/shellmanager/list/form.js
View file @
3555ca98
...
...
@@ -50,6 +50,7 @@ class Form {
"type"
:
opts
.
base
[
'type'
],
"encode"
:
opts
.
base
[
'encode'
],
"encoder"
:
opts
.
base
[
'encoder'
],
"decoder"
:
opts
.
base
[
'decoder'
],
"httpConf"
:
opts
.
http
,
"otherConf"
:
opts
.
other
,
}
...
...
@@ -194,7 +195,8 @@ class Form {
note
:
''
,
type
:
'php'
,
encode
:
'utf8'
,
encoder
:
'default'
encoder
:
'default'
,
decoder
:
'default'
},
arg
);
const
form
=
this
.
accordion
.
cells
(
'base'
).
attachForm
([
{
type
:
'settings'
,
position
:
'label-left'
,
labelWidth
:
80
,
inputWidth
:
400
},
...
...
@@ -213,7 +215,7 @@ class Form {
name
:
'encode'
,
readonly
:
true
,
options
:
this
.
_parseEncodes
(
opt
.
encode
)
},
{
type
:
'combo'
,
label
:
LANG
[
'list'
][
'add'
][
'form'
][
'type'
],
name
:
'type'
,
readonly
:
true
,
options
:
this
.
_parseTypes
(
opt
.
type
,
opt
.
encoder
)
name
:
'type'
,
readonly
:
true
,
options
:
this
.
_parseTypes
(
opt
.
type
,
opt
.
encoder
,
opt
.
decoder
)
}
]
}
],
true
);
...
...
@@ -283,17 +285,20 @@ class Form {
* @param {String} _encoder 默认编码器
* @return {array} [description]
*/
_parseTypes
(
_default
=
'php'
,
_encoder
=
'default'
)
{
_parseTypes
(
_default
=
'php'
,
_encoder
=
'default'
,
_decoder
=
'default'
)
{
let
ret
=
[];
for
(
let
c
in
antSword
[
'core'
])
{
// 加载默认编码器和用户自定义编码器
let
encoders
;
let
decoders
;
switch
(
c
){
case
'php4'
:
encoders
=
antSword
[
'core'
][
'php4'
].
prototype
.
encoders
.
concat
(
antSword
[
'encoders'
][
'php'
]);
decoders
=
antSword
[
'core'
][
c
].
prototype
.
decoders
;
break
;
default
:
encoders
=
antSword
[
'core'
][
c
].
prototype
.
encoders
.
concat
(
antSword
[
'encoders'
][
c
]);
decoders
=
antSword
[
'core'
][
c
].
prototype
.
decoders
;
break
;
}
ret
.
push
({
...
...
@@ -317,6 +322,16 @@ class Form {
value
:
e
,
label
:
e
,
checked
:
e
===
_encoder
})
});
_
.
push
({
type
:
'label'
,
label
:
LANG
[
'list'
][
'add'
][
'form'
][
'decoder'
]
});
decoders
.
map
((
e
)
=>
{
_
.
push
({
type
:
'radio'
,
name
:
`decoder_
${
c
}
`
,
value
:
e
,
label
:
e
,
checked
:
e
===
_decoder
})
});
return
_
;
})(
c
)
});
...
...
@@ -340,7 +355,8 @@ class Form {
note
:
base
[
'note'
],
type
:
base
[
'type'
],
encode
:
base
[
'encode'
],
encoder
:
base
[
`encoder_
${
base
[
'type'
]}
`
]
encoder
:
base
[
`encoder_
${
base
[
'type'
]}
`
],
decoder
:
base
[
`decoder_
${
base
[
'type'
]}
`
]
};
// 提取需要的http数据
let
[
headers
,
bodys
]
=
[{},
{}];
...
...
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