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
ac875d39
Commit
ac875d39
authored
Dec 24, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
简单修改
parent
3c422402
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
jump.py
jump.py
+6
-6
No files found.
jump.py
View file @
ac875d39
...
...
@@ -150,8 +150,8 @@ def posix_shell(chan, user, host):
log
.
close
()
def
get_
host_all
(
username
):
host
_all
=
{}
def
get_
user_host
(
username
):
host
s
=
{}
try
:
user
=
User
.
objects
.
get
(
username
=
username
)
except
AttributeError
:
...
...
@@ -159,8 +159,8 @@ def get_host_all(username):
else
:
perm_all
=
user
.
permission_set
.
all
()
for
perm
in
perm_all
:
host
_all
[
perm
.
asset
.
ip
]
=
perm
.
asset
.
comment
return
host
_all
host
s
[
perm
.
asset
.
ip
]
=
perm
.
asset
.
comment
return
host
s
def
print_prompt
():
...
...
@@ -175,7 +175,7 @@ def print_prompt():
def
print_user_host
(
username
):
host_all
=
get_
host_all
(
username
)
host_all
=
get_
user_host
(
username
)
for
ip
,
comment
in
host_all
.
items
():
print
'
%
s --
%
s'
%
(
ip
,
comment
)
...
...
@@ -231,7 +231,7 @@ if __name__ == '__main__':
except
EOFError
:
continue
if
option
in
[
'P'
,
'p'
]:
print_user_host
()
print_user_host
(
username
)
continue
elif
option
in
[
'E'
,
'e'
]:
pass
...
...
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