Commit a8b07acb authored by ibuler's avatar ibuler

Merge branch 'dev' of github.com:jumpserver/coco into dev

parents 021f9193 511f6c30
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from .app import Coco
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import datetime
import os
import time
......@@ -312,4 +316,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
})
#!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']
......
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
coco.config
~~~~~~~~~~~~
......
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
class PermissionFailed(Exception):
......
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import socket
import threading
import logging
......
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import socket
import json
import logging
......@@ -14,11 +17,10 @@ from jms.models import User
from .models import Request, Client, WSProxy
from .interactive import InteractiveServer
logger = logging.getLogger(__file__)
class BaseWehSocketHandler:
class BaseWebSocketHandler:
def prepare(self):
self.app = self.settings["app"]
child, parent = socket.socketpair()
......@@ -36,7 +38,7 @@ class BaseWehSocketHandler:
return True
class InteractiveWehSocketHandler(BaseWehSocketHandler, tornado.websocket.WebSocketHandler):
class InteractiveWebSocketHandler(BaseWebSocketHandler, tornado.websocket.WebSocketHandler):
@tornado.web.authenticated
def open(self):
InteractiveServer(self.app, self.client).interact_async()
......@@ -66,19 +68,19 @@ class InteractiveWehSocketHandler(BaseWehSocketHandler, tornado.websocket.WebSoc
pass
class ProxyWehSocketHandler(BaseWehSocketHandler):
class ProxyWebSocketHandler(BaseWebSocketHandler):
pass
class MonitorWehSocketHandler(BaseWehSocketHandler):
class MonitorWebSocketHandler(BaseWebSocketHandler):
pass
class HttpServer:
routers = [
(r'/ws/interactive/', InteractiveWehSocketHandler),
(r'/ws/proxy/(?P<asset_id>[0-9]+)/(?P<system_user_id>[0-9]+)/', ProxyWehSocketHandler),
(r'/ws/session/(?P<session_id>[0-9]+)/monitor/', MonitorWehSocketHandler),
(r'/ws/interactive/', InteractiveWebSocketHandler),
(r'/ws/proxy/(?P<asset_id>[0-9]+)/(?P<system_user_id>[0-9]+)/', ProxyWebSocketHandler),
(r'/ws/session/(?P<session_id>[0-9]+)/monitor/', MonitorWebSocketHandler),
]
# prepare may be rewrite it
......
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import logging
import socket
import threading
......
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import logging
import paramiko
......
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import threading
import datetime
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
......
#!coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import threading
import uuid
......
#! coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os
import logging
......
#!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()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os
BASE_DIR = os.path.dirname(__file__)
......
#!/usr/bin/python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os
......
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