|
|
|
@ -28,7 +28,7 @@ import paramiko |
|
|
|
|
from flask_socketio import SocketIO, emit, send |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ssh_terminal: |
|
|
|
|
class ssh_terminal(object): |
|
|
|
|
|
|
|
|
|
__debug_file = 'logs/terminal.log' |
|
|
|
|
__log_type = 'SSH终端' |
|
|
|
@ -59,6 +59,14 @@ class ssh_terminal: |
|
|
|
|
ht = threading.Thread(target=self.heartbeat) |
|
|
|
|
ht.start() |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def instance(cls, *args, **kwargs): |
|
|
|
|
if not hasattr(ssh_terminal, "_instance"): |
|
|
|
|
with ssh_terminal._instance_lock: |
|
|
|
|
if not hasattr(ssh_terminal, "_instance"): |
|
|
|
|
ssh_terminal._instance = ssh_terminal(*args, **kwargs) |
|
|
|
|
return ssh_terminal._instance |
|
|
|
|
|
|
|
|
|
def debug(self, msg): |
|
|
|
|
msg = "{} - {}:{} => {} \n".format(mw.formatDate(), |
|
|
|
|
self.__host, self.__port, msg) |
|
|
|
|