Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
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
ops
coco
Commits
e3e031ec
Commit
e3e031ec
authored
Dec 24, 2018
by
BaiJiangJie
Committed by
老广
Dec 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复加载命令过滤规则为None时的Bug,添加处理逻辑 (#148)
parent
34de75cb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
45 deletions
+64
-45
models.py
coco/models.py
+16
-7
coco.mo
locale/en/LC_MESSAGES/coco.mo
+0
-0
coco.po
locale/en/LC_MESSAGES/coco.po
+24
-19
coco.mo
locale/zh_CN/LC_MESSAGES/coco.mo
+0
-0
coco.po
locale/zh_CN/LC_MESSAGES/coco.po
+24
-19
No files found.
coco/models.py
View file @
e3e031ec
...
...
@@ -245,22 +245,31 @@ class BaseServer(object):
return
data
if
not
self
.
_input
:
return
data
if
self
.
_cmd_filter_rules
is
None
:
msg
=
_
(
"Warning: Failed to load filter rule, "
"please press Ctrl + D to exit retry."
)
data
=
self
.
command_forbidden
(
msg
)
return
data
for
rule
in
self
.
_cmd_filter_rules
:
action
,
cmd
=
rule
.
match
(
self
.
_input
)
if
action
==
rule
.
ALLOW
:
break
elif
action
==
rule
.
DENY
:
data
=
char
.
CLEAR_LINE_CHAR
+
b
'
\r
'
msg
=
_
(
"Command `{}` is forbidden ........"
)
.
format
(
cmd
)
msg
=
wr
(
warning
(
msg
.
encode
()),
before
=
1
,
after
=
1
)
self
.
output_data
.
append
(
msg
)
self
.
session
.
send_to_clients
(
msg
)
self
.
session
.
put_command
(
self
.
_input
,
msg
.
decode
())
self
.
session
.
put_replay
(
msg
)
self
.
input_data
.
clean
()
self
.
command_forbidden
(
msg
)
break
return
data
def
command_forbidden
(
self
,
msg
):
data
=
char
.
CLEAR_LINE_CHAR
+
b
'
\r
'
msg
=
wr
(
warning
(
msg
.
encode
()),
before
=
1
,
after
=
1
)
self
.
output_data
.
append
(
msg
)
self
.
session
.
send_to_clients
(
msg
)
self
.
session
.
put_command
(
self
.
_input
,
msg
.
decode
())
self
.
session
.
put_replay
(
msg
)
self
.
input_data
.
clean
()
return
data
def
r_replay_filter
(
self
,
data
):
if
not
self
.
_zmodem_state
:
self
.
session
.
put_replay
(
data
)
...
...
locale/en/LC_MESSAGES/coco.mo
View file @
e3e031ec
No preview for this file type
locale/en/LC_MESSAGES/coco.po
View file @
e3e031ec
...
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-
18 20:03
+0800\n"
"POT-Creation-Date: 2018-12-
21 16:48
+0800\n"
"PO-Revision-Date: 2018-08-10 10:42+0800\n"
"Last-Translator: BaiJiangjie <bugatti_it@163.com>\n"
"Language-Team: Language locale/en/LC\n"
...
...
@@ -84,75 +84,80 @@ msgstr ""
msgid "Terminal does not support login rdp, please use web terminal to access"
msgstr ""
#: coco/interactive.py:21
2
#: coco/interactive.py:21
7
msgid "No Assets"
msgstr ""
#: coco/interactive.py:2
75
#: coco/interactive.py:2
80
msgid "Tips: Enter the asset ID and log directly into the asset."
msgstr ""
#: coco/interactive.py:2
76
#: coco/interactive.py:2
81
msgid "Page up: P/p"
msgstr ""
#: coco/interactive.py:2
77
#: coco/interactive.py:2
82
msgid "Page down: Enter|N/n"
msgstr ""
#: coco/interactive.py:2
78
#: coco/interactive.py:2
83
msgid "BACK: b/q"
msgstr ""
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "ID"
msgstr ""
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "Hostname"
msgstr ""
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "IP"
msgstr ""
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "LoginAs"
msgstr ""
#: coco/interactive.py:31
3
#: coco/interactive.py:31
7
msgid "Comment"
msgstr ""
#: coco/interactive.py:32
2
#: coco/interactive.py:32
6
msgid "Page: {}, Count: {}, Total Page: {}, Total Count: {}"
msgstr ""
#: coco/interactive.py:39
4
#: coco/interactive.py:39
8
msgid "No Nodes"
msgstr ""
#: coco/interactive.py:
398
#: coco/interactive.py:
402
msgid "Node: [ ID.Name(Asset amount) ]"
msgstr ""
#: coco/interactive.py:40
0
#: coco/interactive.py:40
4
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgstr ""
#: coco/interactive.py:4
08
#: coco/interactive.py:4
12
msgid "There is no matched node, please re-enter"
msgstr ""
#: coco/interactive.py:4
38
#: coco/interactive.py:4
42
msgid "Select a login:: "
msgstr ""
#: coco/interactive.py:46
1
#: coco/interactive.py:46
5
msgid "No system user"
msgstr ""
#: coco/models.py:247
#: coco/models.py:242
msgid ""
"Warning: Failed to load filter rule, please press Ctrl + D to exit retry."
msgstr ""
#: coco/models.py:251
msgid "Command `{}` is forbidden ........"
msgstr ""
...
...
locale/zh_CN/LC_MESSAGES/coco.mo
View file @
e3e031ec
No preview for this file type
locale/zh_CN/LC_MESSAGES/coco.po
View file @
e3e031ec
...
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-
18 20:04
+0800\n"
"POT-Creation-Date: 2018-12-
21 16:48
+0800\n"
"PO-Revision-Date: 2018-08-10 10:42+0800\n"
"Last-Translator: BaiJiangjie <bugatti_it@163.com>\n"
"Language-Team: Language locale/zh\n"
...
...
@@ -91,75 +91,80 @@ msgstr "{T}0) 输入 {green}q{end} 退出.{R}"
msgid "Terminal does not support login rdp, please use web terminal to access"
msgstr "终端不支持登录windows, 请使用web terminal访问"
#: coco/interactive.py:21
2
#: coco/interactive.py:21
7
msgid "No Assets"
msgstr "没有资产"
#: coco/interactive.py:2
75
#: coco/interactive.py:2
80
msgid "Tips: Enter the asset ID and log directly into the asset."
msgstr "提示: 输入资产ID,直接登录资产."
#: coco/interactive.py:2
76
#: coco/interactive.py:2
81
msgid "Page up: P/p"
msgstr "上一页: P/p"
#: coco/interactive.py:2
77
#: coco/interactive.py:2
82
msgid "Page down: Enter|N/n"
msgstr "下一页: Enter|N/n"
#: coco/interactive.py:2
78
#: coco/interactive.py:2
83
msgid "BACK: b/q"
msgstr "返回: B/b"
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "ID"
msgstr ""
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "Hostname"
msgstr "主机名"
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "IP"
msgstr ""
#: coco/interactive.py:
299
#: coco/interactive.py:
303
msgid "LoginAs"
msgstr "登录用户"
#: coco/interactive.py:31
3
#: coco/interactive.py:31
7
msgid "Comment"
msgstr "备注"
#: coco/interactive.py:32
2
#: coco/interactive.py:32
6
msgid "Page: {}, Count: {}, Total Page: {}, Total Count: {}"
msgstr "页码: {}, 数量: {}, 总页数: {}, 总数量: {}"
#: coco/interactive.py:39
4
#: coco/interactive.py:39
8
msgid "No Nodes"
msgstr "没有节点"
#: coco/interactive.py:
398
#: coco/interactive.py:
402
msgid "Node: [ ID.Name(Asset amount) ]"
msgstr "节点: [ ID.名称(资产数量) ]"
#: coco/interactive.py:40
0
#: coco/interactive.py:40
4
msgid "Tips: Enter g+NodeID to display the host under the node, such as g1"
msgstr "提示: 输入 g+节点ID 显示节点下主机. 如: g1"
#: coco/interactive.py:4
08
#: coco/interactive.py:4
12
msgid "There is no matched node, please re-enter"
msgstr "没有匹配分组,请重新输入"
#: coco/interactive.py:4
38
#: coco/interactive.py:4
42
msgid "Select a login:: "
msgstr "选择一个登录:"
#: coco/interactive.py:46
1
#: coco/interactive.py:46
5
msgid "No system user"
msgstr "没有系统用户"
#: coco/models.py:247
#: coco/models.py:242
msgid ""
"Warning: Failed to load filter rule, please press Ctrl + D to exit retry."
msgstr "警告: 加载过滤规则失败,请按 Ctrl + D 退出重试."
#: coco/models.py:251
msgid "Command `{}` is forbidden ........"
msgstr "命令 `{}` 是被禁止的 ..."
...
...
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