2015-04-20 02:12:11 +00:00
|
|
|
{% extends 'base.html' %}
|
2015-11-06 02:42:10 +00:00
|
|
|
{% block self_head_css_js %}
|
|
|
|
<style>
|
|
|
|
.terminal {
|
|
|
|
border: #000 solid 5px;
|
|
|
|
font-family: "Monaco", "DejaVu Sans Mono", "Liberation Mono", monospace;
|
|
|
|
font-size: 11px;
|
|
|
|
color: #f0f0f0;
|
|
|
|
background: rgba(0, 0, 0, 0.6);
|
|
|
|
width: 600px;
|
|
|
|
box-shadow: rgba(0, 0, 0, 0.6) 2px 2px 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.reverse-video {
|
|
|
|
color: #000;
|
|
|
|
background: #f0f0f0;
|
|
|
|
}
|
|
|
|
|
2015-04-20 02:12:11 +00:00
|
|
|
.bootstrap-dialog-body {
|
|
|
|
background-color: rgba(0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
.bootstrap-dialog-message {
|
2015-11-04 07:11:14 +00:00
|
|
|
color: #00FF00;
|
2015-04-20 02:12:11 +00:00
|
|
|
}
|
|
|
|
.pre-class {
|
|
|
|
background-color: rgba(0, 0, 0, 1);
|
|
|
|
}
|
|
|
|
.modal-content {
|
2015-11-06 02:42:10 +00:00
|
|
|
background-color: #000;
|
2015-04-20 02:12:11 +00:00
|
|
|
}
|
|
|
|
.modal-dialog {
|
|
|
|
background-color: rgba(0, 0, 0, 0);
|
|
|
|
width: 800px;
|
|
|
|
}
|
|
|
|
.modal-body {
|
|
|
|
background-color: rgba(0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
.modal-header {
|
|
|
|
background-color: #FFFFFF;
|
|
|
|
}
|
2015-11-06 02:42:10 +00:00
|
|
|
</style>
|
|
|
|
<script src="/static/js/term.js"></script>
|
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
{% include 'nav_cat_bar.html' %}
|
2015-04-20 02:12:11 +00:00
|
|
|
|
|
|
|
<div class="wrapper wrapper-content animated fadeInRight">
|
|
|
|
<div class="row">
|
2015-12-03 10:37:18 +00:00
|
|
|
<div class="col-sm-12">
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div id="ibox-content" class="ibox-title">
|
2015-11-24 08:31:06 +00:00
|
|
|
<h5> 用户日志详细信息列表 </h5>
|
2015-04-20 02:12:11 +00:00
|
|
|
<div class="ibox-tools">
|
|
|
|
<a class="collapse-link">
|
|
|
|
<i class="fa fa-chevron-up"></i>
|
|
|
|
</a>
|
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
|
|
|
<i class="fa fa-wrench"></i>
|
|
|
|
</a>
|
|
|
|
<a class="close-link">
|
|
|
|
<i class="fa fa-times"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="ibox-content">
|
|
|
|
<div class="panel-options">
|
|
|
|
<ul class="nav nav-tabs">
|
|
|
|
<li class="active"><a href="/jlog/log_list/online/" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
|
|
|
|
<li><a href="/jlog/log_list/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
|
2015-12-03 11:10:37 +00:00
|
|
|
<li><a href="/jlog/log_list/exec/" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
|
2015-12-03 15:24:34 +00:00
|
|
|
<li><a href="/jlog/log_list/file/" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
|
2015-04-20 02:12:11 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<div class="tab-content">
|
|
|
|
<table class="table table-striped table-bordered table-hover ">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2015-11-27 08:16:38 +00:00
|
|
|
<th class="text-center"> ID </th>
|
2015-04-20 02:12:11 +00:00
|
|
|
<th class="text-center"> 用户名 </th>
|
|
|
|
<th class="text-center"> 登录主机 </th>
|
|
|
|
<th class="text-center"> 来源IP </th>
|
2015-11-26 11:49:23 +00:00
|
|
|
<th class="text-center"> 登录方式 </th>
|
|
|
|
<th class="text-center"> 命令 </th>
|
2015-11-23 15:07:58 +00:00
|
|
|
<th class="text-center"> 实时监控 </th>
|
|
|
|
<th class="text-center"> 阻断 </th>
|
2015-04-20 02:12:11 +00:00
|
|
|
<th class="text-center"> 登录时间 </th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for post in contacts.object_list %}
|
|
|
|
<tr class="gradeX">
|
2015-11-27 08:16:38 +00:00
|
|
|
<td class="text-center">{{ post.id }}</td>
|
2015-04-20 02:12:11 +00:00
|
|
|
<td id="username" class="text-center"> {{ post.user }} </td>
|
|
|
|
<td id="ip" class="text-center"> {{ post.host }} </td>
|
|
|
|
<td id="remote_ip" class="text-center"> {{ post.remote_ip }} </td>
|
2015-11-26 11:49:23 +00:00
|
|
|
<td class="text-center"> {{ post.login_type }} </td>
|
|
|
|
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 统计 </a></td>
|
2015-11-23 15:07:58 +00:00
|
|
|
<td class="text-center"><a class="monitor" file_path="{{ post.log_path }}"> 监控 </a></td>
|
2015-11-29 03:33:19 +00:00
|
|
|
<td class="text-center"><input type="button" id="cut" class="btn btn-danger btn-xs" name="cut" value="阻断" onclick='cut("{{ post.pid }}", "{{ post.login_type }}")' /></td>
|
2015-11-04 07:11:14 +00:00
|
|
|
<td class="text-center" id="start_time"> {{ post.start_time|date:"Y-m-d H:i:s" }} </td>
|
2015-04-20 02:12:11 +00:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-6"></div>
|
|
|
|
{% include 'paginator.html' %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2015-11-02 15:20:40 +00:00
|
|
|
{#<script src="http://{{ web_socket_host }}/socket.io/socket.io.js"></script>#}
|
2015-04-20 02:12:11 +00:00
|
|
|
<script>
|
2015-11-03 11:12:15 +00:00
|
|
|
{# $(document).ready(function(){#}
|
|
|
|
{# $('.monitor').click(function(){#}
|
|
|
|
{# window.open('/jlog/monitor/', '监控', 'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');#}
|
|
|
|
{# })#}
|
|
|
|
{# });#}
|
|
|
|
function init(obj){
|
|
|
|
var file_path = obj.attr('file_path');
|
2015-11-05 12:07:21 +00:00
|
|
|
var wsUri = '{{ web_monitor_uri }}';
|
2015-11-04 07:11:14 +00:00
|
|
|
var socket = new WebSocket(wsUri + '?file_path=' + file_path);
|
2015-11-07 05:38:50 +00:00
|
|
|
|
|
|
|
var term = new Terminal({
|
|
|
|
cols: 80,
|
|
|
|
rows: 24,
|
|
|
|
screenKeys: false
|
|
|
|
});
|
|
|
|
|
|
|
|
var tag = $('<div id="term" style="height:500px; overflow: auto;background-color: rgba(0, 0, 0, 0);border: none"></div>');
|
|
|
|
term.open();
|
|
|
|
term.resize(80, 24);
|
|
|
|
|
2015-11-03 11:12:15 +00:00
|
|
|
socket.onopen = function(evt){
|
2015-11-07 05:38:50 +00:00
|
|
|
socket.send('hello');
|
|
|
|
term.write('~.~ Connect WebSocket Success.~.~ \r\n');
|
2015-11-03 11:12:15 +00:00
|
|
|
};
|
|
|
|
|
2015-11-03 15:03:31 +00:00
|
|
|
window.onbeforeunload = function(){
|
|
|
|
socket.close()
|
|
|
|
};
|
|
|
|
|
2015-11-03 11:12:15 +00:00
|
|
|
var username = obj.closest('tr').find('#username').text();
|
|
|
|
var ip = obj.closest('tr').find('#ip').text();
|
|
|
|
|
2015-11-06 02:42:10 +00:00
|
|
|
BootstrapDialog.show({message: function(){
|
2015-11-03 11:12:15 +00:00
|
|
|
//服务器端认证
|
|
|
|
{# socket.send('login', {userid:message.id, filename:message.filename,username:username,seed:seed});#}
|
2015-11-06 02:42:10 +00:00
|
|
|
window.setTimeout(function(){
|
|
|
|
$('.terminal').detach().appendTo('#term');
|
|
|
|
socket.onmessage = function(evt){
|
|
|
|
term.write(evt.data);
|
|
|
|
}}, 1000);
|
|
|
|
|
2015-11-03 11:12:15 +00:00
|
|
|
return tag[0];
|
|
|
|
} ,
|
|
|
|
title:'Jumpserver实时监控 '+' 登录用户名: '+'<span class="text-info">'+username+'</span>'+' 登录主机: '+'<span class="text-info">'+ip,
|
|
|
|
onhide:function(){
|
|
|
|
socket.close();
|
|
|
|
}});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('.monitor').click(function(){
|
2015-11-06 02:42:10 +00:00
|
|
|
init($(this));
|
2015-04-20 02:12:11 +00:00
|
|
|
});
|
|
|
|
|
2015-11-04 07:11:14 +00:00
|
|
|
$('.log_command').on('click',function(){
|
2015-10-27 12:25:18 +00:00
|
|
|
var url = $(this).attr('href');
|
2015-11-04 07:11:14 +00:00
|
|
|
var username = $(this).closest('tr').find('#username').text();
|
|
|
|
var ip = $(this).closest('tr').find('#ip').text();
|
|
|
|
var start_time = $(this).closest('tr').find('#start_time').text();
|
2015-10-27 12:25:18 +00:00
|
|
|
var div_username = ' 用户名: '+'<span class="text-info">'+username+'' + '</span>';
|
|
|
|
var div_ip = ' 主机: '+'<span class="text-info">' + ip + '</span>';
|
2015-11-04 07:11:14 +00:00
|
|
|
var div_time = ' 开始时间: ' + '<span class="text-info">'+start_time +'</span>' + '</span>';
|
2015-10-27 12:25:18 +00:00
|
|
|
var title = 'JumpServer命令统计 '+ div_username + div_ip + div_time;
|
|
|
|
$.ajax({url:url,
|
|
|
|
success:function(data){
|
|
|
|
var tag = $('<div style="height: 500px;overflow: auto;background-color: rgba(0, 0, 0, 0);"></div>').html(data.replace(/\n/g,"<br />"));
|
|
|
|
BootstrapDialog.show({title: title, message:tag[0]});
|
|
|
|
}});
|
|
|
|
return false;
|
|
|
|
});
|
2015-11-03 11:12:15 +00:00
|
|
|
});
|
2015-10-27 12:25:18 +00:00
|
|
|
|
2015-11-29 03:33:19 +00:00
|
|
|
function cut(num, login_type){
|
|
|
|
console.log(login_type);
|
|
|
|
if (login_type=='web'){
|
2015-11-07 07:27:49 +00:00
|
|
|
var g_url = '{{ web_kill_uri }}' + '?id=' + num;
|
|
|
|
} else {
|
2015-11-24 08:31:06 +00:00
|
|
|
var g_url = "/jlog/log_kill/?id=" + num;
|
2015-11-07 07:27:49 +00:00
|
|
|
}
|
|
|
|
|
2015-04-20 02:12:11 +00:00
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
2015-11-24 08:31:06 +00:00
|
|
|
url: g_url+"&sessionid={{ session_id }}",
|
2015-04-23 03:20:12 +00:00
|
|
|
success: window.open("/jlog/log_list/online/", "_self")
|
2015-04-20 02:12:11 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|