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
ba374b33
Commit
ba374b33
authored
Nov 30, 2017
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: use python3 at the head of file
parent
fe7bcb81
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
59 additions
and
21 deletions
+59
-21
__init__.py
coco/__init__.py
+4
-0
app.py
coco/app.py
+5
-2
char.py
coco/char.py
+3
-1
compat.py
coco/compat.py
+2
-3
config.py
coco/config.py
+3
-0
exception.py
coco/exception.py
+3
-1
forward.py
coco/forward.py
+4
-1
httpd.py
coco/httpd.py
+4
-2
interactive.py
coco/interactive.py
+4
-1
interface.py
coco/interface.py
+3
-1
logging.py
coco/logging.py
+1
-1
models.py
coco/models.py
+2
-0
queue.py
coco/queue.py
+1
-0
record.py
coco/record.py
+3
-2
session.py
coco/session.py
+3
-1
sshd.py
coco/sshd.py
+3
-1
utils.py
coco/utils.py
+5
-3
conf_example.py
conf_example.py
+4
-0
manage.py
manage.py
+2
-1
No files found.
coco/__init__.py
View file @
ba374b33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from
.app
import
Coco
coco/app.py
View file @
ba374b33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
datetime
import
os
import
time
...
...
@@ -302,4 +306,4 @@ class Coco:
"asset"
:
session
.
server
.
asset
.
hostname
,
"system_user"
:
session
.
server
.
system_user
.
username
,
"timestamp"
:
int
(
time
.
time
())
})
\ No newline at end of file
})
coco/char.py
View file @
ba374b33
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
BACKSPACE_CHAR
=
{
b
'
\x08
'
:
b
'
\x08\x1b
[K'
,
b
'
\x7f
'
:
b
'
\x08\x1b
[K'
}
ENTER_CHAR
=
[
b
'
\r
'
,
b
'
\n
'
,
b
'
\r\n
'
]
...
...
coco/compat.py
View file @
ba374b33
#!/usr/bin/env python
#!/usr/bin/env python
3
# -*- coding: utf-8 -*-
#
...
...
@@ -78,4 +78,4 @@ elif is_py3:
builtin_str
=
str
bytes
=
bytes
str
=
str
\ No newline at end of file
str
=
str
coco/config.py
View file @
ba374b33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
coco.config
~~~~~~~~~~~~
...
...
coco/exception.py
View file @
ba374b33
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
class
PermissionFailed
(
Exception
):
...
...
coco/forward.py
View file @
ba374b33
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
socket
import
threading
import
logging
...
...
coco/httpd.py
View file @
ba374b33
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
socket
import
json
import
logging
...
...
@@ -14,7 +17,6 @@ from jms.models import User
from
.models
import
Request
,
Client
,
WSProxy
from
.interactive
import
InteractiveServer
logger
=
logging
.
getLogger
(
__file__
)
...
...
coco/interactive.py
View file @
ba374b33
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
logging
import
socket
import
threading
...
...
coco/interface.py
View file @
ba374b33
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
logging
import
paramiko
...
...
coco/logging.py
View file @
ba374b33
#!/usr/bin/env python
#!/usr/bin/env python
3
# -*- coding: utf-8 -*-
#
...
...
coco/models.py
View file @
ba374b33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import
json
import
threading
import
datetime
...
...
coco/queue.py
View file @
ba374b33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
...
...
coco/record.py
View file @
ba374b33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
...
...
@@ -80,7 +81,7 @@ class ServerReplayRecorder(ReplayRecorder):
:return:
"""
# Todo: <liuzheng712@gmail.com>
super
()
.
record_replay
(
data_set
)
#
super().record_replay(data_set)
def
session_start
(
self
,
session_id
):
print
(
"When session {} start exec"
.
format
(
session_id
))
...
...
@@ -94,7 +95,7 @@ class ServerCommandRecorder(CommandRecorder):
def
record_command
(
self
,
data_set
):
if
not
data_set
:
return
True
super
()
.
record_command
(
data_set
)
#
super().record_command(data_set)
return
self
.
app
.
service
.
push_session_command
(
data_set
)
def
session_start
(
self
,
session_id
):
...
...
coco/session.py
View file @
ba374b33
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
threading
import
uuid
...
...
coco/sshd.py
View file @
ba374b33
#! coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
os
import
logging
...
...
coco/utils.py
View file @
ba374b33
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from
__future__
import
unicode_literals
...
...
@@ -193,7 +195,8 @@ def is_obj_attr_has(obj, val, attrs=("hostname", "ip", "comment")):
if
not
attrs
:
vals
=
[
val
for
val
in
obj
.
__dict__
.
values
()
if
isinstance
(
val
,
(
str
,
int
))]
else
:
vals
=
[
getattr
(
obj
,
attr
)
for
attr
in
attrs
if
hasattr
(
obj
,
attr
)
and
isinstance
(
hasattr
(
obj
,
attr
),
(
str
,
int
))]
vals
=
[
getattr
(
obj
,
attr
)
for
attr
in
attrs
if
hasattr
(
obj
,
attr
)
and
isinstance
(
hasattr
(
obj
,
attr
),
(
str
,
int
))]
for
v
in
vals
:
if
str
(
v
)
.
find
(
val
)
!=
-
1
:
...
...
@@ -363,5 +366,4 @@ def compile_message():
pass
ugettext
=
_gettext
()
conf_example.py
View file @
ba374b33
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
os
BASE_DIR
=
os
.
path
.
dirname
(
__file__
)
...
...
manage.py
View file @
ba374b33
#!/usr/bin/python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
os
...
...
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