diff --git a/connect.py b/connect.py index 3d52e727b..31a9be0f4 100755 --- a/connect.py +++ b/connect.py @@ -5,6 +5,7 @@ import sys import os import select import time +from datetime import datetime import paramiko import struct import fcntl @@ -34,7 +35,7 @@ except ImportError: time.sleep(3) sys.exit() -BASE_DIR = os.path.dirname(__file__) +BASE_DIR = os.path.abspath(os.path.dirname(__file__)) CONF = ConfigParser() CONF.read(os.path.join(BASE_DIR, 'jumpserver.conf')) LOG_DIR = os.path.join(BASE_DIR, 'logs') @@ -155,7 +156,7 @@ def log_record(username, host): except IOError: raise ServerError('Create logfile failed, Please modify %s permission.' % today_connect_log_dir) - log = Log(user=user, asset=asset, log_path=log_file_path, start_time=timestamp_start, pid=pid) + log = Log(user=user, asset=asset, log_path=log_file_path, start_time=datetime.now(), pid=pid) log.save() return log_file, log @@ -200,7 +201,7 @@ def posix_shell(chan, username, host): termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_tty) log_file.close() log.is_finished = True - log.end_time = timestamp_end + log.end_time = datetime.now() log.save() diff --git a/jlog/models.py b/jlog/models.py index 920068fd9..dee1890a5 100644 --- a/jlog/models.py +++ b/jlog/models.py @@ -8,10 +8,10 @@ class Log(models.Model): user = models.ForeignKey(User) asset = models.ForeignKey(Asset) log_path = models.CharField(max_length=100) - start_time = models.IntegerField() + start_time = models.DateTimeField(null=True) pid = models.IntegerField(max_length=10) is_finished = models.BooleanField(default=False) - end_time = models.IntegerField(blank=True, null=True) + end_time = models.DateTimeField(null=True) def __unicode__(self): return self.log_path \ No newline at end of file diff --git a/jlog/urls.py b/jlog/urls.py new file mode 100644 index 000000000..75f4111fe --- /dev/null +++ b/jlog/urls.py @@ -0,0 +1,9 @@ +# coding:utf-8 +from django.conf.urls import patterns, include, url +from jlog.views import * + +urlpatterns = patterns('', + url(r'^$', jlog_list), + url(r'^log_list/$', jlog_list), + url(r'^log_kill/(\d+)', jlog_kill), +) diff --git a/jlog/views.py b/jlog/views.py index 91ea44a21..6ce5714b5 100644 --- a/jlog/views.py +++ b/jlog/views.py @@ -1,3 +1,29 @@ -from django.shortcuts import render +# coding:utf-8 +import os +import ConfigParser +from datetime import datetime +from django.http import HttpResponseRedirect +from django.template import RequestContext +from django.shortcuts import render_to_response +from django.core.paginator import Paginator, EmptyPage -# Create your views here. +from connect import BASE_DIR +from jlog.models import Log + +CONF = ConfigParser.ConfigParser() +CONF.read('%s/jumpserver.conf' % BASE_DIR) + +def jlog_list(request): + header_title, path1, path2 = u'查看日志 | Log List.', u'查看日志', u'日志列表' + online = Log.objects.filter(is_finished=0) + offline = Log.objects.filter(is_finished=1) + web_socket_host = CONF.get('websocket', 'web_socket_host') + return render_to_response('jlog/log_list.html',locals()) + + +def jlog_kill(request, offset): + pid = offset + if pid: + os.kill(int(pid), 9) + Log.objects.filter(pid=pid).update(is_finished=1, end_time=datetime.now()) + return render_to_response('jlog/log_list.html', locals()) \ No newline at end of file diff --git a/jumpserver.conf b/jumpserver.conf index 18364c398..4defe0c11 100644 --- a/jumpserver.conf +++ b/jumpserver.conf @@ -18,6 +18,9 @@ base_dn = dc=jumpserver,dc=org root_dn = cn=admin,dc=jumpserver,dc=org root_pw = secret234 +[websocket] +web_socket_host = 127.0.0.1:3000 + [web] key = 88aaaf7ffe3c6c04 diff --git a/jumpserver/urls.py b/jumpserver/urls.py index 44bb490c8..23af0f8a7 100644 --- a/jumpserver/urls.py +++ b/jumpserver/urls.py @@ -10,5 +10,6 @@ urlpatterns = patterns('', (r'^base/$', 'jumpserver.views.base'), (r'^juser/', include('juser.urls')), (r'^jperm/', include('jpermission.urls')), - url(r'^jasset/', include('jasset.urls')), + (r'^jasset/', include('jasset.urls')), + (r'^jlog/', include('jlog.urls')), ) diff --git a/juser/urls.py b/juser/urls.py index 3712b517f..d9c51dc6f 100644 --- a/juser/urls.py +++ b/juser/urls.py @@ -13,4 +13,7 @@ urlpatterns = patterns('juser.views', (r'^user_detail/$', 'user_detail'), (r'^user_del/$', 'user_del'), (r'^user_edit/$', 'user_edit'), + (r'^group_detail/$', 'group_detail'), + (r'^group_del/$', 'group_del'), + (r'^group_edit/$', 'group_edit'), ) diff --git a/juser/views.py b/juser/views.py index ca34d7b0f..e090dd8ce 100644 --- a/juser/views.py +++ b/juser/views.py @@ -147,11 +147,60 @@ def group_add(request): def group_list(request): - header_title, path1, path2 = '查看属组 | Add Group', 'juser', 'group_list' - groups = UserGroup.objects.all() + header_title, path1, path2 = '查看属组 | Show Group', 'juser', 'group_list' + groups = contact_list = UserGroup.objects.all().order_by('id') + p = paginator = Paginator(contact_list, 10) + + 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) return render_to_response('juser/group_list.html', locals()) +def group_detail(request): + group_id = request.GET.get('id', None) + if not group_id: + return HttpResponseRedirect('/') + group = UserGroup.objects.get(id=group_id) + return render_to_response('juser/group_detail.html', locals()) + + +def group_del(request): + group_id = request.GET.get('id', None) + if not group_id: + return HttpResponseRedirect('/') + group = UserGroup.objects.get(id=group_id) + group.delete() + return HttpResponseRedirect('/juser/group_list/', locals()) + + +def group_edit(request): + error = '' + msg = '' + header_title, path1, path2 = '修改属组 | Edit Group', 'juser', 'group_edit' + if request.method == 'GET': + group_id = request.GET.get('id', None) + group = UserGroup.objects.get(id=group_id) + group_name = group.name + comment = group.comment + + return render_to_response('juser/group_add.html', locals()) + else: + group_id = request.POST.get('group_id', None) + group_name = request.POST.get('group_name', None) + comment = request.POST.get('comment', '') + group = UserGroup.objects.filter(id=group_id) + group.update(name=group_name, comment=comment) + + return HttpResponseRedirect('/juser/group_list/') + + def user_list(request): user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'} header_title, path1, path2 = '查看用户 | Show User', 'juser', 'user_list' @@ -171,30 +220,30 @@ def user_list(request): def user_detail(request): - username = request.GET.get('username', None) - if not username: + user_id = request.GET.get('id', None) + if not user_id: return HttpResponseRedirect('/') - user = User.objects.get(username=username) + user = User.objects.get(id=user_id) return render_to_response('juser/user_detail.html', locals()) def user_del(request): - username = request.GET.get('username', None) - if not username: + user_id = request.GET.get('id', None) + if not user_id: return HttpResponseRedirect('/') - user = User.objects.get(username=username) + user = User.objects.get(id=user_id) user.delete() return HttpResponseRedirect('/juser/user_list/', locals()) def user_edit(request): header_title, path1, path2 = '编辑用户 | Edit User', 'juser', 'user_edit' - hidden = "hidden" + readonly = "readonly" if request.method == 'GET': - username = request.GET.get('username', None) - if not username: + user_id = request.GET.get('id', None) + if not user_id: return HttpResponseRedirect('/') - user = User.objects.get(username=username) + user = User.objects.get(id=user_id) username = user.username password = user.password ssh_key_pwd1 = user.ssh_key_pwd1 diff --git a/logs/connect/20150124/halcyon_192.168.196.73_151728.log b/logs/connect/20150124/halcyon_192.168.196.73_151728.log new file mode 100644 index 000000000..c9ab94eef --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_151728.log @@ -0,0 +1,42 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 05:19:23 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:607 errors:0 dropped:0 overruns:0 frame:0 + TX packets:426 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:62277 (60.8 KiB) TX bytes:52684 (51.4 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.196.73 Bcast:192.168.199.255 Mask:255.255.248.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:28140 errors:0 dropped:0 overruns:0 frame:0 + TX packets:170 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:1908800 (1.8 MiB) TX bytes:20462 (19.9 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ hah +-bash: hah: command not found +[halcyon@192.168.196.73 ~]$ [halcyon@192.168.196.73 ~ ~]$ [halcyon@192.168.196.73 ~]$ [halcyon@192.168.196.73 ~]$ [halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_153312.log b/logs/connect/20150124/halcyon_192.168.196.73_153312.log new file mode 100644 index 000000000..dad90976c --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_153312.log @@ -0,0 +1,44 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 06:59:23 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ ifocnfigconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:616 errors:0 dropped:0 overruns:0 frame:0 + TX packets:431 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63001 (61.5 KiB) TX bytes:53086 (51.8 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.196.73 Bcast:192.168.199.255 Mask:255.255.248.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:32903 errors:0 dropped:0 overruns:0 frame:0 + TX packets:261 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:2226913 (2.1 MiB) TX bytes:31635 (30.8 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ pwd +/home/halcyon +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_155546.log b/logs/connect/20150124/halcyon_192.168.196.73_155546.log new file mode 100644 index 000000000..0e49a0590 --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_155546.log @@ -0,0 +1,8 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 07:15:07 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_155646.log b/logs/connect/20150124/halcyon_192.168.196.73_155646.log new file mode 100644 index 000000000..9dc94bbdb --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_155646.log @@ -0,0 +1,10 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 07:37:41 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_160028.log b/logs/connect/20150124/halcyon_192.168.196.73_160028.log new file mode 100644 index 000000000..c137fca24 --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_160028.log @@ -0,0 +1,8 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 07:38:42 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_160837.log b/logs/connect/20150124/halcyon_192.168.196.73_160837.log new file mode 100644 index 000000000..ccc98f351 --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_160837.log @@ -0,0 +1,8 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 07:42:24 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_161256.log b/logs/connect/20150124/halcyon_192.168.196.73_161256.log new file mode 100644 index 000000000..d42f694ee --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_161256.log @@ -0,0 +1,8 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 07:50:33 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_162208.log b/logs/connect/20150124/halcyon_192.168.196.73_162208.log new file mode 100644 index 000000000..7c1137d2c --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_162208.log @@ -0,0 +1,10 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 07:54:52 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ exit +logout diff --git a/logs/connect/20150124/halcyon_192.168.196.73_162427.log b/logs/connect/20150124/halcyon_192.168.196.73_162427.log new file mode 100644 index 000000000..e06bfecd4 --- /dev/null +++ b/logs/connect/20150124/halcyon_192.168.196.73_162427.log @@ -0,0 +1,169 @@ +PS1='[\u@192.168.196.73 \W]\$ ' +Last login: Sat Jan 24 08:04:04 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ ' +[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m' +Login 192.168.196.73 done. Enjoy it. +[halcyon@192.168.196.73 ~]$ pwd +/home/halcyon +[halcyon@192.168.196.73 ~]$ heh +-bash: heh: command not found +[halcyon@192.168.196.73 ~]$ ls +[halcyon@192.168.196.73 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:616 errors:0 dropped:0 overruns:0 frame:0 + TX packets:431 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63001 (61.5 KiB) TX bytes:53086 (51.8 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.196.73 Bcast:192.168.199.255 Mask:255.255.248.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:53473 errors:0 dropped:0 overruns:0 frame:0 + TX packets:548 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:3543072 (3.3 MiB) TX bytes:72052 (70.3 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.196.73 ~]$ ls +[halcyon@192.168.196.73 ~]$ pwd +/home/halcyon +[halcyon@192.168.196.73 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:616 errors:0 dropped:0 overruns:0 frame:0 + TX packets:431 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63001 (61.5 KiB) TX bytes:53086 (51.8 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.196.73 Bcast:192.168.199.255 Mask:255.255.248.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:54022 errors:0 dropped:0 overruns:0 frame:0 + TX packets:560 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:3583036 (3.4 MiB) TX bytes:73616 (71.8 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.196.73 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:616 errors:0 dropped:0 overruns:0 frame:0 + TX packets:431 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63001 (61.5 KiB) TX bytes:53086 (51.8 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.196.73 Bcast:192.168.199.255 Mask:255.255.248.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:54145 errors:0 dropped:0 overruns:0 frame:0 + TX packets:569 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:3593530 (3.4 MiB) TX bytes:74598 (72.8 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ pwd +/home/halcyon +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:616 errors:0 dropped:0 overruns:0 frame:0 + TX packets:431 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63001 (61.5 KiB) TX bytes:53086 (51.8 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.196.73 Bcast:192.168.199.255 Mask:255.255.248.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:63814 errors:0 dropped:0 overruns:0 frame:0 + TX packets:609 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:4187378 (3.9 MiB) TX bytes:78400 (76.5 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.196.73 ~]$ ll +total 0 +[halcyon@192.168.196.73 ~]$ ifconfgiig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:616 errors:0 dropped:0 overruns:0 frame:0 + TX packets:431 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63001 (61.5 KiB) TX bytes:53086 (51.8 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.196.73 Bcast:192.168.199.255 Mask:255.255.248.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:64147 errors:0 dropped:0 overruns:0 frame:0 + TX packets:631 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:4208452 (4.0 MiB) TX bytes:80576 (78.6 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.196.73 ~]$ \ No newline at end of file diff --git a/logs/connect/20150125/halcyon_192.168.199.158_164308.log b/logs/connect/20150125/halcyon_192.168.199.158_164308.log new file mode 100644 index 000000000..25a7d7448 --- /dev/null +++ b/logs/connect/20150125/halcyon_192.168.199.158_164308.log @@ -0,0 +1,48 @@ +PS1='[\u@192.168.199.158 \W]\$ ' +Last login: Sat Jan 24 08:06:24 2015 from 192.168.192.84 +clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.199.158 \W]\$ ' +[halcyon@192.168.199.158 ~]$ clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +Login 192.168.199.158 done. Enjoy it. +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:584 errors:0 dropped:0 overruns:0 frame:0 + TX packets:384 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:61072 (59.6 KiB) TX bytes:50796 (49.6 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:629 errors:0 dropped:0 overruns:0 frame:0 + TX packets:67 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:41737 (40.7 KiB) TX bytes:8573 (8.3 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ [halcyon@192.168.199.158 ~]$ python +Python 2.6.6 (r266:84292, Nov 22 2013, 12:11:10) +[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 +Type "help", "copyright", "credits" or "license" for more information. +>>> import os +>>> os.systemkill()1)1)1)1)1),) )9) +Traceback (most recent call last): + File "", line 1, in +OSError: [Errno 3] No such process +>>> \ No newline at end of file diff --git a/logs/connect/20150125/halcyon_192.168.199.158_174155.log b/logs/connect/20150125/halcyon_192.168.199.158_174155.log new file mode 100644 index 000000000..015ccc7a0 --- /dev/null +++ b/logs/connect/20150125/halcyon_192.168.199.158_174155.log @@ -0,0 +1,9 @@ +PS1='[\u@192.168.199.158 \W]\$ ' +Last login: Sun Jan 25 08:43:07 2015 from 192.168.199.162 +clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.199.158 \W]\$ ' +[halcyon@192.168.199.158 ~]$ clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +Login 192.168.199.158 done. Enjoy it. +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ \ No newline at end of file diff --git a/logs/connect/20150125/halcyon_192.168.199.158_174601.log b/logs/connect/20150125/halcyon_192.168.199.158_174601.log new file mode 100644 index 000000000..e69de29bb diff --git a/logs/connect/20150125/halcyon_192.168.199.158_175521.log b/logs/connect/20150125/halcyon_192.168.199.158_175521.log new file mode 100644 index 000000000..244d4ff3d --- /dev/null +++ b/logs/connect/20150125/halcyon_192.168.199.158_175521.log @@ -0,0 +1,9 @@ +PS1='[\u@192.168.199.158 \W]\$ ' +Last login: Sun Jan 25 09:46:01 2015 from 192.168.199.162 +clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.199.158 \W]\$ ' +[halcyon@192.168.199.158 ~]$ clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +Login 192.168.199.158 done. Enjoy it. +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ \ No newline at end of file diff --git a/logs/connect/20150125/halcyon_192.168.199.158_175815.log b/logs/connect/20150125/halcyon_192.168.199.158_175815.log new file mode 100644 index 000000000..f17efe6f9 --- /dev/null +++ b/logs/connect/20150125/halcyon_192.168.199.158_175815.log @@ -0,0 +1,382 @@ +Last login: Sun Jan 25 09:55:21 2015 from 192.168.199.162 +PS1='[\u@192.168.199.158 \W]\$ ' +clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +[halcyon@localhost ~]$ PS1='[\u@192.168.199.158 \W]\$ ' +[halcyon@192.168.199.158 ~]$ clear;echo -e '\033[32mLogin 192.168.199.158 done. Enjoy it.\033[0m' +Login 192.168.199.158 done. Enjoy it. +[halcyon@192.168.199.158 ~]$ ls +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:585 errors:0 dropped:0 overruns:0 frame:0 + TX packets:385 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:61132 (59.6 KiB) TX bytes:50850 (49.6 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:3607 errors:0 dropped:0 overruns:0 frame:0 + TX packets:248 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:233475 (228.0 KiB) TX bytes:33863 (33.0 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ [halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ls +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ whoami +halcyon +[halcyon@192.168.199.158 ~]$ whoami +halcyon +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:620 errors:0 dropped:0 overruns:0 frame:0 + TX packets:404 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63648 (62.1 KiB) TX bytes:52568 (51.3 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:4126 errors:0 dropped:0 overruns:0 frame:0 + TX packets:299 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:267291 (261.0 KiB) TX bytes:39201 (38.2 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:620 errors:0 dropped:0 overruns:0 frame:0 + TX packets:404 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63648 (62.1 KiB) TX bytes:52568 (51.3 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:4174 errors:0 dropped:0 overruns:0 frame:0 + TX packets:316 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:270969 (264.6 KiB) TX bytes:40987 (40.0 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ ls +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ haha +-bash: haha: command not found +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:620 errors:0 dropped:0 overruns:0 frame:0 + TX packets:404 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63648 (62.1 KiB) TX bytes:52568 (51.3 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:4485 errors:0 dropped:0 overruns:0 frame:0 + TX packets:357 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:292122 (285.2 KiB) TX bytes:45145 (44.0 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ heh hah haha +-bash: haha: command not found +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ peifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:620 errors:0 dropped:0 overruns:0 frame:0 + TX packets:404 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63648 (62.1 KiB) TX bytes:52568 (51.3 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:4772 errors:0 dropped:0 overruns:0 frame:0 + TX packets:415 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:312810 (305.4 KiB) TX bytes:51037 (49.8 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:620 errors:0 dropped:0 overruns:0 frame:0 + TX packets:404 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63648 (62.1 KiB) TX bytes:52568 (51.3 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:4797 errors:0 dropped:0 overruns:0 frame:0 + TX packets:426 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:314898 (307.5 KiB) TX bytes:52223 (50.9 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ 了l l l +-bash: l: command not found +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:620 errors:0 dropped:0 overruns:0 frame:0 + TX packets:404 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63648 (62.1 KiB) TX bytes:52568 (51.3 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:6033 errors:0 dropped:0 overruns:0 frame:0 + TX packets:458 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:391245 (382.0 KiB) TX bytes:55319 (54.0 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:622 errors:0 dropped:0 overruns:0 frame:0 + TX packets:406 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63768 (62.2 KiB) TX bytes:52664 (51.4 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:8105 errors:0 dropped:0 overruns:0 frame:0 + TX packets:493 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:517625 (505.4 KiB) TX bytes:58821 (57.4 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ ifconfig +eth0 Link encap:Ethernet HWaddr 08:00:27:AE:97:4F + inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feae:974f/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:622 errors:0 dropped:0 overruns:0 frame:0 + TX packets:406 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:63768 (62.2 KiB) TX bytes:52664 (51.4 KiB) + +eth1 Link encap:Ethernet HWaddr 08:00:27:B6:17:22 + inet addr:192.168.199.158 Bcast:192.168.199.255 Mask:255.255.255.0 + inet6 addr: fe80::a00:27ff:feb6:1722/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:8127 errors:0 dropped:0 overruns:0 frame:0 + TX packets:506 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:519597 (507.4 KiB) TX bytes:60123 (58.7 KiB) + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) + +[halcyon@192.168.199.158 ~]$ pwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ hah +-bash: hah: command not found +[halcyon@192.168.199.158 ~]$ chown cd /home/user +halcyon/ vagrant/ +[halcyon@192.168.199.158 ~]$ cd /home/halcyon/ +[halcyon@192.168.199.158 ~]$ ll +total 0 +[halcyon@192.168.199.158 ~]$ toctouch 123 +[halcyon@192.168.199.158 ~]$ touch 123456 +[halcyon@192.168.199.158 ~]$ vim 123456 +[?1h="123456" 0L, 0C~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~ +~0,0-1All-- INSERT --0,1Allt1,2th3hi4is56 i7is89 a101 t2te3es4st51,14All:wq "123456" 1L, 15C written [?1l> +[halcyon@192.168.199.158 ~]$ ll +total 4 +-rw-rw-r--. 1 halcyon halcyon 0 Jan 25 14:00 123 +-rw-rw-r--. 1 halcyon halcyon 15 Jan 25 14:00 123456 +[halcyon@192.168.199.158 ~]$ hahpwd +/home/halcyon +[halcyon@192.168.199.158 ~]$ ll +total 4 +-rw-rw-r--. 1 halcyon halcyon 0 Jan 25 14:00 123 +-rw-rw-r--. 1 halcyon halcyon 15 Jan 25 14:00 123456 +[halcyon@192.168.199.158 ~]$ maybe +-bash: maybe: command not found +[halcyon@192.168.199.158 ~]$ zhunixingfu +-bash: zhunixingfu: command not found +[halcyon@192.168.199.158 ~]$  +Display all 948 possibilities? (y or n) +[halcyon@192.168.199.158 ~]$ pzhuni +-bash: zhuni: command not found +[halcyon@192.168.199.158 ~]$ jf +-bash: jf: command not found +[halcyon@192.168.199.158 ~]$ hahahahah +-bash: hahahahah: command not found +[halcyon@192.168.199.158 ~]$ maybe +-bash: maybe: command not found +[halcyon@192.168.199.158 ~]$ \ No newline at end of file diff --git a/static/js/bootstrap-dialog.js b/static/js/bootstrap-dialog.js new file mode 100644 index 000000000..2cbdcc4b7 --- /dev/null +++ b/static/js/bootstrap-dialog.js @@ -0,0 +1,1089 @@ +/* global define */ + +/* ================================================ + * Make use of Bootstrap's modal more monkey-friendly. + * + * For Bootstrap 3. + * + * javanoob@hotmail.com + * + * https://github.com/nakupanda/bootstrap3-dialog + * + * Licensed under The MIT License. + * ================================================ */ +(function(root, factory) { + + "use strict"; + + // CommonJS module is defined + if (typeof module !== 'undefined' && module.exports) { + module.exports = factory(require('jquery')(root)); + } + // AMD module is defined + else if (typeof define === "function" && define.amd) { + define("bootstrap-dialog", ["jquery"], function($) { + return factory($); + }); + } else { + // planted over the root! + root.BootstrapDialog = factory(root.jQuery); + } + +}(this, function($) { + + "use strict"; + + var BootstrapDialog = function(options) { + this.defaultOptions = $.extend(true, { + id: BootstrapDialog.newGuid(), + buttons: [], + data: {}, + onshow: null, + onshown: null, + onhide: null, + onhidden: null + }, BootstrapDialog.defaultOptions); + this.indexedButtons = {}; + this.registeredButtonHotkeys = {}; + this.draggableData = { + isMouseDown: false, + mouseOffset: {} + }; + this.realized = false; + this.opened = false; + this.initOptions(options); + this.holdThisInstance(); + }; + + /** + * Some constants. + */ + BootstrapDialog.NAMESPACE = 'bootstrap-dialog'; + + BootstrapDialog.TYPE_DEFAULT = 'type-default'; + BootstrapDialog.TYPE_INFO = 'type-info'; + BootstrapDialog.TYPE_PRIMARY = 'type-primary'; + BootstrapDialog.TYPE_SUCCESS = 'type-success'; + BootstrapDialog.TYPE_WARNING = 'type-warning'; + BootstrapDialog.TYPE_DANGER = 'type-danger'; + + BootstrapDialog.DEFAULT_TEXTS = {}; + BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DEFAULT] = 'Information'; + BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_INFO] = 'Information'; + BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_PRIMARY] = 'Information'; + BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_SUCCESS] = 'Success'; + BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_WARNING] = 'Warning'; + BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DANGER] = 'Danger'; + BootstrapDialog.DEFAULT_TEXTS['OK'] = 'OK'; + BootstrapDialog.DEFAULT_TEXTS['CANCEL'] = 'Cancel'; + + BootstrapDialog.SIZE_NORMAL = 'size-normal'; + BootstrapDialog.SIZE_WIDE = 'size-wide'; // size-wide is equal to modal-lg + BootstrapDialog.SIZE_LARGE = 'size-large'; + + BootstrapDialog.BUTTON_SIZES = {}; + BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_NORMAL] = ''; + BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_WIDE] = ''; + BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_LARGE] = 'btn-lg'; + + BootstrapDialog.ICON_SPINNER = 'glyphicon glyphicon-asterisk'; + + BootstrapDialog.ZINDEX_BACKDROP = 1040; + BootstrapDialog.ZINDEX_MODAL = 1050; + + /** + * Default options. + */ + BootstrapDialog.defaultOptions = { + type: BootstrapDialog.TYPE_PRIMARY, + size: BootstrapDialog.SIZE_NORMAL, + cssClass: '', + title: null, + message: null, + nl2br: true, + closable: true, + closeByBackdrop: true, + closeByKeyboard: true, + spinicon: BootstrapDialog.ICON_SPINNER, + autodestroy: true, + draggable: false, + animate: true, + description: '' + }; + + /** + * Config default options. + */ + BootstrapDialog.configDefaultOptions = function(options) { + BootstrapDialog.defaultOptions = $.extend(true, BootstrapDialog.defaultOptions, options); + }; + + /** + * Open / Close all created dialogs all at once. + */ + BootstrapDialog.dialogs = {}; + BootstrapDialog.openAll = function() { + $.each(BootstrapDialog.dialogs, function(id, dialogInstance) { + dialogInstance.open(); + }); + }; + BootstrapDialog.closeAll = function() { + $.each(BootstrapDialog.dialogs, function(id, dialogInstance) { + dialogInstance.close(); + }); + }; + + /** + * Move focus to next visible dialog. + */ + BootstrapDialog.moveFocus = function() { + var lastDialogInstance = null; + $.each(BootstrapDialog.dialogs, function(id, dialogInstance) { + lastDialogInstance = dialogInstance; + }); + if (lastDialogInstance !== null && lastDialogInstance.isRealized()) { + lastDialogInstance.getModal().focus(); + } + }; + + /** + * Show scrollbar if the last visible dialog needs one. + */ + BootstrapDialog.showScrollbar = function() { + var lastDialogInstance = null; + $.each(BootstrapDialog.dialogs, function(id, dialogInstance) { + lastDialogInstance = dialogInstance; + }); + if (lastDialogInstance !== null && lastDialogInstance.isRealized() && lastDialogInstance.isOpened()) { + var bsModal = lastDialogInstance.getModal().data('bs.modal'); + bsModal.checkScrollbar(); + $('body').addClass('modal-open'); + bsModal.setScrollbar(); + } + }; + + BootstrapDialog.prototype = { + constructor: BootstrapDialog, + initOptions: function(options) { + this.options = $.extend(true, this.defaultOptions, options); + + return this; + }, + holdThisInstance: function() { + BootstrapDialog.dialogs[this.getId()] = this; + + return this; + }, + initModalStuff: function() { + this.setModal(this.createModal()) + .setModalDialog(this.createModalDialog()) + .setModalContent(this.createModalContent()) + .setModalHeader(this.createModalHeader()) + .setModalBody(this.createModalBody()) + .setModalFooter(this.createModalFooter()); + + this.getModal().append(this.getModalDialog()); + this.getModalDialog().append(this.getModalContent()); + this.getModalContent() + .append(this.getModalHeader()) + .append(this.getModalBody()) + .append(this.getModalFooter()); + + return this; + }, + createModal: function() { + var $modal = $(''); + $modal.prop('id', this.getId()).attr('aria-labelledby', this.getId() + '_title'); + + return $modal; + }, + getModal: function() { + return this.$modal; + }, + setModal: function($modal) { + this.$modal = $modal; + + return this; + }, + createModalDialog: function() { + return $(''); + }, + getModalDialog: function() { + return this.$modalDialog; + }, + setModalDialog: function($modalDialog) { + this.$modalDialog = $modalDialog; + + return this; + }, + createModalContent: function() { + return $(''); + }, + getModalContent: function() { + return this.$modalContent; + }, + setModalContent: function($modalContent) { + this.$modalContent = $modalContent; + + return this; + }, + createModalHeader: function() { + return $(''); + }, + getModalHeader: function() { + return this.$modalHeader; + }, + setModalHeader: function($modalHeader) { + this.$modalHeader = $modalHeader; + + return this; + }, + createModalBody: function() { + return $(''); + }, + getModalBody: function() { + return this.$modalBody; + }, + setModalBody: function($modalBody) { + this.$modalBody = $modalBody; + + return this; + }, + createModalFooter: function() { + return $(''); + }, + getModalFooter: function() { + return this.$modalFooter; + }, + setModalFooter: function($modalFooter) { + this.$modalFooter = $modalFooter; + + return this; + }, + createDynamicContent: function(rawContent) { + var content = null; + if (typeof rawContent === 'function') { + content = rawContent.call(rawContent, this); + } else { + content = rawContent; + } + if (typeof content === 'string') { + content = this.formatStringContent(content); + } + + return content; + }, + formatStringContent: function(content) { + if (this.options.nl2br) { + return content.replace(/\r\n/g, '
').replace(/[\r\n]/g, '
'); + } + + return content; + }, + setData: function(key, value) { + this.options.data[key] = value; + + return this; + }, + getData: function(key) { + return this.options.data[key]; + }, + setId: function(id) { + this.options.id = id; + + return this; + }, + getId: function() { + return this.options.id; + }, + getType: function() { + return this.options.type; + }, + setType: function(type) { + this.options.type = type; + this.updateType(); + + return this; + }, + updateType: function() { + if (this.isRealized()) { + var types = [BootstrapDialog.TYPE_DEFAULT, + BootstrapDialog.TYPE_INFO, + BootstrapDialog.TYPE_PRIMARY, + BootstrapDialog.TYPE_SUCCESS, + BootstrapDialog.TYPE_WARNING, + BootstrapDialog.TYPE_DANGER]; + + this.getModal().removeClass(types.join(' ')).addClass(this.getType()); + } + + return this; + }, + getSize: function() { + return this.options.size; + }, + setSize: function(size) { + this.options.size = size; + this.updateSize(); + + return this; + }, + updateSize: function() { + if (this.isRealized()) { + var dialog = this; + + // Dialog size + this.getModal().removeClass(BootstrapDialog.SIZE_NORMAL) + .removeClass(BootstrapDialog.SIZE_WIDE) + .removeClass(BootstrapDialog.SIZE_LARGE); + this.getModal().addClass(this.getSize()); + + // Wider dialog. + this.getModalDialog().removeClass('modal-lg'); + if (this.getSize() === BootstrapDialog.SIZE_WIDE) { + this.getModalDialog().addClass('modal-lg'); + } + + // Button size + $.each(this.options.buttons, function(index, button) { + var $button = dialog.getButton(button.id); + var buttonSizes = ['btn-lg', 'btn-sm', 'btn-xs']; + var sizeClassSpecified = false; + if (typeof button['cssClass'] === 'string') { + var btnClasses = button['cssClass'].split(' '); + $.each(btnClasses, function(index, btnClass) { + if ($.inArray(btnClass, buttonSizes) !== -1) { + sizeClassSpecified = true; + } + }); + } + if (!sizeClassSpecified) { + $button.removeClass(buttonSizes.join(' ')); + $button.addClass(dialog.getButtonSize()); + } + }); + } + + return this; + }, + getCssClass: function() { + return this.options.cssClass; + }, + setCssClass: function(cssClass) { + this.options.cssClass = cssClass; + + return this; + }, + getTitle: function() { + return this.options.title; + }, + setTitle: function(title) { + this.options.title = title; + this.updateTitle(); + + return this; + }, + updateTitle: function() { + if (this.isRealized()) { + var title = this.getTitle() !== null ? this.createDynamicContent(this.getTitle()) : this.getDefaultText(); + this.getModalHeader().find('.' + this.getNamespace('title')).html('').append(title).prop('id', this.getId() + '_title'); + } + + return this; + }, + getMessage: function() { + return this.options.message; + }, + setMessage: function(message) { + this.options.message = message; + this.updateMessage(); + + return this; + }, + updateMessage: function() { + if (this.isRealized()) { + var message = this.createDynamicContent(this.getMessage()); + this.getModalBody().find('.' + this.getNamespace('message')).html('').append(message); + } + + return this; + }, + isClosable: function() { + return this.options.closable; + }, + setClosable: function(closable) { + this.options.closable = closable; + this.updateClosable(); + + return this; + }, + setCloseByBackdrop: function(closeByBackdrop) { + this.options.closeByBackdrop = closeByBackdrop; + + return this; + }, + canCloseByBackdrop: function() { + return this.options.closeByBackdrop; + }, + setCloseByKeyboard: function(closeByKeyboard) { + this.options.closeByKeyboard = closeByKeyboard; + + return this; + }, + canCloseByKeyboard: function() { + return this.options.closeByKeyboard; + }, + isAnimate: function() { + return this.options.animate; + }, + setAnimate: function(animate) { + this.options.animate = animate; + + return this; + }, + updateAnimate: function() { + if (this.isRealized()) { + this.getModal().toggleClass('fade', this.isAnimate()); + } + + return this; + }, + getSpinicon: function() { + return this.options.spinicon; + }, + setSpinicon: function(spinicon) { + this.options.spinicon = spinicon; + + return this; + }, + addButton: function(button) { + this.options.buttons.push(button); + + return this; + }, + addButtons: function(buttons) { + var that = this; + $.each(buttons, function(index, button) { + that.addButton(button); + }); + + return this; + }, + getButtons: function() { + return this.options.buttons; + }, + setButtons: function(buttons) { + this.options.buttons = buttons; + this.updateButtons(); + + return this; + }, + /** + * If there is id provided for a button option, it will be in dialog.indexedButtons list. + * + * In that case you can use dialog.getButton(id) to find the button. + * + * @param {type} id + * @returns {undefined} + */ + getButton: function(id) { + if (typeof this.indexedButtons[id] !== 'undefined') { + return this.indexedButtons[id]; + } + + return null; + }, + getButtonSize: function() { + if (typeof BootstrapDialog.BUTTON_SIZES[this.getSize()] !== 'undefined') { + return BootstrapDialog.BUTTON_SIZES[this.getSize()]; + } + + return ''; + }, + updateButtons: function() { + if (this.isRealized()) { + if (this.getButtons().length === 0) { + this.getModalFooter().hide(); + } else { + this.getModalFooter().find('.' + this.getNamespace('footer')).html('').append(this.createFooterButtons()); + } + } + + return this; + }, + isAutodestroy: function() { + return this.options.autodestroy; + }, + setAutodestroy: function(autodestroy) { + this.options.autodestroy = autodestroy; + }, + getDescription: function() { + return this.options.description; + }, + setDescription: function(description) { + this.options.description = description; + + return this; + }, + getDefaultText: function() { + return BootstrapDialog.DEFAULT_TEXTS[this.getType()]; + }, + getNamespace: function(name) { + return BootstrapDialog.NAMESPACE + '-' + name; + }, + createHeaderContent: function() { + var $container = $('
'); + $container.addClass(this.getNamespace('header')); + + // title + $container.append(this.createTitleContent()); + + // Close button + $container.prepend(this.createCloseButton()); + + return $container; + }, + createTitleContent: function() { + var $title = $('
'); + $title.addClass(this.getNamespace('title')); + + return $title; + }, + createCloseButton: function() { + var $container = $('
'); + $container.addClass(this.getNamespace('close-button')); + var $icon = $(''); + $container.append($icon); + $container.on('click', {dialog: this}, function(event) { + event.data.dialog.close(); + }); + + return $container; + }, + createBodyContent: function() { + var $container = $('
'); + $container.addClass(this.getNamespace('body')); + + // Message + $container.append(this.createMessageContent()); + + return $container; + }, + createMessageContent: function() { + var $message = $('
'); + $message.addClass(this.getNamespace('message')); + + return $message; + }, + createFooterContent: function() { + var $container = $('
'); + $container.addClass(this.getNamespace('footer')); + + return $container; + }, + createFooterButtons: function() { + var that = this; + var $container = $('
'); + $container.addClass(this.getNamespace('footer-buttons')); + this.indexedButtons = {}; + $.each(this.options.buttons, function(index, button) { + if (!button.id) { + button.id = BootstrapDialog.newGuid(); + } + var $button = that.createButton(button); + that.indexedButtons[button.id] = $button; + $container.append($button); + }); + + return $container; + }, + createButton: function(button) { + var $button = $(''); + $button.prop('id', button.id); + + // Icon + if (typeof button.icon !== 'undefined' && $.trim(button.icon) !== '') { + $button.append(this.createButtonIcon(button.icon)); + } + + // Label + if (typeof button.label !== 'undefined') { + $button.append(button.label); + } + + // Css class + if (typeof button.cssClass !== 'undefined' && $.trim(button.cssClass) !== '') { + $button.addClass(button.cssClass); + } else { + $button.addClass('btn-default'); + } + + // Hotkey + if (typeof button.hotkey !== 'undefined') { + this.registeredButtonHotkeys[button.hotkey] = $button; + } + + // Button on click + $button.on('click', {dialog: this, $button: $button, button: button}, function(event) { + var dialog = event.data.dialog; + var $button = event.data.$button; + var button = event.data.button; + if (typeof button.action === 'function') { + button.action.call($button, dialog); + } + + if (button.autospin) { + $button.toggleSpin(true); + } + }); + + // Dynamically add extra functions to $button + this.enhanceButton($button); + + return $button; + }, + /** + * Dynamically add extra functions to $button + * + * Using '$this' to reference 'this' is just for better readability. + * + * @param {type} $button + * @returns {_L13.BootstrapDialog.prototype} + */ + enhanceButton: function($button) { + $button.dialog = this; + + // Enable / Disable + $button.toggleEnable = function(enable) { + var $this = this; + if (typeof enable !== 'undefined') { + $this.prop("disabled", !enable).toggleClass('disabled', !enable); + } else { + $this.prop("disabled", !$this.prop("disabled")); + } + + return $this; + }; + $button.enable = function() { + var $this = this; + $this.toggleEnable(true); + + return $this; + }; + $button.disable = function() { + var $this = this; + $this.toggleEnable(false); + + return $this; + }; + + // Icon spinning, helpful for indicating ajax loading status. + $button.toggleSpin = function(spin) { + var $this = this; + var dialog = $this.dialog; + var $icon = $this.find('.' + dialog.getNamespace('button-icon')); + if (typeof spin === 'undefined') { + spin = !($button.find('.icon-spin').length > 0); + } + if (spin) { + $icon.hide(); + $button.prepend(dialog.createButtonIcon(dialog.getSpinicon()).addClass('icon-spin')); + } else { + $icon.show(); + $button.find('.icon-spin').remove(); + } + + return $this; + }; + $button.spin = function() { + var $this = this; + $this.toggleSpin(true); + + return $this; + }; + $button.stopSpin = function() { + var $this = this; + $this.toggleSpin(false); + + return $this; + }; + + return this; + }, + createButtonIcon: function(icon) { + var $icon = $(''); + $icon.addClass(this.getNamespace('button-icon')).addClass(icon); + + return $icon; + }, + /** + * Invoke this only after the dialog is realized. + * + * @param {type} enable + * @returns {undefined} + */ + enableButtons: function(enable) { + $.each(this.indexedButtons, function(id, $button) { + $button.toggleEnable(enable); + }); + + return this; + }, + /** + * Invoke this only after the dialog is realized. + * + * @returns {undefined} + */ + updateClosable: function() { + if (this.isRealized()) { + // Close button + this.getModalHeader().find('.' + this.getNamespace('close-button')).toggle(this.isClosable()); + } + + return this; + }, + /** + * Set handler for modal event 'show.bs.modal'. + * This is a setter! + */ + onShow: function(onshow) { + this.options.onshow = onshow; + + return this; + }, + /** + * Set handler for modal event 'shown.bs.modal'. + * This is a setter! + */ + onShown: function(onshown) { + this.options.onshown = onshown; + + return this; + }, + /** + * Set handler for modal event 'hide.bs.modal'. + * This is a setter! + */ + onHide: function(onhide) { + this.options.onhide = onhide; + + return this; + }, + /** + * Set handler for modal event 'hidden.bs.modal'. + * This is a setter! + */ + onHidden: function(onhidden) { + this.options.onhidden = onhidden; + + return this; + }, + isRealized: function() { + return this.realized; + }, + setRealized: function(realized) { + this.realized = realized; + + return this; + }, + isOpened: function() { + return this.opened; + }, + setOpened: function(opened) { + this.opened = opened; + + return this; + }, + handleModalEvents: function() { + this.getModal().on('show.bs.modal', {dialog: this}, function(event) { + var dialog = event.data.dialog; + if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') { + return dialog.options.onshow(dialog); + } + }); + this.getModal().on('shown.bs.modal', {dialog: this}, function(event) { + var dialog = event.data.dialog; + dialog.isModalEvent(event) && typeof dialog.options.onshown === 'function' && dialog.options.onshown(dialog); + }); + this.getModal().on('hide.bs.modal', {dialog: this}, function(event) { + var dialog = event.data.dialog; + if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') { + return dialog.options.onhide(dialog); + } + }); + this.getModal().on('hidden.bs.modal', {dialog: this}, function(event) { + var dialog = event.data.dialog; + dialog.isModalEvent(event) && typeof dialog.options.onhidden === 'function' && dialog.options.onhidden(dialog); + dialog.isAutodestroy() && $(this).remove(); + BootstrapDialog.moveFocus(); + }); + + // Backdrop, I did't find a way to change bs3 backdrop option after the dialog is popped up, so here's a new wheel. + this.getModal().on('click', {dialog: this}, function(event) { + event.target === this && event.data.dialog.isClosable() && event.data.dialog.canCloseByBackdrop() && event.data.dialog.close(); + }); + + // ESC key support + this.getModal().on('keyup', {dialog: this}, function(event) { + event.which === 27 && event.data.dialog.isClosable() && event.data.dialog.canCloseByKeyboard() && event.data.dialog.close(); + }); + + // Button hotkey + this.getModal().on('keyup', {dialog: this}, function(event) { + var dialog = event.data.dialog; + if (typeof dialog.registeredButtonHotkeys[event.which] !== 'undefined') { + var $button = $(dialog.registeredButtonHotkeys[event.which]); + !$button.prop('disabled') && $button.focus().trigger('click'); + } + }); + + return this; + }, + isModalEvent: function(event) { + return typeof event.namespace !== 'undefined' && event.namespace === 'bs.modal'; + }, + makeModalDraggable: function() { + if (this.options.draggable) { + this.getModalHeader().addClass(this.getNamespace('draggable')).on('mousedown', {dialog: this}, function(event) { + var dialog = event.data.dialog; + dialog.draggableData.isMouseDown = true; + var dialogOffset = dialog.getModalDialog().offset(); + dialog.draggableData.mouseOffset = { + top: event.clientY - dialogOffset.top, + left: event.clientX - dialogOffset.left + }; + }); + this.getModal().on('mouseup mouseleave', {dialog: this}, function(event) { + event.data.dialog.draggableData.isMouseDown = false; + }); + $('body').on('mousemove', {dialog: this}, function(event) { + var dialog = event.data.dialog; + if (!dialog.draggableData.isMouseDown) { + return; + } + dialog.getModalDialog().offset({ + top: event.clientY - dialog.draggableData.mouseOffset.top, + left: event.clientX - dialog.draggableData.mouseOffset.left + }); + }); + } + + return this; + }, + /** + * To make multiple opened dialogs look better. + */ + updateZIndex: function() { + var dialogCount = 0; + $.each(BootstrapDialog.dialogs, function(dialogId, dialogInstance) { + dialogCount++; + }); + var $modal = this.getModal(); + var $backdrop = $modal.data('bs.modal').$backdrop; + $modal.css('z-index', BootstrapDialog.ZINDEX_MODAL + (dialogCount - 1) * 20); + $backdrop.css('z-index', BootstrapDialog.ZINDEX_BACKDROP + (dialogCount - 1) * 20); + + return this; + }, + realize: function() { + this.initModalStuff(); + this.getModal().addClass(BootstrapDialog.NAMESPACE) + .addClass(this.getCssClass()); + this.updateSize(); + if (this.getDescription()) { + this.getModal().attr('aria-describedby', this.getDescription()); + } + this.getModalFooter().append(this.createFooterContent()); + this.getModalHeader().append(this.createHeaderContent()); + this.getModalBody().append(this.createBodyContent()); + this.getModal().modal({ + backdrop: 'static', + keyboard: false, + show: false + }); + this.makeModalDraggable(); + this.handleModalEvents(); + this.setRealized(true); + this.updateButtons(); + this.updateType(); + this.updateTitle(); + this.updateMessage(); + this.updateClosable(); + this.updateAnimate(); + this.updateSize(); + + return this; + }, + open: function() { + !this.isRealized() && this.realize(); + this.getModal().modal('show'); + this.updateZIndex(); + this.setOpened(true); + + return this; + }, + close: function() { + this.getModal().modal('hide'); + if (this.isAutodestroy()) { + delete BootstrapDialog.dialogs[this.getId()]; + } + this.setOpened(false); + + // Show scrollbar if the last visible dialog needs one. + BootstrapDialog.showScrollbar(); + + return this; + } + }; + + /** + * RFC4122 version 4 compliant unique id creator. + * + * Added by https://github.com/tufanbarisyildirim/ + * + * @returns {String} + */ + BootstrapDialog.newGuid = function() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); + }; + + /* ================================================ + * For lazy people + * ================================================ */ + + /** + * Shortcut function: show + * + * @param {type} options + * @returns the created dialog instance + */ + BootstrapDialog.show = function(options) { + return new BootstrapDialog(options).open(); + }; + + /** + * Alert window + * + * @returns the created dialog instance + */ + BootstrapDialog.alert = function() { + var options = {}; + var defaultOptions = { + type: BootstrapDialog.TYPE_PRIMARY, + title: null, + message: null, + closable: true, + buttonLabel: BootstrapDialog.DEFAULT_TEXTS.OK, + callback: null + }; + + if (typeof arguments[0] === 'object' && arguments[0].constructor === {}.constructor) { + options = $.extend(true, defaultOptions, arguments[0]); + } else { + options = $.extend(true, defaultOptions, { + message: arguments[0], + closable: false, + buttonLabel: BootstrapDialog.DEFAULT_TEXTS.OK, + callback: typeof arguments[1] !== 'undefined' ? arguments[1] : null + }); + } + + return new BootstrapDialog({ + type: options.type, + title: options.title, + message: options.message, + closable: options.closable, + data: { + callback: options.callback + }, + onhide: function(dialog) { + !dialog.getData('btnClicked') && dialog.isClosable() && typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(false); + }, + buttons: [{ + label: options.buttonLabel, + action: function(dialog) { + dialog.setData('btnClicked', true); + typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true); + dialog.close(); + } + }] + }).open(); + }; + + /** + * Confirm window + * + * @param {type} message + * @param {type} callback + * @returns the created dialog instance + */ + BootstrapDialog.confirm = function(message, callback) { + return new BootstrapDialog({ + title: 'Confirmation', + message: message, + closable: false, + data: { + 'callback': callback + }, + buttons: [{ + label: BootstrapDialog.DEFAULT_TEXTS.CANCEL, + action: function(dialog) { + typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(false); + dialog.close(); + } + }, { + label: BootstrapDialog.DEFAULT_TEXTS.OK, + cssClass: 'btn-primary', + action: function(dialog) { + typeof dialog.getData('callback') === 'function' && dialog.getData('callback')(true); + dialog.close(); + } + }] + }).open(); + }; + + /** + * Warning window + * + * @param {type} message + * @returns the created dialog instance + */ + BootstrapDialog.warning = function(message, callback) { + return new BootstrapDialog({ + type: BootstrapDialog.TYPE_WARNING, + message: message + }).open(); + }; + + /** + * Danger window + * + * @param {type} message + * @returns the created dialog instance + */ + BootstrapDialog.danger = function(message, callback) { + return new BootstrapDialog({ + type: BootstrapDialog.TYPE_DANGER, + message: message + }).open(); + }; + + /** + * Success window + * + * @param {type} message + * @returns the created dialog instance + */ + BootstrapDialog.success = function(message, callback) { + return new BootstrapDialog({ + type: BootstrapDialog.TYPE_SUCCESS, + message: message + }).open(); + }; + + return BootstrapDialog; + +})); diff --git a/templates/jasset/host_list.html b/templates/jasset/host_list.html index 58e28733f..cc6707490 100644 --- a/templates/jasset/host_list.html +++ b/templates/jasset/host_list.html @@ -60,7 +60,7 @@ {{ group }} {% endfor %} - {{ post.date_added }} + {{ post.date_added|date:"Y-m-d H:i:s" }} {{ post.comment }} 详情 diff --git a/templates/jlog/log_list.html b/templates/jlog/log_list.html new file mode 100644 index 000000000..6517caf51 --- /dev/null +++ b/templates/jlog/log_list.html @@ -0,0 +1,151 @@ +{% extends 'base.html' %} +{% block content %} +{% include 'nav_cat_bar.html' %} + + +
+
+
+
+

用户日志详细信息列表

+ +
+
+
+
+
+ + + + + + + + + + + + + + {% for post in online %} + + + + + + + + + {% endfor %} + +
用户名 登录主机 实时监控 阻断 登录时间 结束时间
{{ post.user.name }} {{ post.asset.ip }} 监控 阻断 {{ post.start_time|date:"Y-m-d H:i:s" }} {{ post.end_time|date:"Y-m-d H:i:s" }}
+
+
+
+
+ + + + + + + + + + + + + {% for post in offline %} + + + + + + + + {% endfor %} + +
用户名 登录主机 命令统计 登录时间 结束时间
{{ post.user.name }} {{ post.asset.ip }} 命令统计 {{ post.start_time|date:"Y-m-d H:i:s"}} {{ post.end_time|date:"Y-m-d H:i:s" }}
+
+
+
+

This is tab-2

+
+
+
+
+
+
+ + + + +{% endblock %} \ No newline at end of file diff --git a/templates/juser/group_add.html b/templates/juser/group_add.html index da5481b35..6e4fa6559 100644 --- a/templates/juser/group_add.html +++ b/templates/juser/group_add.html @@ -34,17 +34,23 @@ {% if msg %}
{{ msg }}
{% endif %} +
- +
- +
diff --git a/templates/juser/group_detail.html b/templates/juser/group_detail.html new file mode 100644 index 000000000..9b906ccc0 --- /dev/null +++ b/templates/juser/group_detail.html @@ -0,0 +1,44 @@ +{% load mytags %} + + + {% include 'link_css.html' %} + + + + + +
+
+

{{ group.name }} 属组详情

+
+ + + + + + + + + + + + + + + + + + + + + +
属组详情
ID{{ group.id }}
组名{{ group.name }}
备注{{ group_comment }}
+
+
+ + \ No newline at end of file diff --git a/templates/juser/group_list.html b/templates/juser/group_list.html index 19eedb3d1..086dd43d2 100644 --- a/templates/juser/group_list.html +++ b/templates/juser/group_list.html @@ -1,71 +1,112 @@ {% extends 'base.html' %} - +{% load mytags %} {% block content %} - {% include 'nav_cat_bar.html' %} -
-
-
-
-
-
属组信息 show group info.
- +{% include 'nav_cat_bar.html' %} + +
+
+
+
+
+
查看分组 show group info.
+ -
-
- - - - - - - - - - - {% for group in groups %} - - - - - - - {% endfor %} - -
-
- -
-
ID组名备注
-
- -
-
{{ group.id }}{{ group.name }}{{ group.comment }}
-
-
- - -
+
+ +
+ + + + + + + + + + + + + + {% for group in contacts.object_list %} + + + + + + + + {% endfor %} + +
ID组名备注操作
{{ group.id }} {{ group.name }} {{ group.comment }} + 详情 + 编辑 + 删除 +
+
+
+
+ Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
- +
+
+
+
    + {% if contacts.has_previous %} + + {% else %} + + {% endif %} + {% for page in p.page_range %} + {% ifequal offset1 page %} +
  • {{ page }}
  • + {% else %} +
  • {{ page }}
  • + {% endifequal %} + {% endfor %} + {% if contacts.has_next %} + + {% else %} + + {% endif %} +
+
+
+
+ + + {% endblock %} \ No newline at end of file diff --git a/templates/juser/user_add.html b/templates/juser/user_add.html index 4825d2add..657792157 100644 --- a/templates/juser/user_add.html +++ b/templates/juser/user_add.html @@ -35,10 +35,10 @@ {% if msg %}
{{ msg }}
{% endif %} -