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
a8b07acb
Commit
a8b07acb
authored
Dec 03, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:jumpserver/coco into dev
parents
021f9193
511f6c30
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
64 additions
and
26 deletions
+64
-26
__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
+11
-9
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
+1
-0
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 @
a8b07acb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from
.app
import
Coco
from
.app
import
Coco
coco/app.py
View file @
a8b07acb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
datetime
import
datetime
import
os
import
os
import
time
import
time
...
@@ -312,4 +316,4 @@ class Coco:
...
@@ -312,4 +316,4 @@ class Coco:
"asset"
:
session
.
server
.
asset
.
hostname
,
"asset"
:
session
.
server
.
asset
.
hostname
,
"system_user"
:
session
.
server
.
system_user
.
username
,
"system_user"
:
session
.
server
.
system_user
.
username
,
"timestamp"
:
int
(
time
.
time
())
"timestamp"
:
int
(
time
.
time
())
})
})
\ No newline at end of file
coco/char.py
View file @
a8b07acb
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
BACKSPACE_CHAR
=
{
b
'
\x08
'
:
b
'
\x08\x1b
[K'
,
b
'
\x7f
'
:
b
'
\x08\x1b
[K'
}
BACKSPACE_CHAR
=
{
b
'
\x08
'
:
b
'
\x08\x1b
[K'
,
b
'
\x7f
'
:
b
'
\x08\x1b
[K'
}
ENTER_CHAR
=
[
b
'
\r
'
,
b
'
\n
'
,
b
'
\r\n
'
]
ENTER_CHAR
=
[
b
'
\r
'
,
b
'
\n
'
,
b
'
\r\n
'
]
...
...
coco/compat.py
View file @
a8b07acb
#!/usr/bin/env python
#!/usr/bin/env python
3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
...
@@ -78,4 +78,4 @@ elif is_py3:
...
@@ -78,4 +78,4 @@ elif is_py3:
builtin_str
=
str
builtin_str
=
str
bytes
=
bytes
bytes
=
bytes
str
=
str
str
=
str
\ No newline at end of file
coco/config.py
View file @
a8b07acb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
"""
"""
coco.config
coco.config
~~~~~~~~~~~~
~~~~~~~~~~~~
...
...
coco/exception.py
View file @
a8b07acb
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
class
PermissionFailed
(
Exception
):
class
PermissionFailed
(
Exception
):
...
...
coco/forward.py
View file @
a8b07acb
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
socket
import
socket
import
threading
import
threading
import
logging
import
logging
...
...
coco/httpd.py
View file @
a8b07acb
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
socket
import
socket
import
json
import
json
import
logging
import
logging
...
@@ -14,11 +17,10 @@ from jms.models import User
...
@@ -14,11 +17,10 @@ from jms.models import User
from
.models
import
Request
,
Client
,
WSProxy
from
.models
import
Request
,
Client
,
WSProxy
from
.interactive
import
InteractiveServer
from
.interactive
import
InteractiveServer
logger
=
logging
.
getLogger
(
__file__
)
logger
=
logging
.
getLogger
(
__file__
)
class
BaseWe
h
SocketHandler
:
class
BaseWe
b
SocketHandler
:
def
prepare
(
self
):
def
prepare
(
self
):
self
.
app
=
self
.
settings
[
"app"
]
self
.
app
=
self
.
settings
[
"app"
]
child
,
parent
=
socket
.
socketpair
()
child
,
parent
=
socket
.
socketpair
()
...
@@ -36,7 +38,7 @@ class BaseWehSocketHandler:
...
@@ -36,7 +38,7 @@ class BaseWehSocketHandler:
return
True
return
True
class
InteractiveWe
hSocketHandler
(
BaseWeh
SocketHandler
,
tornado
.
websocket
.
WebSocketHandler
):
class
InteractiveWe
bSocketHandler
(
BaseWeb
SocketHandler
,
tornado
.
websocket
.
WebSocketHandler
):
@tornado.web.authenticated
@tornado.web.authenticated
def
open
(
self
):
def
open
(
self
):
InteractiveServer
(
self
.
app
,
self
.
client
)
.
interact_async
()
InteractiveServer
(
self
.
app
,
self
.
client
)
.
interact_async
()
...
@@ -66,19 +68,19 @@ class InteractiveWehSocketHandler(BaseWehSocketHandler, tornado.websocket.WebSoc
...
@@ -66,19 +68,19 @@ class InteractiveWehSocketHandler(BaseWehSocketHandler, tornado.websocket.WebSoc
pass
pass
class
ProxyWe
hSocketHandler
(
BaseWeh
SocketHandler
):
class
ProxyWe
bSocketHandler
(
BaseWeb
SocketHandler
):
pass
pass
class
MonitorWe
hSocketHandler
(
BaseWeh
SocketHandler
):
class
MonitorWe
bSocketHandler
(
BaseWeb
SocketHandler
):
pass
pass
class
HttpServer
:
class
HttpServer
:
routers
=
[
routers
=
[
(
r'/ws/interactive/'
,
InteractiveWe
h
SocketHandler
),
(
r'/ws/interactive/'
,
InteractiveWe
b
SocketHandler
),
(
r'/ws/proxy/(?P<asset_id>[0-9]+)/(?P<system_user_id>[0-9]+)/'
,
ProxyWe
h
SocketHandler
),
(
r'/ws/proxy/(?P<asset_id>[0-9]+)/(?P<system_user_id>[0-9]+)/'
,
ProxyWe
b
SocketHandler
),
(
r'/ws/session/(?P<session_id>[0-9]+)/monitor/'
,
MonitorWe
h
SocketHandler
),
(
r'/ws/session/(?P<session_id>[0-9]+)/monitor/'
,
MonitorWe
b
SocketHandler
),
]
]
# prepare may be rewrite it
# prepare may be rewrite it
...
...
coco/interactive.py
View file @
a8b07acb
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
logging
import
logging
import
socket
import
socket
import
threading
import
threading
...
...
coco/interface.py
View file @
a8b07acb
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
logging
import
logging
import
paramiko
import
paramiko
...
...
coco/logging.py
View file @
a8b07acb
#!/usr/bin/env python
#!/usr/bin/env python
3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
...
...
coco/models.py
View file @
a8b07acb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import
json
import
json
import
threading
import
threading
import
datetime
import
datetime
...
...
coco/queue.py
View file @
a8b07acb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
...
...
coco/record.py
View file @
a8b07acb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
...
...
coco/session.py
View file @
a8b07acb
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
threading
import
threading
import
uuid
import
uuid
...
...
coco/sshd.py
View file @
a8b07acb
#! coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
os
import
os
import
logging
import
logging
...
...
coco/utils.py
View file @
a8b07acb
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
...
@@ -193,7 +195,8 @@ def is_obj_attr_has(obj, val, attrs=("hostname", "ip", "comment")):
...
@@ -193,7 +195,8 @@ def is_obj_attr_has(obj, val, attrs=("hostname", "ip", "comment")):
if
not
attrs
:
if
not
attrs
:
vals
=
[
val
for
val
in
obj
.
__dict__
.
values
()
if
isinstance
(
val
,
(
str
,
int
))]
vals
=
[
val
for
val
in
obj
.
__dict__
.
values
()
if
isinstance
(
val
,
(
str
,
int
))]
else
:
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
:
for
v
in
vals
:
if
str
(
v
)
.
find
(
val
)
!=
-
1
:
if
str
(
v
)
.
find
(
val
)
!=
-
1
:
...
@@ -363,5 +366,4 @@ def compile_message():
...
@@ -363,5 +366,4 @@ def compile_message():
pass
pass
ugettext
=
_gettext
()
ugettext
=
_gettext
()
conf_example.py
View file @
a8b07acb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
os
import
os
BASE_DIR
=
os
.
path
.
dirname
(
__file__
)
BASE_DIR
=
os
.
path
.
dirname
(
__file__
)
...
...
manage.py
View file @
a8b07acb
#!/usr/bin/python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
import
os
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