Commit 78b1b2dd authored by ibuler's avatar ibuler

[Update] 添加不常动的内容

parent bc2164c0
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
"styles": [ "styles": [
"../node_modules/animate.css/animate.min.css", "../node_modules/animate.css/animate.min.css",
"../node_modules/xterm/dist/xterm.css", "../node_modules/xterm/dist/xterm.css",
"../node_modules/elfinder/css/elfinder.min.css",
"sass/style.scss", "sass/style.scss",
"styles.css", "styles.css",
"assets/ztree/awesomeStyle/awesome.css" "assets/ztree/awesomeStyle/awesome.css"
...@@ -35,7 +34,6 @@ ...@@ -35,7 +34,6 @@
"../node_modules/bootstrap/dist/js/bootstrap.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js",
"assets/inspinia/inspinia.js", "assets/inspinia/inspinia.js",
"assets/slimscroll/jquery.slimscroll.min.js", "assets/slimscroll/jquery.slimscroll.min.js",
"../node_modules/elfinder/js/elfinder.min.js",
"../node_modules/xterm/dist/xterm.js", "../node_modules/xterm/dist/xterm.js",
"assets/ztree/jquery.ztree.all.min.js", "assets/ztree/jquery.ztree.all.min.js",
"assets/ztree/jquery.ztree.exhide.min.js" "assets/ztree/jquery.ztree.exhide.min.js"
......
#!/usr/bin/env python3 #!/usr/bin/env python3
from flask import Flask, send_from_directory, render_template, request, jsonify, redirect, send_file from flask import Flask, send_from_directory, render_template, request, jsonify, redirect, send_file, abort
from flask_socketio import SocketIO, Namespace, emit, join_room, leave_room from flask_socketio import SocketIO, Namespace, emit, join_room, leave_room
import paramiko import paramiko
import uuid import uuid
import eventlet
from threading import Lock from threading import Lock
from flask import Flask, request, current_app, redirect from flask import Flask, request, current_app, redirect
import eventlet
import time
eventlet.monkey_patch()
# async_mode = 'threading'
async_mode = 'eventlet'
app = Flask(__name__, template_folder='dist') app = Flask(__name__, template_folder='dist')
...@@ -53,13 +58,12 @@ class SSHws(Namespace): ...@@ -53,13 +58,12 @@ class SSHws(Namespace):
return chan return chan
def proxy(self, ws, chan, room_id): def proxy(self, ws, chan, room_id):
# eventlet.monkey_patch(thread=True, select=True, socket=True)
while True: while True:
data = chan.recv(1024) data = chan.recv(1024)
socketio.sleep(1)
if len(data) == 0: if len(data) == 0:
ws.emit(event='logout', data={'room': room_id}, room=room_id)
break break
ws.emit(event="data", data={"data": data.decode(), "room": room_id}, room=room_id, namespace='/ssh') ws.emit(event="data", data={"data": data.decode(), "room": room_id}, room=room_id)
def new_connection(self): def new_connection(self):
self.connections[request.sid] = dict() self.connections[request.sid] = dict()
...@@ -82,6 +86,9 @@ class SSHws(Namespace): ...@@ -82,6 +86,9 @@ class SSHws(Namespace):
def get_win_size(): def get_win_size():
cols_request = request.cookies.get('cols') cols_request = request.cookies.get('cols')
rows_request = request.cookies.get('rows') rows_request = request.cookies.get('rows')
print("GET WIN SIZE")
print(cols_request)
print(rows_request)
if cols_request and cols_request.isdigit(): if cols_request and cols_request.isdigit():
cols = int(cols_request) cols = int(cols_request)
else: else:
...@@ -96,13 +103,6 @@ class SSHws(Namespace): ...@@ -96,13 +103,6 @@ class SSHws(Namespace):
def on_connect(self): def on_connect(self):
print("On connect event trigger") print("On connect event trigger")
self.new_connection() self.new_connection()
# self.connections[request.sid] = connection
# self.rooms[connection['room']] = {
# "admin": request.sid,
# "member": [],
# "rw": []
# }
# join_room(connection['room'])
def on_host(self, message): def on_host(self, message):
# 此处获取主机的信息 # 此处获取主机的信息
...@@ -116,11 +116,8 @@ class SSHws(Namespace): ...@@ -116,11 +116,8 @@ class SSHws(Namespace):
print("Join room: {}".format(room["id"])) print("Join room: {}".format(room["id"]))
join_room(room["id"]) join_room(room["id"])
if not asset_id or not user_id: if not asset_id or not user_id:
# self.on_connect()
return return
global thread self.socketio.start_background_task(
if thread is None:
thread = self.socketio.start_background_task(
self.proxy, self, room["request"], room["id"] self.proxy, self, room["request"], room["id"]
) )
...@@ -172,57 +169,31 @@ class SSHws(Namespace): ...@@ -172,57 +169,31 @@ class SSHws(Namespace):
def on_resize(self, message): def on_resize(self, message):
cols, rows = message.get('cols', None), message.get('rows', None) cols, rows = message.get('cols', None), message.get('rows', None)
print("On resize event trigger: {}*{}".format(cols, rows)) print("On resize event trigger: {}*{}".format(cols, rows))
rooms = self.connections.get(request.sid)
time.sleep(0.2)
rooms = self.connections.get(request.sid)
if not rooms: if not rooms:
return return
room_tmp = list(rooms.values())[0] room_tmp = list(rooms.values())[0]
print(room_tmp["cols"], room_tmp["rows"])
if (room_tmp["cols"], room_tmp["rows"]) != (cols, rows): if (room_tmp["cols"], room_tmp["rows"]) != (cols, rows):
for room in rooms.values(): for room in rooms.values():
room["request"].resize_pty(width=cols, height=rows) room["request"].resize_pty(width=cols, height=rows)
# room["request"].change_size_event.set() # room["request"].change_size_event.set()
# room.update({"cols": cols, "rows": rows}) # room.update({"cols": cols, "rows": rows})
# def on_room(self, session_id):
# print("On room event trigger")
# if session_id not in self.connections.keys():
# self.emit(
# 'error', "no such session",
# room=self.connections[request.sid]["room"]
# )
# else:
# self.emit(
# 'room', self.connections[session_id]["room"],
# room=self.connections[request.sid]["room"]
# )
#
# def on_join(self, room):
# print("On join room event trigger")
# self.on_leave(self.connections[request.id]["room"])
# self.connections[request.sid]["room"] = room
# self.rooms[room]["member"].append(request.sid)
# join_room(room=room)
#
# def on_leave(self, room):
# print("On leave room event trigger")
# if self.rooms[room]["admin"] == request.sid:
# self.emit("data", "\nAdmin leave", room=room)
# del self.rooms[room]
# leave_room(room=room)
def on_disconnect(self): def on_disconnect(self):
print("On disconnect event trigger") print("On disconnect event trigger")
# self.on_leave(self.clients[request.sid]["room"]) # self.on_leave(self.clients[request.sid]["room"])
for room in self.connections.get(request.sid, {}): rooms = {k: v for k, v in self.connections.get(request.sid, {}).items()}
self.on_logout(room["id"]) for room_id in rooms:
self.on_logout(room_id)
del self.connections[request.sid] del self.connections[request.sid]
def on_logout(self, room_id): def on_logout(self, room_id):
print("On logout event trigger") print("On logout event trigger")
room = self.connections.get(request.sid, {}).get(room_id) room = self.connections.get(request.sid, {}).get(room_id)
if room: if room:
room["proxy"].close()
del self.connections[request.sid][room_id] del self.connections[request.sid][room_id]
del room del room
...@@ -236,620 +207,425 @@ def send_js(path): ...@@ -236,620 +207,425 @@ def send_js(path):
def asset_groups_assets(): def asset_groups_assets():
assets = [ assets = [
{ {
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6", 'assets_amount': 0,
"key": "0:11:77", 'assets_granted': [],
"name": "新节点 12", 'id': '3ea680e3-7a7b-49c3-908b-ffec3b349f28',
"value": "新节点 12", 'key': '0:15:1',
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d", 'name': '新节点 25',
"assets_granted": [ 'parent': '181a066e-7f02-4b12-bc4a-80eb990d7830',
{ 'value': '新节点 25'
"id": "1600ed6d-e3b6-434c-a960-c5bb818806b6", },
"hostname": "windows1", {
"ip": "10.1.10.178", 'assets_amount': 1,
"port": 3389, 'assets_granted': [
"system_users_granted": [ {
{ 'comment': '',
"id": "8763b81a-bb5e-484a-abca-10514c7bb185", 'domain': None,
"name": "组织1-部门1-Administrator", 'hostname': 'widnows',
"username": "Administrator", 'id': '9fcd7a09-a171-4cb7-b2f9-a025754f8635',
"priority": 10, 'ip': '192.168.1.179',
"protocol": "rdp", 'is_active': True,
"comment": "" 'nodes': [{
} 'assets_amount': 1,
], 'id': '181a066e-7f02-4b12-bc4a-80eb990d7830',
"is_active": True, 'is_node': True,
"system_users_join": "Administrator", 'key': '0:15',
"os": "", 'parent': 'cf461e12-787e-451c-857a-db5503ee1bd2',
"domain": "", 'value': 'windows'}],
"nodes": [ 'os': None,
{ 'platform': 'Windows',
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6", 'port': 3389,
"key": "0:11:77", 'system_users_granted': [{
"value": "新节点 12", 'comment': '',
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d", 'id': 'd95e223e-0539-48a1-864d-6709a0cc6ec0',
"assets_amount": 6, 'name': 'windows',
"is_asset": False 'priority': 10,
}, 'protocol': 'rdp',
{ 'username': 'guanghongwei'}],
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d", 'system_users_join': 'guanghongwei'
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Windows",
"comment": ""
},
{
"id": "b952a481-a624-467e-b97f-9435155f0d53",
"hostname": "testserver",
"ip": "10.1.10.192",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
}
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "CentOS",
"domain": "",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
},
{
"id": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"key": "0",
"value": "Fit2cloud",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Linux",
"comment": ""
},
{
"id": "9fcd7a09-a171-4cb7-b2f9-a025754f8635",
"hostname": "ali-windows",
"ip": "47.104.206.228",
"port": 3389,
"system_users_granted": [
{
"id": "8763b81a-bb5e-484a-abca-10514c7bb185",
"name": "组织1-部门1-Administrator",
"username": "Administrator",
"priority": 10,
"protocol": "rdp",
"comment": ""
}
],
"is_active": True,
"system_users_join": "Administrator",
"os": "",
"domain": "",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"key": "0",
"value": "Fit2cloud",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Windows",
"comment": ""
},
{
"id": "b6f16269-d02a-4055-9cd8-460fa10b1540",
"hostname": "test-vm3",
"ip": "172.19.185.8",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
}
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "",
"domain": "8789580f-b5ca-4478-b6d3-d0dafc4c48e8",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Linux",
"comment": ""
},
{
"id": "27e50edc-52d9-41ef-8c9e-1bff9d1628b2",
"hostname": "test-vm2",
"ip": "172.19.185.7",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
},
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "",
"domain": "8789580f-b5ca-4478-b6d3-d0dafc4c48e8",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Linux",
"comment": ""
},
{
"id": "9ef36bb3-1bed-455f-be09-3770d3f4bf97",
"hostname": "test-vm1",
"ip": "172.19.185.6",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
},
{
"id": "17f384f4-683d-4944-a38d-db73608b92a9",
"name": "zbh-test",
"username": "zbh",
"priority": 10,
"protocol": "ssh",
"comment": ""
}
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "",
"domain": "8789580f-b5ca-4478-b6d3-d0dafc4c48e8",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Linux",
"comment": ""
}
],
"assets_amount": 6
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"name": "网域测试",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_granted": [
{
"id": "1600ed6d-e3b6-434c-a960-c5bb818806b6",
"hostname": "windows1",
"ip": "10.1.10.178",
"port": 3389,
"system_users_granted": [
{
"id": "8763b81a-bb5e-484a-abca-10514c7bb185",
"name": "组织1-部门1-Administrator",
"username": "Administrator",
"priority": 10,
"protocol": "rdp",
"comment": ""
}
],
"is_active": True,
"system_users_join": "Administrator",
"os": "",
"domain": "",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Windows",
"comment": ""
},
{
"id": "b952a481-a624-467e-b97f-9435155f0d53",
"hostname": "testserver",
"ip": "10.1.10.192",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
}
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "CentOS",
"domain": "",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
},
{
"id": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"key": "0",
"value": "Fit2cloud",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Linux",
"comment": ""
},
{
"id": "b6f16269-d02a-4055-9cd8-460fa10b1540",
"hostname": "test-vm3",
"ip": "172.19.185.8",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
},
{
"id": "17f384f4-683d-4944-a38d-db73608b92a9",
"name": "zbh-test",
"username": "zbh",
"priority": 10,
"protocol": "ssh",
"comment": ""
}
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "",
"domain": "8789580f-b5ca-4478-b6d3-d0dafc4c48e8",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Linux",
"comment": ""
},
{
"id": "27e50edc-52d9-41ef-8c9e-1bff9d1628b2",
"hostname": "test-vm2",
"ip": "172.19.185.7",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
},
{
"id": "17f384f4-683d-4944-a38d-db73608b92a9",
"name": "zbh-test",
"username": "zbh",
"priority": 10,
"protocol": "ssh",
"comment": ""
}
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "",
"domain": "8789580f-b5ca-4478-b6d3-d0dafc4c48e8",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
}
],
"platform": "Linux",
"comment": ""
},
{
"id": "9ef36bb3-1bed-455f-be09-3770d3f4bf97",
"hostname": "test-vm1",
"ip": "172.19.185.6",
"port": 22,
"system_users_granted": [
{
"id": "7e326f71-aee5-4688-8cc1-717919470a09",
"name": "root",
"username": "root",
"priority": 10,
"protocol": "ssh",
"comment": ""
},
{
"id": "17f384f4-683d-4944-a38d-db73608b92a9",
"name": "zbh-test",
"username": "zbh",
"priority": 10,
"protocol": "ssh",
"comment": ""
}
],
"is_active": True,
"system_users_join": "root, zbh",
"os": "",
"domain": "8789580f-b5ca-4478-b6d3-d0dafc4c48e8",
"nodes": [
{
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6",
"key": "0:11:77",
"value": "新节点 12",
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"assets_amount": 6,
"is_asset": False
},
{
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d",
"key": "0:11",
"value": "网域测试",
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c",
"assets_amount": 6,
"is_asset": False
} }
], ],
"platform": "Linux", 'id': '181a066e-7f02-4b12-bc4a-80eb990d7830',
"comment": "" 'key': '0:15',
} 'name': 'windows',
], 'parent': 'cf461e12-787e-451c-857a-db5503ee1bd2',
"assets_amount": 5 'value': 'windows'},
}, {'assets_amount': 0,
{ 'assets_granted': [],
"id": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c", 'id': '35e82765-8595-479a-a304-1c44433be955',
"key": "0", 'key': '0:11:0:1:0',
"name": "Fit2cloud", 'name': '新节点 22',
"value": "Fit2cloud", 'parent': 'c7705b0d-56b1-479e-a2a6-6a2f381f0232',
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c", 'value': '新节点 22'},
"assets_granted": [ {'assets_amount': 0,
{ 'assets_granted': [],
"id": "b952a481-a624-467e-b97f-9435155f0d53", 'id': '4d976d17-a2ad-4532-b729-0ce18bb1011e',
"hostname": "testserver", 'key': '0:11:0:0',
"ip": "10.1.10.192", 'name': '新节点 13',
"port": 22, 'parent': '26410e6f-b833-433b-a804-b8b235bffc49',
"system_users_granted": [ 'value': '新节点 13'},
{ {'assets_amount': 0,
"id": "7e326f71-aee5-4688-8cc1-717919470a09", 'assets_granted': [],
"name": "root", 'id': 'c7705b0d-56b1-479e-a2a6-6a2f381f0232',
"username": "root", 'key': '0:11:0:1',
"priority": 10, 'name': '新节点 21',
"protocol": "ssh", 'parent': '26410e6f-b833-433b-a804-b8b235bffc49',
"comment": "" 'value': '新节点 21'},
}, {'assets_amount': 15,
{ 'assets_granted': [{'comment': '',
"id": "17f384f4-683d-4944-a38d-db73608b92a9", 'domain': None,
"name": "zbh-test", 'hostname': 'guagua5服务器',
"username": "zbh", 'id': '06547347-ad7a-4577-943e-6d9b29655b17',
"priority": 10, 'ip': '192.168.244.182',
"protocol": "ssh", 'is_active': True,
"comment": "" 'nodes': [{'assets_amount': 15,
} 'id': '26410e6f-b833-433b-a804-b8b235bffc49',
], 'is_node': True,
"is_active": True, 'key': '0:11:0',
"system_users_join": "root, zbh", 'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
"os": "CentOS", 'value': '新节点 12'}],
"domain": "", 'os': None,
"nodes": [ 'platform': 'Linux',
{ 'port': 22,
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6", 'system_users_granted': [{'comment': '',
"key": "0:11:77", 'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
"value": "新节点 12", 'name': 'web',
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d", 'priority': 10,
"assets_amount": 6, 'protocol': 'ssh',
"is_asset": False 'username': 'web'}],
}, 'system_users_join': 'web'},
{ {'comment': '',
"id": "9c83d432-a353-4a4e-9fd9-be27a5851c2d", 'domain': None,
"key": "0:11", 'hostname': 'guagua3',
"value": "网域测试", 'id': '50b0d171-41a2-4767-96c8-f2532036dcd9',
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c", 'ip': '192.168.244.180',
"assets_amount": 6, 'is_active': True,
"is_asset": False 'nodes': [{'assets_amount': 15,
}, 'id': '26410e6f-b833-433b-a804-b8b235bffc49',
{ 'is_node': True,
"id": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c", 'key': '0:11:0',
"key": "0", 'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
"value": "Fit2cloud", 'value': '新节点 12'}],
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c", 'os': None,
"assets_amount": 6, 'platform': 'Linux',
"is_asset": False 'port': 22,
} 'system_users_granted': [{'comment': '',
], 'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
"platform": "Linux", 'name': 'web',
"comment": "" 'priority': 10,
}, 'protocol': 'ssh',
{ 'username': 'web'}],
"id": "ad594b10-9f64-4913-b7b1-135fe63561d1", 'system_users_join': 'web'},
"hostname": "ali-windows", {'comment': '',
"ip": "47.104.206.228", 'domain': None,
"port": 3389, 'hostname': 'guagua10嘎嘎',
"system_users_granted": [ 'id': '58b3ef97-fb52-41c0-81de-4505ab1ebff8',
{ 'ip': '192.168.244.187',
"id": "8763b81a-bb5e-484a-abca-10514c7bb185", 'is_active': True,
"name": "组织1-部门1-Administrator", 'nodes': [{'assets_amount': 15,
"username": "Administrator", 'id': '26410e6f-b833-433b-a804-b8b235bffc49',
"priority": 10, 'is_node': True,
"protocol": "rdp", 'key': '0:11:0',
"comment": "" 'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
} 'value': '新节点 12'}],
], 'os': None,
"is_active": True, 'platform': 'Linux',
"system_users_join": "Administrator", 'port': 22,
"os": "", 'system_users_granted': [{'comment': '',
"domain": "", 'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
"nodes": [ 'name': 'web',
{ 'priority': 10,
"id": "67f92d6c-0f91-4d20-a0e4-ac83b7dd02b6", 'protocol': 'ssh',
"key": "0:11:77", 'username': 'web'}],
"value": "新节点 12", 'system_users_join': 'web'},
"parent": "9c83d432-a353-4a4e-9fd9-be27a5851c2d", {'comment': '',
"assets_amount": 6, 'domain': '79f6f79a-6fa2-4fb2-ae7b-ab4a730131e3',
"is_asset": False 'hostname': 'centos.fit2cloud.com.xxx.whoami.ggg',
}, 'id': '5c5aaeaa-6324-4246-b836-5935836e2a30',
{ 'ip': '127.0.0.1',
"id": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c", 'is_active': True,
"key": "0", 'nodes': [{'assets_amount': 1,
"value": "Fit2cloud", 'id': '0bd0ce70-ed45-4201-b8e4-7062cf456d76',
"parent": "be9d9c3a-68d0-40ec-887c-5815d68e2f2c", 'is_node': True,
"assets_amount": 6, 'key': '0:6:0',
"is_asset": False 'parent': 'bff42eef-37e2-476e-a0b0-27637f4ccf02',
} 'value': '新节点 7'},
], {'assets_amount': 15,
"platform": "Windows", 'id': '26410e6f-b833-433b-a804-b8b235bffc49',
"comment": "" 'is_node': True,
} 'key': '0:11:0',
], 'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
"assets_amount": 2 'value': '新节点 12'},
} {'assets_amount': 16,
] 'id': 'cf461e12-787e-451c-857a-db5503ee1bd2',
'is_node': True,
'key': '0',
'parent': 'cf461e12-787e-451c-857a-db5503ee1bd2',
'value': 'ROOT'}],
'os': 'CentOS',
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua1',
'id': '63f6fb16-0331-42d9-b5c9-6805bf45534f',
'ip': '192.168.244.178',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua14',
'id': '6cf174f3-97ef-47de-be56-d15972a3e1b7',
'ip': '192.168.244.191',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua12',
'id': '771f9e8b-19a7-429c-8d19-920fefce0518',
'ip': '192.168.244.189',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua6',
'id': 'a1330e54-b5dc-4634-ae68-29fb8fbd0307',
'ip': '192.168.244.183',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua4',
'id': 'b1291272-0f2a-4a24-bde5-b317a74c50b1',
'ip': '192.168.244.181',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua8',
'id': 'cea1f081-098a-4d1f-b7c3-cf5977f5e6e4',
'ip': '192.168.244.185',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua11',
'id': 'd490c8d0-5ac9-4eb4-8aed-e5eda79a4f7c',
'ip': '192.168.244.188',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua7',
'id': 'f586a600-cc85-4e22-adf1-22c7f1631f4a',
'ip': '192.168.244.184',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua9',
'id': 'f5a9d5b8-524e-4a85-b8ed-da9db81fa2cc',
'ip': '192.168.244.186',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua2',
'id': 'fcddcb81-bc1f-4f76-af2b-67b1daa105b0',
'ip': '192.168.244.179',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'},
{'comment': '',
'domain': None,
'hostname': 'guagua13',
'id': 'fda85d33-6ae9-47ec-b910-fe542441c824',
'ip': '192.168.244.190',
'is_active': True,
'nodes': [{'assets_amount': 15,
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'is_node': True,
'key': '0:11:0',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'}],
'os': None,
'platform': 'Linux',
'port': 22,
'system_users_granted': [{'comment': '',
'id': '070a4791-36c9-4952-998b-7e5131ec2cd0',
'name': 'web',
'priority': 10,
'protocol': 'ssh',
'username': 'web'}],
'system_users_join': 'web'}],
'id': '26410e6f-b833-433b-a804-b8b235bffc49',
'key': '0:11:0',
'name': '新节点 12',
'parent': '9e1a60f6-6c55-4fed-ac39-cc786942cfc0',
'value': '新节点 12'},
{'assets_amount': 0,
'assets_granted': [],
'id': '2abfa1bc-bfd1-4aa3-a864-c3ad59a324da',
'key': '',
'name': 'Unnode',
'parent': 'cf461e12-787e-451c-857a-db5503ee1bd2',
'value': 'Unnode'}]
return jsonify(assets) return jsonify(assets)
...@@ -904,7 +680,6 @@ def read_file(filename, charset='utf-8'): ...@@ -904,7 +680,6 @@ def read_file(filename, charset='utf-8'):
if __name__ == '__main__': if __name__ == '__main__':
async_mode = 'threading'
socketio = SocketIO(app, async_mode=async_mode) socketio = SocketIO(app, async_mode=async_mode)
socketio.on_namespace(SSHws('/ssh')) socketio.on_namespace(SSHws('/ssh'))
socketio.run(app, debug=True) socketio.run(app, port=5001)
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"license": "GPLv3", "license": "GPLv3",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json", "start": "ng serve --proxy-config proxy.conf.json --host 0.0.0.0",
"build": "ng build --environment prod --aot --prod --base-href=/luna/ --deploy '/luna/'", "build": "ng build --environment prod --aot --prod --base-href=/luna/ --deploy '/luna/'",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
"@angular/router": "5.2.0", "@angular/router": "5.2.0",
"@swimlane/ngx-datatable": "^11.3.2", "@swimlane/ngx-datatable": "^11.3.2",
"@swimlane/ngx-ui": "^20.2.1", "@swimlane/ngx-ui": "^20.2.1",
"@types/socket.io-client": "^1.4.32",
"ajv": "^6.5.0", "ajv": "^6.5.0",
"animate.css": "^3.6.1", "animate.css": "^3.6.1",
"body-parser": "^1.18.2", "body-parser": "^1.18.2",
......
{ {
"/api": { "/api": {
"target": "http://127.0.0.1:5000", "target": "http://127.0.0.1:5001",
"secure": false "secure": false
}, },
"/luna/i18n": { "/luna/i18n": {
"target": "http://127.0.0.1:8088", "target": "http://127.0.0.1:5001",
"secure": false "secure": false
}, },
"/socket.io/": { "/socket.io/": {
"target": "http://127.0.0.1:5000", "target": "http://127.0.0.1:5001",
"secure": false "secure": false,
"ws": true
}, },
"/rdp/socket.io/": { "/rdp/socket.io/": {
"target": "http://localhost:9250", "target": "http://localhost:9250",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "es5", "target": "es5",
"importHelpers": true,
"typeRoots": [ "typeRoots": [
"node_modules/@types" "node_modules/@types"
], ],
......
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