mirror of https://github.com/jumpserver/jumpserver
删除没用的
parent
26c31feb4a
commit
3bee29338c
|
@ -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()
|
||||
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})
|
||||
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))
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
|
@ -1,34 +0,0 @@
|
|||
{% 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 %}
|
|
@ -1,58 +0,0 @@
|
|||
{% 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 %}
|
|
@ -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>
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
{% 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 %}
|
|
@ -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 %}
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
{% 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 %}
|
Loading…
Reference in New Issue