mirror of https://github.com/tp4a/teleport
审计页面支持过滤搜索。
parent
4b685c380d
commit
21c2432f29
|
@ -37,6 +37,7 @@
|
|||
<file url="file://$PROJECT_DIR$/server/tp_core/core/main.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/core/tp_tpp_mgr.h" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_crypto.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_crypto.h" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_env.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_http_rpc.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/core/ts_http_rpc.h" charset="GBK" />
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,13 +1,43 @@
|
|||
"use strict";
|
||||
|
||||
const FILTER_TIME_TYPE_ALL = 0;
|
||||
const FILTER_TIME_TYPE_TODAY = 1;
|
||||
const FILTER_TIME_TYPE_WEEK = 2;
|
||||
const FILTER_TIME_TYPE_MONTH = 3;
|
||||
const FILTER_TIME_TYPE_CUSTOMER = 4;
|
||||
|
||||
$app.on_init = function (cb_stack) {
|
||||
$app.dom = {
|
||||
storage_info: $('#storage-info'),
|
||||
btn_refresh_record: $('#btn-refresh-record')
|
||||
btn_refresh_record: $('#btn-refresh-record'),
|
||||
btn_toggle_filter: $('#btn-toggle-filter'),
|
||||
|
||||
filter_area: $('#filter-area'),
|
||||
filter_time_customer_area: $('#filter-time-customer-area'),
|
||||
filter_time_all: $('#filter-btn-time-all'),
|
||||
filter_time_today: $('#filter-btn-time-today'),
|
||||
filter_time_week: $('#filter-btn-time-week'),
|
||||
filter_time_month: $('#filter-btn-time-month'),
|
||||
filter_time_customer: $('#filter-btn-time-customer'),
|
||||
filter_time_from: $('#filter-time-from'),
|
||||
filter_time_to: $('#filter-time-to'),
|
||||
|
||||
filter_protocol: $('#filter-protocol-type'),
|
||||
filter_session_id: $('#filter-session-id'),
|
||||
filter_remote_host_addr: $('#filter-remote-host-addr'),
|
||||
filter_remote_acc: $('#filter-remote-acc'),
|
||||
filter_client_ip: $('#filter-client-ip'),
|
||||
filter_tp_user: $('#filter-tp-user'),
|
||||
|
||||
btn_search: $('#btn-search'),
|
||||
btn_reset_filter: $('#btn-reset-filter')
|
||||
};
|
||||
|
||||
$app.dom.storage_info.html('总 ' + tp_size2str($app.options.total_size, 2) + ',' + '可用 ' + tp_size2str($app.options.free_size, 2));
|
||||
|
||||
$app.filter_shown = true;
|
||||
$app.filter_time_type = FILTER_TIME_TYPE_ALL;
|
||||
|
||||
cb_stack
|
||||
.add($app.create_controls)
|
||||
.add($app.load_role_list);
|
||||
|
@ -15,6 +45,79 @@ $app.on_init = function (cb_stack) {
|
|||
cb_stack.exec();
|
||||
};
|
||||
|
||||
$app.create_table_record_filter = function (tbl) {
|
||||
let _tblf = {};
|
||||
_tblf._table_ctrl = tbl;
|
||||
|
||||
_tblf._table_ctrl.add_filter_ctrl('record_filter', _tblf);
|
||||
|
||||
// _tblf.init = function (cb_stack) {
|
||||
// cb_stack.exec();
|
||||
// };
|
||||
|
||||
_tblf.get_filter = function () {
|
||||
let ret = {};
|
||||
ret['time_type'] = $app.filter_time_type;
|
||||
|
||||
if ($app.filter_time_type === FILTER_TIME_TYPE_ALL) {
|
||||
// no filter for time.
|
||||
} else if ($app.filter_time_type === FILTER_TIME_TYPE_TODAY) {
|
||||
ret['time_from'] = Math.floor(new Date((new Date().setHours(0, 0, 0, 0))).getTime() / 1000);
|
||||
ret['time_to'] = Math.floor(new Date((new Date().setHours(23, 59, 59, 999))).getTime() / 1000);
|
||||
} else if ($app.filter_time_type === FILTER_TIME_TYPE_WEEK) {
|
||||
let now = new Date();
|
||||
let thisYear = now.getFullYear();
|
||||
let thisMonth = now.getMonth();
|
||||
let thisDay = now.getDate();
|
||||
let thisDayOfWeek = now.getDay();
|
||||
let weekStart = new Date(thisYear, thisMonth, thisDay - thisDayOfWeek + 1);
|
||||
let weekEnd = new Date(thisYear, thisMonth, thisDay + (7 - thisDayOfWeek), 23, 59, 59, 999);
|
||||
ret['time_from'] = Math.floor(weekStart.getTime() / 1000);
|
||||
ret['time_to'] = Math.floor(weekEnd.getTime() / 1000);
|
||||
} else if ($app.filter_time_type === FILTER_TIME_TYPE_MONTH) {
|
||||
let now = new Date();
|
||||
let thisYear = now.getFullYear();
|
||||
let thisMonth = now.getMonth();
|
||||
let monthStart = new Date(thisYear, thisMonth, 1);
|
||||
let nextMonthStart = new Date(thisYear, thisMonth + 1, 1);
|
||||
let days = (nextMonthStart - monthStart) / (1000 * 60 * 60 * 24);
|
||||
let monthEnd = new Date(thisYear, thisMonth, days, 23, 59, 59, 999);
|
||||
ret['time_from'] = Math.floor(monthStart.getTime() / 1000);
|
||||
ret['time_to'] = Math.floor(monthEnd.getTime() / 1000);
|
||||
} else if ($app.filter_time_type === FILTER_TIME_TYPE_CUSTOMER) {
|
||||
let start_time = $app.dom.filter_time_from.find('input').val();
|
||||
let end_time = $app.dom.filter_time_to.find('input').val();
|
||||
if (start_time.length > 0)
|
||||
ret['time_from'] = Math.floor(new Date(start_time).getTime() / 1000);
|
||||
if (end_time.length > 0)
|
||||
ret['time_to'] = Math.floor(new Date(end_time).getTime() / 1000);
|
||||
}
|
||||
|
||||
ret['protocol'] = parseInt($app.dom.filter_protocol.val());
|
||||
|
||||
let client_ip = $app.dom.filter_client_ip.val().trim();
|
||||
let remote_addr = $app.dom.filter_remote_host_addr.val().trim();
|
||||
let session_id = $app.dom.filter_session_id.val().trim();
|
||||
let remote_acc = $app.dom.filter_remote_acc.val().trim();
|
||||
let tp_user = $app.dom.filter_tp_user.val().trim();
|
||||
|
||||
if (client_ip.length > 0)
|
||||
ret['client_ip'] = client_ip;
|
||||
if (remote_addr.length > 0)
|
||||
ret['remote_addr'] = remote_addr;
|
||||
if (session_id.length > 0)
|
||||
ret['sid'] = session_id;
|
||||
if (remote_acc.length > 0)
|
||||
ret['remote_acc'] = remote_acc;
|
||||
if (tp_user.length > 0)
|
||||
ret['user_name'] = tp_user;
|
||||
|
||||
console.log('get-filter:', ret);
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//===================================
|
||||
// 创建页面控件对象
|
||||
//===================================
|
||||
|
@ -126,6 +229,7 @@ $app.create_controls = function (cb_stack) {
|
|||
// });
|
||||
// $app.table_record_role_filter = $tp.create_table_filter_role($app.table_record, $app.role_list);
|
||||
// $tp.create_table_header_filter_state($app.table_record, 'state', $app.obj_states, [TP_STATE_LOCKED]);
|
||||
$app.create_table_record_filter($app.table_record);
|
||||
// 从cookie中读取用户分页限制的选择
|
||||
$tp.create_table_paging($app.table_record, 'table-record-paging',
|
||||
{
|
||||
|
@ -143,6 +247,99 @@ $app.create_controls = function (cb_stack) {
|
|||
$app.table_record.load_data();
|
||||
});
|
||||
|
||||
// 切换过滤器显示
|
||||
$app.dom.btn_toggle_filter.click(function () {
|
||||
if ($app.filter_shown) {
|
||||
$app.dom.filter_area.hide('fast', function () {
|
||||
$app.filter_shown = false;
|
||||
$app.dom.btn_toggle_filter.text('显示过滤器');
|
||||
});
|
||||
} else {
|
||||
$app.dom.filter_area.show('fast', function () {
|
||||
$app.filter_shown = true;
|
||||
$app.dom.btn_toggle_filter.text('隐藏过滤器');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 时间选择按钮
|
||||
$app._switch_filter_time_type = function (dom, filter_type) {
|
||||
console.log(dom, filter_type);
|
||||
$app.dom.filter_time_all.removeClass('btn-info').addClass('btn-default');
|
||||
$app.dom.filter_time_today.removeClass('btn-info').addClass('btn-default');
|
||||
$app.dom.filter_time_week.removeClass('btn-info').addClass('btn-default');
|
||||
$app.dom.filter_time_month.removeClass('btn-info').addClass('btn-default');
|
||||
$app.dom.filter_time_customer.removeClass('btn-info').addClass('btn-default');
|
||||
|
||||
dom.removeClass('btn-default').addClass('btn-info');
|
||||
$app.filter_time_type = filter_type;
|
||||
|
||||
if (filter_type === FILTER_TIME_TYPE_CUSTOMER)
|
||||
$app.dom.filter_time_customer_area.show('fast');
|
||||
else
|
||||
$app.dom.filter_time_customer_area.hide('fast');
|
||||
};
|
||||
$app.dom.filter_time_all.click(function () {
|
||||
$app._switch_filter_time_type($(this), FILTER_TIME_TYPE_ALL);
|
||||
});
|
||||
$app.dom.filter_time_today.click(function () {
|
||||
$app._switch_filter_time_type($(this), FILTER_TIME_TYPE_TODAY);
|
||||
});
|
||||
$app.dom.filter_time_week.click(function () {
|
||||
$app._switch_filter_time_type($(this), FILTER_TIME_TYPE_WEEK);
|
||||
});
|
||||
$app.dom.filter_time_month.click(function () {
|
||||
$app._switch_filter_time_type($(this), FILTER_TIME_TYPE_MONTH);
|
||||
});
|
||||
$app.dom.filter_time_customer.click(function () {
|
||||
$app._switch_filter_time_type($(this), FILTER_TIME_TYPE_CUSTOMER);
|
||||
});
|
||||
|
||||
// 时间选择框
|
||||
$app.dom.filter_time_from.datetimepicker({format: "yyyy-mm-dd hh:ii", autoclose: true, todayHighlight: true, todayBtn: true, language: "zh-CN"});
|
||||
$app.dom.filter_time_to.datetimepicker({format: "yyyy-mm-dd hh:ii", autoclose: true, todayHighlight: true, todayBtn: true, language: "zh-CN"});
|
||||
$app._on_filter_time_changed = function () {
|
||||
let start_time = $app.dom.filter_time_from.find('input').val();
|
||||
let end_time = $app.dom.filter_time_to.find('input').val();
|
||||
|
||||
if (start_time === '')
|
||||
$app.dom.filter_time_to.datetimepicker('setStartDate', '1970-01-01 00:00');
|
||||
else
|
||||
$app.dom.filter_time_to.datetimepicker('setStartDate', start_time);
|
||||
|
||||
if (end_time === '')
|
||||
$app.dom.filter_time_from.datetimepicker('setEndDate', '9999-12-30 23:59');
|
||||
else
|
||||
$app.dom.filter_time_from.datetimepicker('setEndDate', end_time);
|
||||
|
||||
// if (start_time !== '' && end_time !== '')
|
||||
// $app._switch_filter_time_type(null, FILTER_TIME_TYPE_CUSTOMER);
|
||||
|
||||
};
|
||||
$app.dom.filter_time_from.on('changeDate', function (ev) {
|
||||
$app._on_filter_time_changed();
|
||||
});
|
||||
$app.dom.filter_time_to.on('changeDate', function (ev) {
|
||||
$app._on_filter_time_changed();
|
||||
});
|
||||
|
||||
// 查询
|
||||
$app.dom.btn_search.click(function () {
|
||||
$app.table_record.load_data(CALLBACK_STACK.create(), {});
|
||||
});
|
||||
// 重置过滤器
|
||||
$app.dom.btn_reset_filter.click(function () {
|
||||
$app._switch_filter_time_type($app.dom.filter_time_all, FILTER_TIME_TYPE_ALL);
|
||||
$app.dom.filter_protocol.val(0);
|
||||
$app.dom.filter_client_ip.val('');
|
||||
$app.dom.filter_remote_host_addr.val('');
|
||||
$app.dom.filter_session_id.val('');
|
||||
$app.dom.filter_remote_acc.val('');
|
||||
$app.dom.filter_tp_user.val('');
|
||||
|
||||
$app.table_record.load_data(CALLBACK_STACK.create(), {});
|
||||
});
|
||||
|
||||
cb_stack.exec();
|
||||
};
|
||||
|
||||
|
@ -266,8 +463,7 @@ $app.on_table_host_render_created = function (render) {
|
|||
} else {
|
||||
if (fields.time_end === 0) {
|
||||
return '<span class="label label-danger"><i class="far fa-clock fa-fw"></i> 未知</span>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (fields.state === TP_SESS_STAT_ERR_START_RESET) {
|
||||
return '<span class="label label-info"><i class="fa fa-exclamation-circle fa-fw"></i> ' + tp_second2str(fields.time_end - fields.time_begin) + '</span>';
|
||||
} else {
|
||||
|
@ -366,7 +562,7 @@ $app.on_table_host_render_created = function (render) {
|
|||
};
|
||||
|
||||
$app.do_replay_rdp = function (record_id, user_username, acc_username, host_ip, time_begin) {
|
||||
if(!$app.options.core_running) {
|
||||
if (!$app.options.core_running) {
|
||||
$tp.notify_error(tp_error_msg(TPE_NO_CORE_SERVER), '无法播放。');
|
||||
return;
|
||||
}
|
||||
|
@ -382,8 +578,7 @@ $app.do_replay_rdp = function (record_id, user_username, acc_username, host_ip,
|
|||
, function (code, message) {
|
||||
if (code === TPE_NO_ASSIST) {
|
||||
$assist.alert_assist_not_found(code);
|
||||
}
|
||||
else
|
||||
} else
|
||||
$tp.notify_error('播放RDP操作录像失败:' + tp_error_msg(code, message));
|
||||
}
|
||||
);
|
||||
|
|
|
@ -28,10 +28,6 @@ html, body {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
#page-container {
|
||||
min-width: 1260px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
@ -60,6 +56,37 @@ label {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
hr.hr-sm {
|
||||
//margin-top: 5px;
|
||||
//margin-bottom: 5px;
|
||||
padding: 1px 0;
|
||||
margin: 5px 0;
|
||||
border-top: 1px dashed #c4c4c4;
|
||||
}
|
||||
|
||||
hr.small {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
ul.list {
|
||||
//list-style: none;
|
||||
margin: 0;
|
||||
padding: 3px 0 5px 0;
|
||||
|
||||
li {
|
||||
margin: 3px 3px 5px 10px;
|
||||
}
|
||||
}
|
||||
|
||||
button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.clear-float {
|
||||
clear: both;
|
||||
}
|
||||
|
@ -91,28 +118,6 @@ label {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
hr.hr-sm {
|
||||
//margin-top: 5px;
|
||||
//margin-bottom: 5px;
|
||||
padding: 1px 0;
|
||||
margin: 5px 0;
|
||||
border-top: 1px dashed #c4c4c4;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
ul.list {
|
||||
//list-style: none;
|
||||
margin: 0;
|
||||
padding: 3px 0 5px 0;
|
||||
|
||||
li {
|
||||
margin: 3px 3px 5px 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-single-line {
|
||||
white-space: nowrap;
|
||||
|
||||
|
@ -129,10 +134,6 @@ ul.list {
|
|||
}
|
||||
}
|
||||
|
||||
hr.small {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.dlg-protocol-group {
|
||||
margin-bottom: 3px;
|
||||
|
||||
|
@ -333,3 +334,7 @@ hr.small {
|
|||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#page-container {
|
||||
min-width: 1260px;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
font-size: @text-size-small;
|
||||
}
|
||||
|
||||
.btn:focus,
|
||||
.btn:active:focus,
|
||||
.btn.active:focus,
|
||||
.btn.focus,
|
||||
.btn:active.focus,
|
||||
.btn.active.focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
//.btn.btn-sm {
|
||||
// padding: 3px 8px;
|
||||
//}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
{% block block_body %}
|
||||
<div class="page-content-inner">
|
||||
## 防止页面搜索框被自动填充
|
||||
{# ## 防止页面搜索框被自动填充#}
|
||||
<label style="display:none;"><span></span><input type="text" name="hidden1"></label>
|
||||
<label style="display:none;"><span></span><input type="password" name="hidden2"></label>
|
||||
|
||||
|
@ -136,17 +136,12 @@
|
|||
|
||||
<div class="form-horizontal">
|
||||
|
||||
##
|
||||
<div class="form-group form-group-sm">
|
||||
## <label for="edit-host-type" class="col-sm-2 control-label require">主机类型:</label>
|
||||
##
|
||||
<div class="col-sm-6">
|
||||
##
|
||||
<div id="edit-host-type" class="btn-group btn-group-sm"></div>
|
||||
##
|
||||
</div>
|
||||
##
|
||||
</div>
|
||||
{# ## <div class="form-group form-group-sm">#}
|
||||
{# ## <label for="edit-host-type" class="col-sm-2 control-label require">主机类型:</label>#}
|
||||
{# ## <div class="col-sm-6">#}
|
||||
{# ## <div id="edit-host-type" class="btn-group btn-group-sm"></div>#}
|
||||
{# ## </div>#}
|
||||
{# ## </div>#}
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<label for="edit-host-os-type" class="col-sm-3 control-label require">远程主机系统:</label>
|
||||
|
@ -308,7 +303,7 @@
|
|||
<label class="col-sm-3 control-label" for="account-protocol-port"><strong>端口:</strong></label>
|
||||
<div class="col-sm-9">
|
||||
<input id="account-protocol-port" type="text" class="form-control" placeholder=""/>
|
||||
## <p id="account-protocol-port-static" class="form-control-static mono" style="color:#0a6aa1;font-weight:bold;display:none;"></p>
|
||||
{# ## <p id="account-protocol-port-static" class="form-control-static mono" style="color:#0a6aa1;font-weight:bold;display:none;"></p>#}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -104,9 +104,7 @@
|
|||
<div id="op-list"></div>
|
||||
<div class="op-msg">
|
||||
<div class="op-item bold">图例说明:</div>
|
||||
##
|
||||
<div class="op-item"><span class="time multi">YYYY-mm-dd HH:MM:SS</span> <span class="cmd cmd-multi">此记录可能是被复制粘贴到SSH客户端的,有可能是批量执行命令,也可能是在做文本编辑,详情见录像回放。</span></div>
|
||||
|
||||
{# <div class="op-item"><span class="time multi">YYYY-mm-dd HH:MM:SS</span> <span class="cmd cmd-multi">此记录可能是被复制粘贴到SSH客户端的,有可能是批量执行命令,也可能是在做文本编辑,详情见录像回放。</span></div>#}
|
||||
<div class="op-item"><span class="time">YYYY-mm-dd HH:MM:SS</span> <span class="cmd cmd-danger">此命令可能是危险操作。</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,12 +3,54 @@
|
|||
{% set page_icon_class_ = 'fa fa-eye fa-fw' %}
|
||||
{% set page_id_ = ['audit', 'record'] %}
|
||||
|
||||
{% block block_extend_css_file %}
|
||||
<link href="{{ static_url('plugins/datetimepicker/css/bootstrap-datetimepicker.min.css') }}" rel="stylesheet">
|
||||
{% endblock %}
|
||||
|
||||
{% block block_extend_js_file %}
|
||||
<script type="text/javascript" src="{{ static_url('js/audit/record-list.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ static_url('plugins/datetimepicker/js/bootstrap-datetimepicker.min.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ static_url('plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block block_embed_css %}
|
||||
<style type="text/css">
|
||||
|
||||
.filter-area {
|
||||
padding: 10px;
|
||||
{#width: 90%;#}
|
||||
}
|
||||
|
||||
.filter-area .col-sm-1 {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.filter-box {
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
background-color: #00acda;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.filter-box .name {
|
||||
display: inline-block;
|
||||
width: 8em;
|
||||
text-align: right;
|
||||
float: left;
|
||||
|
||||
}
|
||||
|
||||
.filter-box .value {
|
||||
display: inline-block;
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block block_body %}
|
||||
<div class="page-content-inner">
|
||||
<div class="page-content-inner">
|
||||
|
||||
<!-- begin box -->
|
||||
<div class="box">
|
||||
|
@ -16,12 +58,108 @@
|
|||
<div class="table-extend-cell">
|
||||
<span class="table-name"><i class="fa fa-list fa-fw"></i> 会话列表</span>
|
||||
<button id="btn-refresh-record" class="btn btn-sm btn-default"><i class="fa fa-redo fa-fw"></i> 刷新列表</button>
|
||||
<button id="btn-toggle-filter" class="btn btn-sm btn-default">显示过滤器</button>
|
||||
</div>
|
||||
<div class="table-extend-cell table-extend-cell-right group-actions">
|
||||
<div class="label label-ignore">存储空间:<span id="storage-info"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="filter-area" class="filter-area" style="display:anone;">
|
||||
<!-- 过滤时间 -->
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<label class="col-sm-1 control-label">时间:</label>
|
||||
<div class="col-sm-2" style="width:320px;">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="filter-btn-time-all" type="button" class="btn btn-sm btn-info">全部</button>
|
||||
<button id="filter-btn-time-today" type="button" class="btn btn-sm btn-default">今天</button>
|
||||
<button id="filter-btn-time-week" type="button" class="btn btn-sm btn-default">本周</button>
|
||||
<button id="filter-btn-time-month" type="button" class="btn btn-sm btn-default">本月</button>
|
||||
<button id="filter-btn-time-customer" type="button" class="btn btn-sm btn-default">自定义时间段</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5" id="filter-time-customer-area" style="display: none;">
|
||||
<form class="form-inline">
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="input-group date" id="filter-time-from">
|
||||
<input type="text" class="form-control" placeholder="开始时间" readonly/>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
|
||||
</div>
|
||||
|
||||
<label class="control-label"> ~ </label>
|
||||
<div class="input-group date" id="filter-time-to">
|
||||
<input type="text" class="form-control" placeholder="结束时间" readonly/>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<label class="col-sm-1 control-label" for="filter-protocol-type">协议:</label>
|
||||
<div class="col-sm-5">
|
||||
<select id="filter-protocol-type" class="form-control">
|
||||
<option value="0">全部</option>
|
||||
<option value="100">RDP</option>
|
||||
<option value="200">SSH</option>
|
||||
<option value="201">SFTP</option>
|
||||
<option value="300">TELNET</option>
|
||||
</select>
|
||||
</div>
|
||||
<label class="col-sm-1 control-label" for="filter-session-id">会话ID:</label>
|
||||
<div class="col-sm-5">
|
||||
<input id="filter-session-id" type="text" class="form-control" placeholder="请输入会话ID"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<label class="col-sm-1 control-label" for="filter-remote-host-addr">远程主机:</label>
|
||||
<div class="col-sm-5">
|
||||
<input id="filter-remote-host-addr" type="text" class="form-control" placeholder="请输入远程主机地址"/>
|
||||
</div>
|
||||
<label class="col-sm-1 control-label" for="filter-client-ip">来源IP:</label>
|
||||
<div class="col-sm-5">
|
||||
<input id="filter-client-ip" type="text" class="form-control" placeholder="请输入来源IP"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<label class="col-sm-1 control-label" for="filter-remote-acc">远程账号:</label>
|
||||
<div class="col-sm-5">
|
||||
<input id="filter-remote-acc" type="text" class="form-control" placeholder="请输入远程账号"/>
|
||||
</div>
|
||||
<label class="col-sm-1 control-label" for="filter-tp-user">用户:</label>
|
||||
<div class="col-sm-5">
|
||||
<input id="filter-tp-user" type="text" class="form-control" placeholder="请输入操作者用户名"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group form-group-sm">
|
||||
<div class="col-sm-1"></div>
|
||||
<div class="col-sm-5">
|
||||
<button type="button" class="btn btn-sm btn-primary" id="btn-search"><i class="fa fa-search fa-fw"></i> 搜索</button>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btn-reset-filter"><i class="fa fa-undo fa-fw"></i> 重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-bordered table-hover table-data no-footer dtr-inline" id="table-record"></table>
|
||||
|
||||
<div class="table-extend-area">
|
||||
|
@ -43,5 +181,5 @@
|
|||
</div>
|
||||
<!-- end of box -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -48,8 +48,7 @@
|
|||
<div class="table-extend-cell checkbox-select-all"><input id="table-auz-select-all" type="checkbox"/></div>
|
||||
<div class="table-extend-cell group-actions">
|
||||
<div class="btn-group" role="group">
|
||||
##
|
||||
<button id="btn-edit-host" type="button" class="btn btn-default"><i class="fa fa-edit fa-fw"></i> 编辑</button>
|
||||
{# <button id="btn-edit-host" type="button" class="btn btn-default"><i class="fa fa-edit fa-fw"></i> 编辑</button>#}
|
||||
|
||||
<button id="btn-lock" type="button" class="btn btn-default"><i class="fa fa-lock fa-fw"></i> 禁用</button>
|
||||
<button id="btn-unlock" type="button" class="btn btn-default"><i class="fa fa-unlock fa-fw"></i> 解禁</button>
|
||||
|
|
|
@ -453,15 +453,18 @@ class DoGetRecordsHandler(TPBaseJsonHandler):
|
|||
sql_exclude = args['exclude'] if 'exclude' in args else {}
|
||||
|
||||
try:
|
||||
tmp = list()
|
||||
_filter = args['filter']
|
||||
tmp = list()
|
||||
for i in _filter:
|
||||
if i == 'user_id' and _filter[i] == 0:
|
||||
tmp.append(i)
|
||||
continue
|
||||
if i == 'user_name':
|
||||
if len(_filter[i].strip()) == 0:
|
||||
elif i == 'user_name' and len(_filter[i].strip()) == 0:
|
||||
tmp.append(i)
|
||||
continue
|
||||
elif i == 'protocol' and _filter[i] == 0:
|
||||
tmp.append(i)
|
||||
continue
|
||||
|
||||
for i in tmp:
|
||||
del _filter[i]
|
||||
|
|
|
@ -79,6 +79,23 @@ def get_records(handler, sql_filter, sql_order, sql_limit, sql_restrict, sql_exc
|
|||
for k in sql_filter:
|
||||
if k == 'state':
|
||||
_where.append('r.state={}'.format(sql_filter[k]))
|
||||
elif k == 'user_name':
|
||||
_where.append('(r.user_username LIKE "%{k}%" OR r.user_surname LIKE "%{k}%")'.format(k=sql_filter[k]))
|
||||
elif k == 'client_ip':
|
||||
_where.append('r.client_ip LIKE "%{k}%"'.format(k=sql_filter[k]))
|
||||
elif k == 'remote_addr':
|
||||
_where.append('r.host_ip LIKE "%{k}%"'.format(k=sql_filter[k]))
|
||||
elif k == 'sid':
|
||||
_where.append('r.sid LIKE "%{k}%"'.format(k=sql_filter[k]))
|
||||
elif k == 'remote_acc':
|
||||
_where.append('r.acc_username LIKE "%{k}%"'.format(k=sql_filter[k]))
|
||||
elif k == 'protocol':
|
||||
_where.append('r.protocol_sub_type={k}'.format(k=sql_filter[k]))
|
||||
elif k == 'time_from':
|
||||
_where.append('r.time_begin>={k}'.format(k=sql_filter[k]))
|
||||
elif k == 'time_to':
|
||||
_where.append('r.time_end<={k}'.format(k=sql_filter[k]))
|
||||
|
||||
# elif k == 'search_record':
|
||||
# _where.append('(h.name LIKE "%{}%" OR h.ip LIKE "%{}%" OR h.router_addr LIKE "%{}%" OR h.desc LIKE "%{}%" OR h.cid LIKE "%{}%")'.format(sql_filter[k], sql_filter[k], sql_filter[k], sql_filter[k], sql_filter[k]))
|
||||
|
||||
|
|
Loading…
Reference in New Issue