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
2e1c7d2f
Commit
2e1c7d2f
authored
Oct 30, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改模板显示
修改jumpserver.py 1.2 1.21 修改下载大文件
parent
78b55f98
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
20 deletions
+25
-20
jumpserver.iml
.idea/jumpserver.iml
+1
-1
jumpserver.py
jumpserver.py
+18
-12
views.py
webroot/AutoSa/AutoSa/views.py
+3
-4
info.html
webroot/AutoSa/templates/info.html
+1
-1
showUser.html
webroot/AutoSa/templates/showUser.html
+2
-2
No files found.
.idea/jumpserver.iml
View file @
2e1c7d2f
...
...
@@ -2,7 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"
inheritedJdk
"
/>
<orderEntry
type=
"
jdk"
jdkName=
"Python 2.7.8 (C:\Python27\python.exe)"
jdkType=
"Python SDK
"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
...
...
jumpserver.py
View file @
2e1c7d2f
...
...
@@ -132,7 +132,6 @@ def connect(host, port, user, password):
signal
.
signal
(
signal
.
SIGWINCH
,
sigwinch_passthrough
)
size
=
getwinsize
()
foo
.
setwinsize
(
size
[
0
],
size
[
1
])
print
"
\033
[32;1mLogin
%
s success!
\033
[0m"
%
host
foo
.
interact
()
break
elif
index
==
0
:
...
...
@@ -259,19 +258,26 @@ def exec_cmd_servers(username):
def
connect_one
(
username
,
option
):
ip
=
option
.
strip
()
ip
_input
=
option
.
strip
()
ip_all
,
ip_all_dict
=
ip_all_select
(
username
)
ip_matched
=
match_ip
(
ip_all
,
ip
)
ip_matched
=
match_ip
(
ip_all
,
ip
_input
)
ip_len
=
len
(
ip_matched
)
if
ip_len
==
1
:
ip
=
ip_matched
[
0
]
password
=
jm
.
decrypt
(
sth_select
(
username
=
username
))
port
=
sth_select
(
ip
=
ip
)
print
"Connecting
%
s ..."
%
ip
connect
(
ip
,
port
,
username
,
password
)
elif
ip_len
>
1
:
for
ip
in
ip_matched
:
print
ip
ip
=
''
if
ip_len
>=
1
:
if
ip_len
==
1
:
ip
=
ip_matched
[
0
]
else
:
for
one_ip
in
ip_matched
:
if
one_ip
.
endswith
(
ip_input
):
ip
=
one_ip
break
else
:
print
one_ip
if
ip
:
password
=
jm
.
decrypt
(
sth_select
(
username
=
username
))
port
=
sth_select
(
ip
=
ip_input
)
print
"Connecting
%
s ..."
%
ip
connect
(
ip
,
port
,
username
,
password
)
else
:
print
'
\033
[31mNo permision .
\033
[0m'
...
...
webroot/AutoSa/AutoSa/views.py
View file @
2e1c7d2f
...
...
@@ -18,6 +18,7 @@ import crypt
import
hashlib
from
UserManage.forms
import
UserAddForm
,
GroupAddForm
import
paramiko
from
django.core.servers.basehttp
import
FileWrapper
base_dir
=
"/opt/jumpserver/"
...
...
@@ -940,11 +941,9 @@ def downFile(request):
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
t
)
sftp
.
get
(
path
,
download_file
)
if
os
.
path
.
isfile
(
download_file
):
f
=
open
(
download_file
)
data
=
f
.
read
()
f
.
close
()
wrapper
=
FileWrapper
(
open
(
download_file
))
response
=
HttpResponse
(
data
,
mimetype
=
'application/octet-stream'
)
response
=
HttpResponse
(
wrapper
,
mimetype
=
'application/octet-stream'
)
response
[
'Content-Disposition'
]
=
'attachment; filename=
%
s'
%
os
.
path
.
basename
(
path
)
return
response
...
...
webroot/AutoSa/templates/info.html
View file @
2e1c7d2f
...
...
@@ -38,7 +38,7 @@
<body>
{% if msg %}
<div
class=
"alert alert-success"
><b>
成功:
</b>
{{ msg }}
</div>
<div
class=
"alert alert-success"
style=
"margin-left: auto;margin-right: auto;margin-top: 60px;width:500px;"
><b>
成功:
</b>
{{ msg }}
</div>
{% endif %}
{% if error %}
...
...
webroot/AutoSa/templates/showUser.html
View file @
2e1c7d2f
...
...
@@ -17,8 +17,8 @@
<th>
is_admin
</th>
<th>
is_superuser
</th>
<th>
Email
</th>
<th>
Key
</th>
<th>
修改
</th>
<th>
密钥
</th>
<th>
用户信息
</th>
<th>
sudo
</th>
<th>
sudo
</th>
</tr>
...
...
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