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
3bee2933
Commit
3bee2933
authored
Nov 06, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除没用的
parent
26c31feb
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
195 deletions
+25
-195
views.py
webroot/AutoSa/AutoSa/views.py
+20
-20
addVPN.html
webroot/AutoSa/templates/addVPN.html
+0
-4
assets_edit.html
webroot/AutoSa/templates/assets_edit.html
+0
-34
assets_view.html
webroot/AutoSa/templates/assets_view.html
+0
-58
chgPass.html
webroot/AutoSa/templates/chgPass.html
+1
-1
index.html
webroot/AutoSa/templates/index.html
+2
-0
runCommand.html
webroot/AutoSa/templates/runCommand.html
+0
-44
showAssets.html
webroot/AutoSa/templates/showAssets.html
+2
-0
showServer.html
webroot/AutoSa/templates/showServer.html
+0
-34
No files found.
webroot/AutoSa/AutoSa/views.py
View file @
3bee2933
...
...
@@ -795,9 +795,6 @@ def addPerm(request):
context_instance
=
RequestContext
(
request
))
@login_required
def
chgPass
(
request
):
"""修改登录密码"""
...
...
@@ -911,21 +908,24 @@ def upFile(request):
port
=
asset
.
port
jm
=
PyCrypt
(
key
)
user
=
User
.
objects
.
get
(
username
=
username
)
t
=
paramiko
.
Transport
((
host
,
port
))
t
.
connect
(
username
=
username
,
password
=
jm
.
decrypt
(
user
.
ldap_password
))
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
t
)
sftp
.
put
(
filename
,
'
%
s/
%
s'
%
(
path
,
upload_file
.
name
))
msg
=
u'上传成功,位于
%
s主机,位置
%
s.'
%
(
host
,
path
)
uplog_dir
=
os
.
path
.
join
(
log_dir
,
'upload'
)
if
not
os
.
path
.
isdir
(
uplog_dir
):
os
.
mkdir
(
uplog_dir
)
filename
=
os
.
path
.
join
(
uplog_dir
,
time
.
strftime
(
'
%
Y
%
m
%
d'
))
f
=
open
(
filename
,
'a'
)
f
.
write
(
'DateTime:
%
s User:
%
s Host:
%
s File:
%
s'
%
(
time
.
strftime
(
'
%
Y/
%
m/
%
d
%
H:
%
M:
%
S'
),
username
,
host
,
path
))
f
.
close
()
return
render_to_response
(
'info.html'
,
{
'msg'
:
msg
})
try
:
t
=
paramiko
.
Transport
((
host
,
port
))
t
.
connect
(
username
=
username
,
password
=
jm
.
decrypt
(
user
.
ldap_password
))
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
t
)
sftp
.
put
(
filename
,
'
%
s/
%
s'
%
(
path
,
upload_file
.
name
))
msg
=
u'上传成功,位于
%
s主机,位置
%
s.'
%
(
host
,
path
)
uplog_dir
=
os
.
path
.
join
(
log_dir
,
'upload'
)
if
not
os
.
path
.
isdir
(
uplog_dir
):
os
.
mkdir
(
uplog_dir
)
filename
=
os
.
path
.
join
(
uplog_dir
,
'
%
s.log'
%
time
.
strftime
(
'
%
Y
%
m
%
d'
))
f
=
open
(
filename
,
'a'
)
f
.
write
(
'DateTime:
%
s User:
%
s Host:
%
s File:
%
s
\n
'
%
(
time
.
strftime
(
'
%
Y/
%
m/
%
d
%
H:
%
M:
%
S'
),
username
,
host
,
path
))
f
.
close
()
except
paramiko
.
AuthenticationException
:
error
=
u'密码不对 或者 你用的admin用户'
return
render_to_response
(
'info.html'
,
{
'msg'
:
msg
,
'error'
:
error
})
else
:
return
render_to_response
(
'info.html'
,
{
'error'
:
u"上传失败"
})
...
...
@@ -956,9 +956,9 @@ def downFile(request):
downlog_dir
=
os
.
path
.
join
(
log_dir
,
'download'
)
if
not
os
.
path
.
isdir
(
downlog_dir
):
os
.
mkdir
(
downlog_dir
)
filename
=
os
.
path
.
join
(
downlog_dir
,
time
.
strftime
(
'
%
Y
%
m
%
d'
))
filename
=
os
.
path
.
join
(
downlog_dir
,
'
%
s.log'
%
time
.
strftime
(
'
%
Y
%
m
%
d'
))
f
=
open
(
filename
,
'a'
)
f
.
write
(
'DateTime:
%
s User:
%
s Host:
%
s File:
%
s'
%
f
.
write
(
'DateTime:
%
s User:
%
s Host:
%
s File:
%
s
\n
'
%
(
time
.
strftime
(
'
%
Y/
%
m/
%
d
%
H:
%
M:
%
S'
),
username
,
host
,
path
))
f
.
close
()
wrapper
=
FileWrapper
(
open
(
download_file
))
...
...
webroot/AutoSa/templates/addVPN.html
deleted
100644 → 0
View file @
26c31feb
{% extends 'base.html' %}
{% block content %}
{% endblock %}
\ No newline at end of file
webroot/AutoSa/templates/assets_edit.html
deleted
100644 → 0
View file @
26c31feb
{% extends "base.html" %}
{% block content %}
<h2
class=
"text-center"
>
修改主机信息
</h2>
<form
role=
"form"
action=
""
method=
"post"
>
<div
class=
"form-group has-success"
>
<label
class=
"control-label"
for=
"inputSuccess"
>
编号
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_num"
value=
'{{ post.s_num }}'
>
<label
class=
"control-label"
for=
"inputSuccess"
>
IP
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_ip"
value=
'{{ post.s_ip }}'
>
<label
class=
"control-label"
for=
"inputSuccess"
>
主机名
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_hostname"
value=
'{{ post.s_hostname }}'
>
<label
class=
"control-label"
for=
"inputSuccess"
>
CPU
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_cpu"
value=
'{{ post.s_cpu }}'
>
<label
class=
"control-label"
for=
"inputSuccess"
>
内存
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_mem"
value=
'{{ post.s_mem }}'
>
<label
class=
"control-label"
for=
"inputSuccess"
>
硬盘
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_disk"
value=
'{{ post.s_disk }}'
>
<label
class=
"control-label"
for=
"inputSuccess"
>
操作系统
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_system"
value=
'{{ post.s_system }}'
>
<div
class=
"form-group has-success"
>
<label
class=
"control-label"
for=
"inputSuccess"
>
内核版本
</label>
<input
type=
"text"
class=
"form-control"
id=
"inputSuccess"
name=
"s_kernel"
value=
'{{ post.s_kernel }}'
>
</div>
<button
type=
"submit"
class=
"btn btn-success col-sm-offset-5"
>
提交更改
</button>
</div>
</form>
{% endblock %}
webroot/AutoSa/templates/assets_view.html
deleted
100644 → 0
View file @
26c31feb
{% extends "base.html" %}
{% block content %}
<div>
<div
style=
"float:left"
><h2>
主机列表
</h2></div>
<div
style=
"float:right;margin-top:16pt"
><a
href=
"/assets/add/"
target=
"_black"
class=
"btn btn-info"
>
添加
<i
class=
"glyphicon glyphicon-plus-sign"
></i></a></div>
</div>
<table
class=
"table table-striped table-hover table-bordered"
id=
"sample_editable_1"
>
<thead>
<tr>
<th
class=
"text-center"
>
编号
</th>
<th
class=
"text-center"
>
IP
</th>
<th
class=
"text-center"
>
主机名
</th>
<th
class=
"text-center"
>
cpu
</th>
<th
class=
"text-center"
>
内存
</th>
<th
class=
"text-center"
>
硬盘
</th>
<th
class=
"text-center"
>
操作系统
</th>
<th
class=
"text-center"
>
详情
</th>
<th
class=
"text-center"
>
编辑
</th>
<th
class=
"text-center"
>
删除
</th>
</tr>
</thead>
<tbody>
{% for post in contacts.object_list %}
<tr
class=
""
>
<td
class=
"text-center"
>
{{ post.s_num }}
</td>
<td
class=
"text-center"
>
{{ post.s_ip }}
</td>
<td
class=
"text-center"
>
{{ post.s_hostname }}
</td>
<td
class=
"text-center"
>
{{ post.s_cpu }}
</td>
<td
class=
"text-center"
>
{{ post.s_mem }}
</td>
<td
class=
"text-center"
>
{{ post.s_disk }}
</td>
<td
class=
"text-center"
>
{{ post.s_system }}
</td>
<td
class=
"text-center"
><a
href=
"/assets/show/{{ post.s_ip }}"
>
详情
</a></td>
<td
class=
"text-center"
><a
href=
"/assets/edit/{{ post.s_ip }}"
>
编辑
</a></td>
<td
class=
"text-center"
><a
href=
"/assets/delete/{{ post.s_ip }}"
>
删除
</a></td>
</tr>
{% endfor %}
</tbody>
</table>
<ul
class=
"pagination"
>
{% if contacts.has_previous %}
<li><a
href=
"?page={{ contacts.previous_page_number }}"
>
«
</a></li>
{% endif %}
{% for page in p.page_range %}
{% ifequal offset1 page %}
<li
class=
"active"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li><a
href=
"?page={{ contacts.next_page_number }}"
>
»
</a></li>
{% endif %}
</ul>
{% endblock %}
webroot/AutoSa/templates/chgPass.html
View file @
3bee2933
...
...
@@ -41,7 +41,7 @@
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-4"
>
<button
class=
"btn btn-
primary"
>
修改
</button>
<button
class=
"btn btn-
success"
>
确认
修改
</button>
</div>
</div>
</fieldset>
...
...
webroot/AutoSa/templates/index.html
View file @
3bee2933
...
...
@@ -15,6 +15,7 @@
<th>
ID
</th>
<th>
IP
</th>
<th>
Port
</th>
<th>
IDC
</th>
<th>
备注
</th>
</tr>
</thead>
...
...
@@ -25,6 +26,7 @@
<td
style=
"width: 5px"
>
{{ asset.id }}
</td>
<td
style=
"width: 90px"
>
{{ asset.ip }}
</td>
<td
style=
"width: 90px"
>
{{ asset.port }}
</td>
<td
style=
"width: 90px"
>
{{ asset.idc }}
</td>
<td
style=
"width: 90px"
>
{{ asset.comment }}
</td>
</tr>
{% endfor %}
...
...
webroot/AutoSa/templates/runCommand.html
deleted
100644 → 0
View file @
26c31feb
{% extends 'base.html' %}
{% block content %}
<form
method=
"post"
action=
""
>
<div
style=
"float: left; width: 400px;"
>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"input-group"
>
<span
class=
"input-group-btn"
>
<button
class=
"btn btn-default"
type=
"button"
>
IP(s)
</button>
</span>
<input
type=
"text"
class=
"form-control"
name=
"ip"
placeholder=
"IP or IPS"
value=
{{
old_ip
}}
>
</div>
<!-- /input-group -->
<span
class=
"help-block"
style=
"margin-left: 20px;"
>
输入一个IP,或者多个IP逗号隔开。
</span>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"input-group"
>
<span
class=
"input-group-btn"
>
<button
class=
"btn btn-default"
type=
"button"
>
CMD
</button>
</span>
<input
type=
"text"
class=
"form-control"
name=
"cmd"
placeholder=
"Command or Commands"
>
</div>
<!-- /input-group -->
<span
class=
"help-block"
style=
"margin-left: 20px;"
>
输入在执行的命令,多个命令分号隔开.
</span>
</div>
</div>
</div>
<div
style=
"float: left; margin-top: 74px; margin-left: 40px;"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
执行
</button>
</div>
<div
style=
"clear: both;"
></div>
</form>
{% if stdout %}
<div
class=
"alert alert-success"
>
{{ stdout }}
</div>
{% endif %}
{% if stderr %}
<div
class=
"alert alert-warning"
>
{{ stderr }}
</div>
{% endif %}
{% endblock %}
\ No newline at end of file
webroot/AutoSa/templates/showAssets.html
View file @
3bee2933
...
...
@@ -13,6 +13,7 @@
<th>
ID
</th>
<th>
IP
</th>
<th>
Port
</th>
<th>
IDC
</th>
<th>
备注
</th>
</tr>
...
...
@@ -24,6 +25,7 @@
<td
style=
"width: 5px"
>
{{ asset.id }}
</td>
<td
style=
"width: 90px"
>
{{ asset.ip }}
</td>
<td
style=
"width: 90px"
>
{{ asset.port }}
</td>
<td
style=
"width: 90px"
>
{{ asset.idc }}
</td>
<td
style=
"width: 90px"
>
{{ asset.comment }}
</td>
</tr>
{% endfor %}
...
...
webroot/AutoSa/templates/showServer.html
deleted
100644 → 0
View file @
26c31feb
{% extends 'base.html' %}
{% block content %}
<form
method=
"post"
action=
""
>
{% if info %}
<p
class=
"alert alert-success"
>
{{ info }}
</p>
{% endif %}
<table
class=
"table table-striped table-hover table-condensed"
>
<thead>
<tr>
<th><input
onclick=
"selectAll()"
type=
"checkbox"
name=
"select_all"
style=
"select_all"
id=
"select_all"
/></th>
<th>
ip
</th>
<th>
用户名
</th>
<th>
端口
</th>
<th>
sudo
</th>
</tr>
</thead>
<tbody>
{% for server in servers %}
<tr>
<td><input
type=
"checkbox"
name=
"selected"
value=
"{{ server.id }}"
></td>
<td>
{{ server.ip }}
</td>
<td>
{{ server.username }}
</td>
<td>
{{ server.port }}
</td>
<td>
{{ server.sudo }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button
class=
"btn btn-primary"
>
删除
</button>
</form>
{% endblock %}
\ No newline at end of file
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