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
8b43f861
Commit
8b43f861
authored
Jun 28, 2021
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Fix: Core/CMDLINUX) 修正 centos 下 echo 默认不解析\t等符号的 bug
parent
8784c6f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
base.js
source/core/cmdlinux/template/base.js
+2
-2
command.js
source/core/cmdlinux/template/command.js
+4
-4
filemanager.js
source/core/cmdlinux/template/filemanager.js
+15
-15
No files found.
source/core/cmdlinux/template/base.js
View file @
8b43f861
...
@@ -8,13 +8,13 @@ module.exports = () => ({
...
@@ -8,13 +8,13 @@ module.exports = () => ({
_
:
`ACWD=$(pwd);
_
:
`ACWD=$(pwd);
AUNAME=$(uname -a);
AUNAME=$(uname -a);
AUSER=$(whoami);
AUSER=$(whoami);
echo -n "$ACWD\\t/\\t$AUNAME\\t$AUSER";`
.
replace
(
/
\n\s
+/g
,
''
)
echo -n
e
"$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; do
for v in $DBLIST; do
if command_exists $v; then echo
"$v\\t1"; else echo
"$v\\t0"; fi;
if command_exists $v; then echo
-e "$v\\t1"; else echo -e
"$v\\t0"; fi;
done;`
.
replace
(
/
\n\s
+/g
,
''
)
done;`
.
replace
(
/
\n\s
+/g
,
''
)
}
}
})
})
\ No newline at end of file
source/core/cmdlinux/template/command.js
View file @
8b43f861
...
@@ -7,11 +7,11 @@ module.exports = (arg1, arg2, arg3) => ({
...
@@ -7,11 +7,11 @@ module.exports = (arg1, arg2, arg3) => ({
_
:
`command_exists() { command -v "$@" > /dev/null 2>&1; };
_
:
`command_exists() { command -v "$@" > /dev/null 2>&1; };
AENVSTR="#{buffer::env}";
AENVSTR="#{buffer::env}";
if command_exists xxd; then
if command_exists xxd; then
ENVSTR=$(echo -n $AENVSTR|xxd -r -p);
ENVSTR=$(echo -n
e
$AENVSTR|xxd -r -p);
elif command_exists python3; then
elif command_exists python3; then
ENVSTR=$(echo -n $AENVSTR|python3 -c "import sys, binascii; sys.stdout.buffer.write(binascii.unhexlify(input().strip()))");
ENVSTR=$(echo -n
e
$AENVSTR|python3 -c "import sys, binascii; sys.stdout.buffer.write(binascii.unhexlify(input().strip()))");
else
else
ENVSTR=$(echo -n $AENVSTR|sed 's/\\([0-9A-F]\\{2\\}\\)/\\\\\\\\\\\\x\\1/gI'|xargs printf);
ENVSTR=$(echo -n
e
$AENVSTR|sed 's/\\([0-9A-F]\\{2\\}\\)/\\\\\\\\\\\\x\\1/gI'|xargs printf);
fi;
fi;
while [ $ENVSTR ]; do
while [ $ENVSTR ]; do
ASLINE=\${ENVSTR%%"|||asline|||"*};
ASLINE=\${ENVSTR%%"|||asline|||"*};
...
@@ -25,7 +25,7 @@ module.exports = (arg1, arg2, arg3) => ({
...
@@ -25,7 +25,7 @@ module.exports = (arg1, arg2, arg3) => ({
OLD_IFS=$IFS;
OLD_IFS=$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;
if [ -f $v ]; then echo
-e "$v\\t1"; else echo -e
"$v\\t0"; fi;
done;`
.
replace
(
/
\n\s
+/g
,
''
)
done;`
.
replace
(
/
\n\s
+/g
,
''
)
}
}
})
})
\ No newline at end of file
source/core/cmdlinux/template/filemanager.js
View file @
8b43f861
...
@@ -4,11 +4,11 @@
...
@@ -4,11 +4,11 @@
module
.
exports
=
(
arg1
,
arg2
,
arg3
)
=>
({
module
.
exports
=
(
arg1
,
arg2
,
arg3
)
=>
({
dir
:
{
dir
:
{
_
:
`cd #{path} && find . -maxdepth 1 \\( -type d -printf "%f/\\t%AY-%Am-%Ad %AH:%AM:%AS\\t%s\t%.4m\\n" \\) , \\( -not -type d -printf "%f\\t%AY-%Am-%Ad %AH:%AM:%AS\\t%s\\t%.4m\\n" \\)||echo -n "ERROR:// Path not found OR no Permission";`
_
:
`cd #{path} && find . -maxdepth 1 \\( -type d -printf "%f/\\t%AY-%Am-%Ad %AH:%AM:%AS\\t%s\t%.4m\\n" \\) , \\( -not -type d -printf "%f\\t%AY-%Am-%Ad %AH:%AM:%AS\\t%s\\t%.4m\\n" \\)||echo -n
e
"ERROR:// Path not found OR no Permission";`
},
},
delete
:
{
delete
:
{
_
:
`rm -rf #{path} && echo -n
1||echo -n
0;`
,
_
:
`rm -rf #{path} && echo -n
e 1||echo -ne
0;`
,
},
},
create_file
:
{
create_file
:
{
...
@@ -16,20 +16,20 @@ module.exports = (arg1, arg2, arg3) => ({
...
@@ -16,20 +16,20 @@ module.exports = (arg1, arg2, arg3) => ({
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
e $ACONTENT|xxd -r -p > $ADSTPATH && echo -ne 1||echo -ne
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
e $ACONTENT|python3 -c "import sys, binascii; sys.stdout.buffer.write(binascii.unhexlify(input().strip()))">$ADSTPATH && echo -ne 1||echo -ne
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
e $ACONTENT|sed 's/\\([0-9A-F]\\{2\}\\)/\\\\\\\\\\\\x\\1/gI'|xargs printf>$ADSTPATH && echo -ne 1||echo -ne
0;
fi;`
.
replace
(
/
\n\s
+/g
,
''
)
fi;`
.
replace
(
/
\n\s
+/g
,
''
)
},
},
read_file
:
{
read_file
:
{
_
:
`cat #{path}||echo -n "ERROR:// File not found or no Permission";`
_
:
`cat #{path}||echo -n
e
"ERROR:// File not found or no Permission";`
},
},
copy
:
{
copy
:
{
_
:
`cp -af #{path} #{target} && echo -n
1||echo -n
0;`
_
:
`cp -af #{path} #{target} && echo -n
e 1||echo -ne
0;`
},
},
download_file
:
{
download_file
:
{
...
@@ -41,28 +41,28 @@ module.exports = (arg1, arg2, arg3) => ({
...
@@ -41,28 +41,28 @@ module.exports = (arg1, arg2, arg3) => ({
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
e $ACONTENT|xxd -r -p >> $ADSTPATH && echo -ne 1||echo -ne
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
e $ACONTENT|python3 -c "import sys, binascii; sys.stdout.buffer.write(binascii.unhexlify(input().strip()))">>$ADSTPATH && echo -ne 1||echo -ne
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
e $ACONTENT|sed 's/\\([0-9A-F]\\{2\}\\)/\\\\\\\\\\\\x\\1/gI'|xargs printf>>$ADSTPATH && echo -ne 1||echo -ne
0;
fi;`
.
replace
(
/
\n\s
+/g
,
''
)
fi;`
.
replace
(
/
\n\s
+/g
,
''
)
},
},
rename
:
{
rename
:
{
_
:
`mv #{path} #{name} && echo -n
1||echo -n
0;`
_
:
`mv #{path} #{name} && echo -n
e 1||echo -ne
0;`
},
},
retime
:
{
retime
:
{
_
:
`touch -d "#{time}" #{path} && echo -n
1||echo -n
0;`
_
:
`touch -d "#{time}" #{path} && echo -n
e 1||echo -ne
0;`
},
},
chmod
:
{
chmod
:
{
_
:
`chmod #{mode} #{path} && echo -n
1||echo -n
0;`
_
:
`chmod #{mode} #{path} && echo -n
e 1||echo -ne
0;`
},
},
mkdir
:
{
mkdir
:
{
_
:
`mkdir -p #{path} && echo -n
1||echo -n
0;`
,
_
:
`mkdir -p #{path} && echo -n
e 1||echo -ne
0;`
,
},
},
wget
:
{
wget
:
{
...
@@ -75,7 +75,7 @@ module.exports = (arg1, arg2, arg3) => ({
...
@@ -75,7 +75,7 @@ module.exports = (arg1, arg2, arg3) => ({
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
e 1||echo -ne
0;
`
.
replace
(
/
\n\s
+/g
,
''
)
`
.
replace
(
/
\n\s
+/g
,
''
)
}
}
})
})
\ No newline at end of file
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