mirror of https://github.com/jumpserver/jumpserver
Merge branches 'guanghongwei' and 'wangyong' of gitcafe.com:ibuler/jumpserver into guanghongwei
Conflicts: docs/AddUserAsset.pypull/6/head
commit
67f9aad1b9
|
@ -15,6 +15,7 @@ from jasset.models import Asset, IDC, BisGroup
|
|||
from juser.models import UserGroup, DEPT
|
||||
from jasset.views import jasset_group_add
|
||||
from jperm.models import CmdGroup
|
||||
from jlog.models import Log
|
||||
|
||||
|
||||
def test_add_idc():
|
||||
|
@ -87,6 +88,25 @@ def test_add_asset():
|
|||
print "Add: %s" % ip
|
||||
|
||||
|
||||
def test_add_log():
|
||||
li_date = []
|
||||
today = datetime.date.today()
|
||||
oneday = datetime.timedelta(days=1)
|
||||
for i in range(0, 7):
|
||||
today = today-oneday
|
||||
li_date.append(today)
|
||||
user_list = ['马云', '马化腾', '丁磊', '周鸿祎', '雷军', '柳传志', '陈天桥', '李彦宏', '李开复', '罗永浩']
|
||||
for i in range(1, 1000):
|
||||
user = random.choice(user_list)
|
||||
ip = random.randint(1, 20)
|
||||
start_time = random.choice(li_date)
|
||||
end_time = datetime.datetime.now()
|
||||
log_path = '/var/log/jumpserver/test.log'
|
||||
host = '192.168.1.' + str(ip)
|
||||
Log.objects.create(user=user, host=host, log_path=log_path, pid=168, start_time=start_time,
|
||||
is_finished=1, log_finished=1, end_time=end_time)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#test_add_dept()
|
||||
#test_add_group()
|
||||
|
@ -95,6 +115,8 @@ if __name__ == '__main__':
|
|||
#test_add_asset_group()
|
||||
test_add_asset()
|
||||
|
||||
test_add_user()
|
||||
test_add_log()
|
||||
|
||||
|
||||
|
||||
|
|
135
jasset/views.py
135
jasset/views.py
|
@ -4,7 +4,6 @@ from django.db.models import Q
|
|||
from django.http import HttpResponseRedirect
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render_to_response
|
||||
from django.core.paginator import Paginator, EmptyPage, InvalidPage
|
||||
|
||||
from models import IDC, Asset, BisGroup
|
||||
from juser.models import UserGroup
|
||||
|
@ -50,7 +49,7 @@ def f_add_host(ip, port, idc, jtype, group, active, comment, username='', passwo
|
|||
|
||||
def add_host(request):
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
header_title, path1, path2 = u'添加主机 | Add Host', u'资产管理', u'添加主机'
|
||||
header_title, path1, path2 = u'添加主机', u'资产管理', u'添加主机'
|
||||
eidc = IDC.objects.all()
|
||||
egroup = BisGroup.objects.filter(type='A')
|
||||
eusergroup = UserGroup.objects.all()
|
||||
|
@ -65,7 +64,7 @@ def add_host(request):
|
|||
j_comment = request.POST.get('j_comment')
|
||||
|
||||
if Asset.objects.filter(ip=str(j_ip)):
|
||||
emg = u'该IP %s 已存在!' %j_ip
|
||||
emg = u'该IP %s 已存在!' % j_ip
|
||||
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
if j_type == 'M':
|
||||
|
@ -74,14 +73,13 @@ def add_host(request):
|
|||
f_add_host(j_ip, j_port, j_idc, j_type, j_group, j_active, j_comment, j_user, j_password)
|
||||
else:
|
||||
f_add_host(j_ip, j_port, j_idc, j_type, j_group, j_active, j_comment)
|
||||
|
||||
smg = u'主机 %s 添加成功' %j_ip
|
||||
smg = u'主机 %s 添加成功' % j_ip
|
||||
|
||||
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def add_host_multi(request):
|
||||
header_title, path1, path2 = u'批量添加主机 | Add Hosts', u'资产管理', u'批量添加主机'
|
||||
header_title, path1, path2 = u'批量添加主机', u'资产管理', u'批量添加主机'
|
||||
login_types = {'LDAP': 'L', 'SSH_KEY': 'S', 'PASSWORD': 'P', 'MAP': 'M'}
|
||||
j_group = []
|
||||
if request.method == 'POST':
|
||||
|
@ -97,8 +95,9 @@ def add_host_multi(request):
|
|||
j_group.append(g)
|
||||
|
||||
if Asset.objects.filter(ip=str(j_ip)):
|
||||
emg = u'该IP %s 已存在!' %j_ip
|
||||
return render_to_response('jasset/host_add_multi.html', locals(), context_instance=RequestContext(request))
|
||||
emg = u'该IP %s 已存在!' % j_ip
|
||||
return render_to_response('jasset/host_add_multi.html', locals(),
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
if j_type == 'M':
|
||||
j_user = request.POST.get('j_user')
|
||||
|
@ -117,14 +116,14 @@ def batch_host_edit(request):
|
|||
if request.method == 'POST':
|
||||
len_table = request.POST.get('len_table')
|
||||
for i in range(int(len_table)):
|
||||
j_id = "editable["+str(i)+"][j_id]"
|
||||
j_ip = "editable["+str(i)+"][j_ip]"
|
||||
j_port = "editable["+str(i)+"][j_port]"
|
||||
j_idc = "editable["+str(i)+"][j_idc]"
|
||||
j_type = "editable["+str(i)+"][j_type]"
|
||||
j_group = "editable["+str(i)+"][j_group]"
|
||||
j_active = "editable["+str(i)+"][j_active]"
|
||||
j_comment = "editable["+str(i)+"][j_comment]"
|
||||
j_id = "editable[" + str(i) + "][j_id]"
|
||||
j_ip = "editable[" + str(i) + "][j_ip]"
|
||||
j_port = "editable[" + str(i) + "][j_port]"
|
||||
j_idc = "editable[" + str(i) + "][j_idc]"
|
||||
j_type = "editable[" + str(i) + "][j_type]"
|
||||
j_group = "editable[" + str(i) + "][j_group]"
|
||||
j_active = "editable[" + str(i) + "][j_active]"
|
||||
j_comment = "editable[" + str(i) + "][j_comment]"
|
||||
|
||||
j_id = request.POST.get(j_id).strip()
|
||||
j_ip = request.POST.get(j_ip).strip()
|
||||
|
@ -141,19 +140,10 @@ def batch_host_edit(request):
|
|||
|
||||
|
||||
def list_host(request):
|
||||
header_title, path1, path2 = u'查看主机 | List Host', u'资产管理', u'查看主机'
|
||||
header_title, path1, path2 = u'查看主机', u'资产管理', u'查看主机'
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
posts = contact_list = Asset.objects.all().order_by('ip')
|
||||
p = paginator = Paginator(contact_list, 20)
|
||||
try:
|
||||
page = int(request.GET.get('page', '1'))
|
||||
except ValueError:
|
||||
page = 1
|
||||
|
||||
try:
|
||||
contacts = paginator.page(page)
|
||||
except (EmptyPage, InvalidPage):
|
||||
contacts = paginator.page(paginator.num_pages)
|
||||
posts = Asset.objects.all().order_by('ip')
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
|
||||
return render_to_response('jasset/host_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
@ -162,7 +152,7 @@ def host_del(request, offset):
|
|||
if offset == 'multi':
|
||||
len_list = request.POST.get("len_list")
|
||||
for i in range(int(len_list)):
|
||||
key = "id_list["+str(i)+"]"
|
||||
key = "id_list[" + str(i) + "]"
|
||||
jid = request.POST.get(key)
|
||||
a = Asset.objects.get(id=jid).ip
|
||||
Asset.objects.filter(id=jid).delete()
|
||||
|
@ -178,7 +168,7 @@ def host_del(request, offset):
|
|||
def host_edit(request):
|
||||
actives = {1: u'激活', 0: u'禁用'}
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
header_title, path1, path2 = u'修改主机 | Edit Host', u'资产管理', u'修改主机'
|
||||
header_title, path1, path2 = u'修改主机', u'资产管理', u'修改主机'
|
||||
groups, e_group = [], []
|
||||
eidc = IDC.objects.all()
|
||||
egroup = BisGroup.objects.filter(type='A')
|
||||
|
@ -222,14 +212,14 @@ def host_edit(request):
|
|||
a.save()
|
||||
a.bis_group = groups
|
||||
a.save()
|
||||
smg = u'主机 %s 修改成功' %j_ip
|
||||
smg = u'主机 %s 修改成功' % j_ip
|
||||
return HttpResponseRedirect('/jasset/host_list')
|
||||
|
||||
return render_to_response('jasset/host_edit.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def jlist_ip(request, offset):
|
||||
header_title, path1, path2 = u'主机详细信息 | Host Detail.', u'资产管理', u'主机详情'
|
||||
header_title, path1, path2 = u'主机详细信息', u'资产管理', u'主机详情'
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
post = contact_list = Asset.objects.get(ip=str(offset))
|
||||
log = Log.objects.filter(host=str(offset))
|
||||
|
@ -237,7 +227,7 @@ def jlist_ip(request, offset):
|
|||
|
||||
|
||||
def add_idc(request):
|
||||
header_title, path1, path2 = u'添加IDC | Add IDC', u'资产管理', u'添加IDC'
|
||||
header_title, path1, path2 = u'添加IDC', u'资产管理', u'添加IDC'
|
||||
if request.method == 'POST':
|
||||
j_idc = request.POST.get('j_idc')
|
||||
j_comment = request.POST.get('j_comment')
|
||||
|
@ -245,14 +235,14 @@ def add_idc(request):
|
|||
emg = u'该IDC已存在!'
|
||||
return render_to_response('jasset/idc_add.html', locals(), context_instance=RequestContext(request))
|
||||
else:
|
||||
smg = u'IDC:%s添加成功' %j_idc
|
||||
smg = u'IDC:%s添加成功' % j_idc
|
||||
IDC.objects.create(name=j_idc, comment=j_comment)
|
||||
|
||||
return render_to_response('jasset/idc_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def list_idc(request):
|
||||
header_title, path1, path2 = u'查看IDC | List IDC', u'资产管理', u'查看IDC'
|
||||
header_title, path1, path2 = u'查看IDC', u'资产管理', u'查看IDC'
|
||||
posts = IDC.objects.all().order_by('id')
|
||||
return render_to_response('jasset/idc_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
@ -263,7 +253,7 @@ def del_idc(request, offset):
|
|||
|
||||
|
||||
def add_group(request):
|
||||
header_title, path1, path2 = u'添加主机组 | Add Group', u'资产管理', u'添加主机组'
|
||||
header_title, path1, path2 = u'添加主机组', u'资产管理', u'添加主机组'
|
||||
posts = Asset.objects.all()
|
||||
if request.method == 'POST':
|
||||
j_group = request.POST.get('j_group')
|
||||
|
@ -279,19 +269,19 @@ def add_group(request):
|
|||
for host in j_hosts:
|
||||
g = Asset.objects.get(id=host)
|
||||
group.asset_set.add(g)
|
||||
smg = u'主机组%s添加成功' %j_group
|
||||
smg = u'主机组%s添加成功' % j_group
|
||||
|
||||
return render_to_response('jasset/group_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def list_group(request):
|
||||
header_title, path1, path2 = u'查看主机组 | List Group', u'资产管理', u'查看主机组'
|
||||
header_title, path1, path2 = u'查看主机组', u'资产管理', u'查看主机组'
|
||||
posts = BisGroup.objects.filter(type='A').order_by('id')
|
||||
return render_to_response('jasset/group_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def edit_group(request):
|
||||
header_title, path1, path2 = u'编辑主机组 | Edit Group', u'资产管理', u'编辑主机组'
|
||||
header_title, path1, path2 = u'编辑主机组', u'资产管理', u'编辑主机组'
|
||||
group_id = request.GET.get('id')
|
||||
group = BisGroup.objects.get(id=group_id)
|
||||
all = Asset.objects.all()
|
||||
|
@ -307,71 +297,55 @@ def edit_group(request):
|
|||
g = Asset.objects.get(id=host)
|
||||
group.asset_set.add(g)
|
||||
BisGroup.objects.filter(id=group_id).update(name=j_group, comment=j_comment)
|
||||
smg = u'主机组%s修改成功' %j_group
|
||||
return HttpResponseRedirect('/jasset/group_detail/%s' % group_id)
|
||||
smg = u'主机组%s修改成功' % j_group
|
||||
return HttpResponseRedirect('/jasset/group_detail/?id=%s' % group_id)
|
||||
|
||||
return render_to_response('jasset/group_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def detail_group(request):
|
||||
header_title, path1, path2 = u'主机组详情 | Group Detail', u'资产管理', u'主机组详情'
|
||||
header_title, path1, path2 = u'主机组详情', u'资产管理', u'主机组详情'
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
offset = request.GET.get('id')
|
||||
group_name = BisGroup.objects.get(id=offset).name
|
||||
b = BisGroup.objects.get(id=offset)
|
||||
posts = contact_list = Asset.objects.filter(bis_group=b).order_by('ip')
|
||||
p = paginator = Paginator(contact_list, 5)
|
||||
try:
|
||||
page = int(request.GET.get('page', '1'))
|
||||
except ValueError:
|
||||
page = 1
|
||||
group_id = request.GET.get('id')
|
||||
group_name = BisGroup.objects.get(id=group_id).name
|
||||
b = BisGroup.objects.get(id=group_id)
|
||||
posts = Asset.objects.filter(bis_group=b).order_by('ip')
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
|
||||
try:
|
||||
contacts = paginator.page(page)
|
||||
except (EmptyPage, InvalidPage):
|
||||
contacts = paginator.page(paginator.num_pages)
|
||||
return render_to_response('jasset/group_detail.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def detail_idc(request):
|
||||
header_title, path1, path2 = u'主机组详情 | Group Detail', u'资产管理', u'主机组详情'
|
||||
header_title, path1, path2 = u'IDC详情', u'资产管理', u'IDC详情'
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
offset = request.GET.get('id')
|
||||
idc_name = IDC.objects.get(id=offset).name
|
||||
b = IDC.objects.get(id=offset)
|
||||
posts = contact_list = Asset.objects.filter(idc=b).order_by('ip')
|
||||
p = paginator = Paginator(contact_list, 5)
|
||||
try:
|
||||
page = int(request.GET.get('page', '1'))
|
||||
except ValueError:
|
||||
page = 1
|
||||
idc_id = request.GET.get('id')
|
||||
idc_name = IDC.objects.get(id=idc_id).name
|
||||
b = IDC.objects.get(id=idc_id)
|
||||
posts = Asset.objects.filter(idc=b).order_by('ip')
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
|
||||
try:
|
||||
contacts = paginator.page(page)
|
||||
except (EmptyPage, InvalidPage):
|
||||
contacts = paginator.page(paginator.num_pages)
|
||||
return render_to_response('jasset/idc_detail.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def group_del_host(request, offset):
|
||||
if request.method == 'POST':
|
||||
group_name = request.POST.get('group_name')
|
||||
print group_name
|
||||
if offset == 'group':
|
||||
group = BisGroup.objects.get(name=group_name)
|
||||
elif offset == 'idc':
|
||||
group = IDC.objects.get(name=group_name)
|
||||
len_list = request.POST.get("len_list")
|
||||
for i in range(int(len_list)):
|
||||
key = "id_list["+str(i)+"]"
|
||||
print key
|
||||
key = "id_list[" + str(i) + "]"
|
||||
jid = request.POST.get(key)
|
||||
print jid
|
||||
g = Asset.objects.get(id=jid)
|
||||
print g
|
||||
group.asset_set.remove(g)
|
||||
print 'ok'
|
||||
return HttpResponseRedirect('/jasset/%s_detail/%s' %(offset, group.id))
|
||||
if offset == 'group':
|
||||
group.asset_set.remove(g)
|
||||
elif offset == 'idc':
|
||||
Asset.objects.filter(id=jid).delete()
|
||||
BisGroup.objects.filter(name=g.ip).delete()
|
||||
|
||||
return HttpResponseRedirect('/jasset/%s_detail/?id=%s' % (offset, group.id))
|
||||
|
||||
|
||||
def group_del(request, offset):
|
||||
|
@ -383,10 +357,9 @@ def host_search(request):
|
|||
keyword = request.GET.get('keyword')
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
posts = Asset.objects.filter(Q(ip__contains=keyword) | Q(idc__name__contains=keyword) |
|
||||
Q(bis_group__name__contains=keyword) | Q(comment__contains=keyword)).distinct().order_by('ip')
|
||||
print posts
|
||||
contact_list, p, contacts = pages(posts, request)
|
||||
print contact_list, p, contacts
|
||||
Q(bis_group__name__contains=keyword) | Q(
|
||||
comment__contains=keyword)).distinct().order_by('ip')
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
|
||||
return render_to_response('jasset/host_search.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
|
|
@ -17,19 +17,19 @@ CONF.read('%s/jumpserver.conf' % BASE_DIR)
|
|||
|
||||
|
||||
def log_list_online(request):
|
||||
header_title, path1, path2 = u'查看日志 | Log List.', u'查看日志', u'在线用户'
|
||||
header_title, path1, path2 = u'查看日志', u'查看日志', u'在线用户'
|
||||
web_socket_host = CONF.get('websocket', 'web_socket_host')
|
||||
posts = Log.objects.filter(is_finished=0).order_by('-start_time')
|
||||
contact_list, p, contacts = pages(posts, request)
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
|
||||
return render_to_response('jlog/log_online.html', locals())
|
||||
|
||||
|
||||
def log_list_offline(request):
|
||||
header_title, path1, path2 = u'查看日志 | Log List.', u'查看日志', u'历史记录'
|
||||
header_title, path1, path2 = u'查看日志', u'查看日志', u'历史记录'
|
||||
web_socket_host = CONF.get('websocket', 'web_socket_host')
|
||||
posts = Log.objects.filter(is_finished=1).order_by('-start_time')
|
||||
contact_list, p, contacts = pages(posts, request)
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
|
||||
return render_to_response('jlog/log_offline.html', locals())
|
||||
|
||||
|
@ -60,10 +60,10 @@ def log_search(request):
|
|||
if env == 'online':
|
||||
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
|
||||
.filter(is_finished=0).order_by('-start_time')
|
||||
contact_list, p, contacts = pages(posts, request)
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
elif env == 'offline':
|
||||
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
|
||||
.filter(is_finished=1).order_by('-start_time')
|
||||
contact_list, p, contacts = pages(posts, request)
|
||||
contact_list, p, contacts, page_range, current_page = pages(posts, request)
|
||||
|
||||
return render_to_response('jlog/log_search.html', locals())
|
||||
|
|
|
@ -56,27 +56,50 @@ def base(request):
|
|||
return render_to_response('base.html', context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def index(request):
|
||||
path1, path2 = u'仪表盘', 'Dashboard'
|
||||
def get_data(data, items, option):
|
||||
dic = {}
|
||||
li_date, li_str = getDaysByNum(7)
|
||||
today = datetime.datetime.now().day
|
||||
from_week = datetime.datetime.now() - datetime.timedelta(days=7)
|
||||
week_data = Log.objects.filter(start_time__range=[from_week, datetime.datetime.now()])
|
||||
top_ten = week_data.values('user').annotate(times=Count('user')).order_by('-times')[:10]
|
||||
for user in top_ten:
|
||||
username = user['user']
|
||||
for item in items:
|
||||
li = []
|
||||
user_data = week_data.filter(user=username)
|
||||
name = item[option]
|
||||
if option == 'user':
|
||||
option_data = data.filter(user=name)
|
||||
elif option == 'host':
|
||||
option_data = data.filter(host=name)
|
||||
for t in li_date:
|
||||
year, month, day = t.year, t.month, t.day
|
||||
times = user_data.filter(start_time__year=year, start_time__month=month, start_time__day=day).count()
|
||||
times = option_data.filter(start_time__year=year, start_time__month=month, start_time__day=day).count()
|
||||
li.append(times)
|
||||
dic[username] = li
|
||||
dic[name] = li
|
||||
return dic
|
||||
|
||||
|
||||
def index(request):
|
||||
path1, path2 = u'仪表盘', 'Dashboard'
|
||||
users = User.objects.all()
|
||||
hosts = Asset.objects.all()
|
||||
online_host = Log.objects.filter(is_finished=0)
|
||||
online_user = online_host.distinct()
|
||||
li_date, li_str = getDaysByNum(7)
|
||||
today = datetime.datetime.now().day
|
||||
from_week = datetime.datetime.now() - datetime.timedelta(days=7)
|
||||
week_data = Log.objects.filter(start_time__range=[from_week, datetime.datetime.now()])
|
||||
user_top_ten = week_data.values('user').annotate(times=Count('user')).order_by('-times')[:10]
|
||||
host_top_ten = week_data.values('host').annotate(times=Count('host')).order_by('-times')[:10]
|
||||
user_dic, host_dic = get_data(week_data, user_top_ten, 'user'), get_data(week_data, host_top_ten, 'host')
|
||||
|
||||
top = {'user': '活跃用户数', 'host': '活跃主机数', 'times': '登录次数'}
|
||||
top_dic = {}
|
||||
for key, value in top.items():
|
||||
li = []
|
||||
for t in li_date:
|
||||
year, month, day = t.year, t.month, t.day
|
||||
if key != 'times':
|
||||
times = week_data.filter(start_time__year=year, start_time__month=month, start_time__day=day).values(key).distinct().count()
|
||||
else:
|
||||
times = week_data.filter(start_time__year=year, start_time__month=month, start_time__day=day).count()
|
||||
li.append(times)
|
||||
top_dic[value] = li
|
||||
return render_to_response('index.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
|
@ -94,10 +117,8 @@ def jasset_group_add(name, comment, jtype):
|
|||
if BisGroup.objects.filter(name=name):
|
||||
emg = u'该业务组已存在!'
|
||||
else:
|
||||
BisGroup.objects.create(name=name, comment=comment, type=type)
|
||||
smg = u'业务组%s添加成功' % name
|
||||
BisGroup.objects.create(name=name, comment=comment, type=jtype)
|
||||
smg = u'业务组%s添加成功' %name
|
||||
smg = u'业务组%s添加成功' % name
|
||||
|
||||
|
||||
class ServerError(Exception):
|
||||
|
@ -111,7 +132,6 @@ def page_list_return(total, current=1):
|
|||
return range(min_page, max_page+1)
|
||||
|
||||
|
||||
|
||||
def jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_active, j_comment):
|
||||
groups = []
|
||||
is_active = {u'是': '1', u'否': '2'}
|
||||
|
@ -144,19 +164,22 @@ def jasset_host_edit(j_id, j_ip, j_idc, j_port, j_type, j_group, j_active, j_com
|
|||
|
||||
|
||||
def pages(posts, r):
|
||||
"""分页公用函数"""
|
||||
contact_list = posts
|
||||
p = paginator = Paginator(contact_list, 10)
|
||||
p = paginator = Paginator(contact_list, 20)
|
||||
try:
|
||||
page = int(r.GET.get('page', '1'))
|
||||
current_page = int(r.GET.get('page', '1'))
|
||||
except ValueError:
|
||||
page = 1
|
||||
current_page = 1
|
||||
|
||||
page_range = page_list_return(len(p.page_range), current_page)
|
||||
|
||||
try:
|
||||
contacts = paginator.page(page)
|
||||
contacts = paginator.page(current_page)
|
||||
except (EmptyPage, InvalidPage):
|
||||
contacts = paginator.page(paginator.num_pages)
|
||||
|
||||
return contact_list, p, contacts
|
||||
return contact_list, p, contacts, page_range, current_page
|
||||
|
||||
|
||||
def login(request):
|
||||
|
|
|
@ -58,16 +58,71 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="high" style="width:100%;height:400px;"></div>
|
||||
</br>
|
||||
<div id="dynamic" style="width:100%;height:400px; margin-top:170px"></div>
|
||||
<div id="top10" style="width:100%;height:400px;"></div>
|
||||
<div id="usertop10" style="width:100%;height:400px;margin-top:170px"></div>
|
||||
<br/>
|
||||
<div id="hosttop10" style="width:100%;height:400px;"></div>
|
||||
<br/>
|
||||
<div id="dynamic" style="width:100%;height:400px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var cate = {{ li_str|safe }};
|
||||
$(function () {
|
||||
$('#high').highcharts({
|
||||
$('#top10').highcharts({
|
||||
title: {
|
||||
text: '数据总览',
|
||||
x: -20 //center
|
||||
},
|
||||
subtitle: {
|
||||
text: 'Source: JumpServer',
|
||||
x: -20
|
||||
},
|
||||
rangeSelector: {
|
||||
allButtonsEnabled: true,
|
||||
selected: 2
|
||||
},
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
categories: cate
|
||||
},
|
||||
yAxis:{
|
||||
min: 0,
|
||||
title: {
|
||||
text: '登录次数'
|
||||
},
|
||||
plotLines: [{
|
||||
value: 0,
|
||||
width: 1,
|
||||
color: '#808080'
|
||||
}]
|
||||
},
|
||||
tooltip: {
|
||||
valueSuffix: '次'
|
||||
},
|
||||
legend: {
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
verticalAlign: 'middle',
|
||||
borderWidth: 0
|
||||
},
|
||||
navigation: {
|
||||
buttonOptions: {
|
||||
align: 'right'
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{% for k,v in top_dic.items %}
|
||||
{
|
||||
name: '{{ k }}',
|
||||
data: {{ v }}
|
||||
},
|
||||
{% endfor %}
|
||||
]
|
||||
});
|
||||
|
||||
$('#usertop10').highcharts({
|
||||
title: {
|
||||
text: '一周用户登录TOP10',
|
||||
x: -20 //center
|
||||
|
@ -101,7 +156,7 @@ $(function () {
|
|||
borderWidth: 0
|
||||
},
|
||||
series: [
|
||||
{% for k,v in dic.items %}
|
||||
{% for k,v in user_dic.items %}
|
||||
{
|
||||
name: '{{ k }}',
|
||||
data: {{ v }}
|
||||
|
@ -110,6 +165,50 @@ $(function () {
|
|||
]
|
||||
});
|
||||
|
||||
$('#hosttop10').highcharts({
|
||||
title: {
|
||||
text: '一周主机登录TOP10',
|
||||
x: -20 //center
|
||||
},
|
||||
subtitle: {
|
||||
text: 'Source: JumpServer',
|
||||
x: -20
|
||||
},
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
categories: cate
|
||||
},
|
||||
yAxis:{
|
||||
min: 0,
|
||||
title: {
|
||||
text: '登录次数'
|
||||
},
|
||||
plotLines: [{
|
||||
value: 0,
|
||||
width: 1,
|
||||
color: '#808080'
|
||||
}]
|
||||
},
|
||||
tooltip: {
|
||||
valueSuffix: '次'
|
||||
},
|
||||
legend: {
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
verticalAlign: 'middle',
|
||||
borderWidth: 0
|
||||
},
|
||||
series: [
|
||||
{% for k,v in host_dic.items %}
|
||||
{
|
||||
name: '{{ k }}',
|
||||
data: {{ v }}
|
||||
},
|
||||
{% endfor %}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
Highcharts.setOptions({
|
||||
global: {
|
||||
|
|
|
@ -62,9 +62,9 @@
|
|||
<td class="text-center"> {{ post.date_added|date:"Y-m-d H:i:s" }} </td>
|
||||
<td class="text-center" name="j_comment"> {{ post.comment }} </td>
|
||||
<td class="text-center" data-editable='false'>
|
||||
<a href="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jasset/host_edit/{{ post.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="/jasset/host_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
<a value="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jasset/host_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="/jasset/host_del/{{ post.id }}/" class="btn btn-xs btn-danger">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -80,18 +80,29 @@
|
|||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
|
||||
{% if contacts.has_previous %}
|
||||
<li><a href="?page={{ contacts.previous_page_number }}">«</a></li>
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?id={{ group_id }}&page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="active"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?id={{ group_id }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?id={{ group_id }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li><a href="?page={{ contacts.next_page_number }}">»</a></li>
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?id={{ group_id }}&page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -109,6 +120,21 @@
|
|||
$('#editable').editableTableWidget();
|
||||
});
|
||||
|
||||
$(".iframe").on('click', function(){
|
||||
var url= $(this).attr("value");
|
||||
$.layer({
|
||||
type: 2,
|
||||
title: 'JumpServer主机详情',
|
||||
maxmin: true,
|
||||
shift: 'top',
|
||||
border: [2, 0.3, '#1AB394'],
|
||||
shade: [0.5, '#000000'],
|
||||
shadeClose: true,
|
||||
area : ['800px' , '600px'],
|
||||
iframe: {src: url}
|
||||
});
|
||||
});
|
||||
|
||||
function alter(form) {
|
||||
selectData = GetTableDataBox();
|
||||
if (selectData[1] != 0) {
|
||||
|
@ -142,7 +168,7 @@
|
|||
url: "/jasset/group_del_host/group/",
|
||||
data: {"id_list": id_list, "len_list": j, "group_name": group_name},
|
||||
success: function (data) {
|
||||
window.open(window.location.pathname, "_self");
|
||||
window.open(window.location.href, "_self");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -91,18 +91,30 @@
|
|||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
|
||||
{% if contacts.has_previous %}
|
||||
<li><a href="?page={{ contacts.previous_page_number }}">«</a></li>
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="active"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ p.num_pages }}" title="第{{ page }}页">...{{ p.num_pages }}</a></li>
|
||||
{% if contacts.has_next %}
|
||||
<li><a href="?page={{ contacts.next_page_number }}">»</a></li>
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -45,18 +45,29 @@
|
|||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
|
||||
{% if contacts.has_previous %}
|
||||
<li><a href="?page={{ contacts.previous_page_number }}">«</a></li>
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?id={{ group_id }}&page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="active"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li><a href="?page={{ contacts.next_page_number }}">»</a></li>
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?id={{ group_id }}&page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<td class="text-center"> {{ post.date_added|date:"Y-m-d H:i:s" }} </td>
|
||||
<td class="text-center" name="j_comment"> {{ post.comment }} </td>
|
||||
<td class="text-center" data-editable='false'>
|
||||
<a href="/jasset/?id={{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a value="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jasset/host_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -79,18 +79,29 @@
|
|||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
|
||||
{% if contacts.has_previous %}
|
||||
<li><a href="?page={{ contacts.previous_page_number }}">«</a></li>
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?id={{ idc_id }}&page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="active"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?id={{ idc_id }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?id={{ idc_id }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li><a href="?page={{ contacts.next_page_number }}">»</a></li>
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?id={{ idc_id }}&page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -108,6 +119,21 @@
|
|||
$('#editable').editableTableWidget();
|
||||
});
|
||||
|
||||
$(".iframe").on('click', function(){
|
||||
var url= $(this).attr("value");
|
||||
$.layer({
|
||||
type: 2,
|
||||
title: 'JumpServer主机详情',
|
||||
maxmin: true,
|
||||
shift: 'top',
|
||||
border: [2, 0.3, '#1AB394'],
|
||||
shade: [0.5, '#000000'],
|
||||
shadeClose: true,
|
||||
area : ['800px' , '600px'],
|
||||
iframe: {src: url}
|
||||
});
|
||||
});
|
||||
|
||||
function alter(form) {
|
||||
selectData = GetTableDataBox();
|
||||
if (selectData[1] != 0) {
|
||||
|
@ -141,7 +167,7 @@
|
|||
url: "/jasset/group_del_host/idc/",
|
||||
data: {"id_list": id_list, "len_list": j, "group_name": group_name},
|
||||
success: function (data) {
|
||||
window.open(window.location.pathname, "_self");
|
||||
window.open(window.location.href, "_self");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<td class="text-center"> <a href="/jasset/idc_detail/?id={{ post.id }}">{{ post.asset_set.count }}</a> </td>
|
||||
<td class="text-center"> {{ post.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="/jasset/?id={{ post.id }}" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jasset/idc_detail/?id={{ post.id }}" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jasset/idc_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
.bootstrap-dialog-message {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.pre-class {
|
||||
background-color: rgba(0, 0, 0, 1);
|
||||
}
|
||||
.modal-content {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
@ -78,7 +81,6 @@
|
|||
<th class="text-center"> 实时监控 </th>
|
||||
<th class="text-center"> 阻断 </th>
|
||||
<th class="text-center"> 登录时间 </th>
|
||||
<th class="text-center"> 结束时间 </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -90,7 +92,6 @@
|
|||
<td class="text-center"><a class="monitor" filename="{{ post.log_path }}"> 监控 </a></td>
|
||||
<td class="text-center"><input type="button" id="cut" class="btn btn-danger btn-xs" name="cut" value="阻断" onclick='cut("{{ post.pid }}")' /></td>
|
||||
<td class="text-center"> {{ post.start_time|date:"Y-m-d H:i:s" }} </td>
|
||||
<td class="text-center"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -144,6 +145,7 @@
|
|||
var username = $('#username')[0].innerText;
|
||||
var ip = $('#ip')[0].innerText;
|
||||
BootstrapDialog.show({message:function(){
|
||||
var option, exsit_message;
|
||||
var escapeString = function (html){
|
||||
var elem = document.createElement('div')
|
||||
var txt = document.createTextNode(html)
|
||||
|
@ -154,14 +156,23 @@
|
|||
//告诉服务器端有用户登录
|
||||
socket.emit('login', {userid:message.id, filename:message.filename});
|
||||
socket.on('message',function(obj){
|
||||
option = obj.option;
|
||||
console.log(option+'so')
|
||||
exsit_message = obj.content;
|
||||
console.log(obj.content)
|
||||
//去除log中的颜色控制字符
|
||||
var regx = /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/g;
|
||||
// tag.append('<p>'+escapeString(obj.content.replace(regx,''))+'</p>');
|
||||
tag.append('<p>'+escapeString(obj.content)+'</p>');
|
||||
if (option == 'new') {
|
||||
tag.append('<p>' + escapeString(obj.content) + '</p>');
|
||||
} else if (option == 'exist') {
|
||||
tag.append('<p>' + exsit_message + '</p>');
|
||||
}
|
||||
tag.animate({ scrollTop: tag[0].scrollHeight}, 1);
|
||||
});
|
||||
tag[0].style.color = "#00FF00";
|
||||
return tag[0];
|
||||
|
||||
} ,
|
||||
title:'Jumpserver实时监控 '+' 登录用户名: '+'<span class="text-info">'+username+'</span>'+' 登录主机: '+'<span class="text-info">'+ip,
|
||||
onhide:function(){
|
||||
|
|
|
@ -26,19 +26,29 @@ io.on('connection', function(socket){
|
|||
socket.name = obj.userid;
|
||||
socket.fileName = obj.filename;
|
||||
var tail = new Tail(obj.filename);
|
||||
//console.log(obj.filename);
|
||||
|
||||
//2015-03-06 当用户打开监控窗口时,会把已存在的文件内容打印出来
|
||||
var fs = require('fs');
|
||||
fs.readFile(obj.filename, 'utf8', function (err,data) {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
var existData = {userid:obj.userid,username:obj.username,content:data,option:'exist'};
|
||||
socket.emit('message',existData);
|
||||
});
|
||||
|
||||
tail.on('line',function(data) {
|
||||
//console.log(data);
|
||||
var newData = {userid:obj.userid,username:obj.username,content:data};
|
||||
var newData = {userid:obj.userid,username:obj.username,content:data,option:'new'};
|
||||
socket.emit('message',newData);
|
||||
});
|
||||
// var tail = spawn("tail", ['-f', obj.filename]);
|
||||
// tail.stdout.on('data',function(data){
|
||||
// var content = data.toString();
|
||||
// //console.log(content);
|
||||
// var newData = {userid:obj.userid,username:obj.username,content:content};
|
||||
// socket.emit('message',newData);
|
||||
// });
|
||||
//var tail = spawn("tail", ['-f', obj.filename]);
|
||||
//tail.stdout.on('data',function(data){
|
||||
// var content = data.toString();
|
||||
// //console.log(content);
|
||||
// var newData = {userid:obj.userid,username:obj.username,content:content};
|
||||
// socket.emit('message',newData);
|
||||
//});
|
||||
|
||||
|
||||
socket.tail = tail;
|
||||
|
|
Loading…
Reference in New Issue