Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
9233fef6
Commit
9233fef6
authored
Dec 03, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exec log
parent
33663783
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
130 deletions
+85
-130
urls.py
jlog/urls.py
+7
-7
views.py
jlog/views.py
+4
-2
log_exec.html
templates/jlog/log_exec.html
+61
-110
log_offline.html
templates/jlog/log_offline.html
+1
-0
log_online.html
templates/jlog/log_online.html
+1
-0
user_list.html
templates/juser/user_list.html
+11
-11
No files found.
jlog/urls.py
View file @
9233fef6
...
@@ -3,11 +3,10 @@ from django.conf.urls import patterns, include, url
...
@@ -3,11 +3,10 @@ from django.conf.urls import patterns, include, url
from
jlog.views
import
*
from
jlog.views
import
*
urlpatterns
=
patterns
(
''
,
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
log_list
),
(
r'^$'
,
log_list
),
url
(
r'^log_list/(\w+)/$'
,
log_list
),
(
r'^log_list/(\w+)/$'
,
log_list
),
url
(
r'^history/$'
,
log_history
),
(
r'^history/$'
,
log_history
),
url
(
r'^log_kill/'
,
log_kill
),
(
r'^log_kill/'
,
log_kill
),
url
(
r'^record/$'
,
log_record
),
(
r'^record/$'
,
log_record
),
url
(
r'^web_terminal/$'
,
web_terminal
),
(
r'^web_terminal/$'
,
web_terminal
),
)
)
\ No newline at end of file
jlog/views.py
View file @
9233fef6
...
@@ -8,7 +8,7 @@ from jperm.perm_api import user_have_perm
...
@@ -8,7 +8,7 @@ from jperm.perm_api import user_have_perm
from
django.http
import
HttpResponseNotFound
from
django.http
import
HttpResponseNotFound
from
jlog.log_api
import
renderTemplate
from
jlog.log_api
import
renderTemplate
from
models
import
Log
from
jlog.models
import
Log
,
Exec
Log
from
jumpserver.settings
import
WEB_SOCKET_HOST
from
jumpserver.settings
import
WEB_SOCKET_HOST
...
@@ -21,9 +21,11 @@ def log_list(request, offset):
...
@@ -21,9 +21,11 @@ def log_list(request, offset):
username_list
=
request
.
GET
.
getlist
(
'username'
,
[])
username_list
=
request
.
GET
.
getlist
(
'username'
,
[])
host_list
=
request
.
GET
.
getlist
(
'host'
,
[])
host_list
=
request
.
GET
.
getlist
(
'host'
,
[])
cmd
=
request
.
GET
.
get
(
'cmd'
,
''
)
cmd
=
request
.
GET
.
get
(
'cmd'
,
''
)
print
date_seven_day
,
date_now_str
if
offset
==
'online'
:
if
offset
==
'online'
:
posts
=
Log
.
objects
.
filter
(
is_finished
=
False
)
.
order_by
(
'-start_time'
)
posts
=
Log
.
objects
.
filter
(
is_finished
=
False
)
.
order_by
(
'-start_time'
)
if
offset
==
'exec'
:
posts
=
ExecLog
.
objects
.
all
()
.
order_by
(
'-id'
)
else
:
else
:
posts
=
Log
.
objects
.
filter
(
is_finished
=
True
)
.
order_by
(
'-start_time'
)
posts
=
Log
.
objects
.
filter
(
is_finished
=
True
)
.
order_by
(
'-start_time'
)
username_all
=
set
([
log
.
user
for
log
in
Log
.
objects
.
all
()])
username_all
=
set
([
log
.
user
for
log
in
Log
.
objects
.
all
()])
...
...
templates/jlog/log_exec.html
View file @
9233fef6
...
@@ -7,125 +7,76 @@
...
@@ -7,125 +7,76 @@
{% block content %}
{% block content %}
{% include 'nav_cat_bar.html' %}
{% include 'nav_cat_bar.html' %}
<style>
.bootstrap-dialog-body
{
background-color
:
rgba
(
0
,
0
,
0
,
0
);
}
.bootstrap-dialog-message
{
color
:
#00FF00
;
}
.modal-content
{
background-color
:
rgba
(
0
,
0
,
0
,
0.6
);
}
.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
;
}
</style>
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"row"
>
ol-sm/g
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
id=
"ibox-content"
class=
"ibox-title"
>
<div
id=
"ibox-content"
class=
"ibox-title"
>
<h5>
批量命令日志
</h5>
<h5>
用户日志详细信息列表
</h5>
<div
class=
"ibox-tools"
>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
<i
class=
"fa fa-chevron-up"
></i>
</a>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
<i
class=
"fa fa-wrench"
></i>
</a>
</a>
<a
class=
"close-link"
>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
<i
class=
"fa fa-times"
></i>
</a>
</a>
</div>
</div>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
"panel-options"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<ul
class=
"nav nav-tabs"
>
<li><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li
class=
"active"
><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
</ul>
<li
class=
"active"
><a
href=
"/jlog/log_list/exec/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
命令记录
</a></li>
</div>
</ul>
<br/>
</div>
<form
class=
"form-inline"
action=
""
method=
"get"
>
<br/>
<div
class=
"form-group"
id=
"date_5"
>
<div
class=
""
>
<div
class=
"input-daterange input-group"
id=
"datepicker"
>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<input
type=
"text"
class=
"input-sm form-control"
style=
"width: 100px;"
name=
"start"
value=
"{{ date_seven_day }}"
>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
>
to
</span>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<input
type=
"text"
class=
"input-sm form-control"
style=
"width: 100px;"
name=
"end"
value=
"{{ date_now_str }}"
>
<div
class=
"input-group-btn"
>
</div>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
</div>
-搜索-
<div
class=
"form-group"
>
</button>
<div
class=
"input-group"
>
<select
name=
"username"
data-placeholder=
"用户名"
class=
"chosen-select"
multiple
style=
"width:200px;"
tabindex=
"2"
>
{% for username in username_all %}
<option
value=
"{{ username }}"
{%
if
username
in
username_list
%}
selected
{%
endif
%}
>
{{ username }}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"input-group"
>
<select
name=
"host"
data-placeholder=
"主机"
class=
"chosen-select"
multiple
style=
"width:200px;"
tabindex=
"4"
>
{% for ip in ip_all %}
<option
value=
"{{ ip }}"
{%
if
ip
in
host_list
%}
selected
{%
endif
%}
>
{{ ip }}
</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<input
id=
"cmd"
name=
"cmd"
placeholder=
"命令"
type=
"text"
class=
"form-control"
value=
"{{ cmd }}"
style=
"width: 200px;"
>
</div>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
Search
</button>
</form>
</form>
<div
class=
"tab-content"
>
</div>
<table
class=
"table table-striped table-bordered table-hover "
>
<div
class=
"tab-content"
>
<thead>
<table
class=
"table table-striped table-bordered table-hover "
>
<tr>
<thead>
<th
class=
"text-center"
>
ID
</th>
<tr>
<th
class=
"text-center"
>
用户名
</th>
<th
class=
"text-center"
>
ID
</th>
<th
class=
"text-center"
>
主机
</th>
<th
class=
"text-center"
>
用户名
</th>
<th
class=
"text-center"
>
来源IP
</th>
<th
class=
"text-center"
>
主机
</th>
<th
class=
"text-center"
>
时间
</th>
<th
class=
"text-center"
>
命令
</th>
</tr>
<th
class=
"text-center"
>
来源IP
</th>
</thead>
<th
class=
"text-center"
>
时间
</th>
<tbody>
</tr>
</thead>
<tbody>
{% for post in contacts.object_list %}
{% for post in contacts.object_list %}
<tr
class=
"gradeX"
>
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ post.id }}
</td>
<td
class=
"text-center"
>
{{ post.id }}
</td>
<td
class=
"text-center username"
>
{{ post.user }}
</td>
<td
class=
"text-center username"
>
{{ post.user }}
</td>
<td
class=
"text-center ip"
>
{{ post.host }}
</td>
<td
class=
"text-center ip"
>
{{ post.host }}
</td>
<td
class=
"text-center remote_ip"
>
{{ post.remote_ip }}
</td>
<td
class=
"text-center ip"
>
{{ post.cmd }}
</td>
<td
class=
"text-center"
>
{{ post.login_type }}
</td>
<td
class=
"text-center remote_ip"
>
{{ post.remote_ip }}
</td>
{% ifnotequal session_role_id 0 %}
<td
class=
"text-center start_time"
>
{{ post.datetime|date:"Y-m-d H:i:s"}}
</td>
<td
class=
"text-center"
><a
href=
"/jlog/history/?id={{ post.id }}"
class=
"log_command"
>
统计
</a></td>
</tr>
{% endifnotequal %}
{% endfor %}
<td
class=
"text-center"
><a
value=
"/jlog/record/?id={{ post.id }}"
class=
"log_record"
>
回放
</a></td>
</tbody>
<td
class=
"text-center start_time"
>
{{ post.start_time|date:"Y-m-d H:i:s"}}
</td>
</table>
<td
class=
"text-center end_time"
>
{{ post.end_time|date:"Y-m-d H:i:s" }}
</td>
<div
class=
"row"
>
</tr>
<div
class=
"col-sm-6"
>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
templates/jlog/log_offline.html
View file @
9233fef6
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
<ul
class=
"nav nav-tabs"
>
<ul
class=
"nav nav-tabs"
>
<li><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li
class=
"active"
><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li
class=
"active"
><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li><a
href=
"/jlog/log_list/exec/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
命令记录
</a></li>
</ul>
</ul>
</div>
</div>
<br/>
<br/>
...
...
templates/jlog/log_online.html
View file @
9233fef6
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
<ul
class=
"nav nav-tabs"
>
<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
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>
<li><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li><a
href=
"/jlog/log_list/exec/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
命令记录
</a></li>
</ul>
</ul>
</div>
</div>
<br/>
<br/>
...
...
templates/juser/user_list.html
View file @
9233fef6
...
@@ -24,18 +24,18 @@
...
@@ -24,18 +24,18 @@
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
""
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/juser/user_add/"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
<a
target=
"_blank"
href=
"/juser/user_add/"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
-搜索-
-搜索-
</button>
</button>
</div>
</div>
</div>
</div>
</form>
</form>
</div>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment