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
44166e26
Commit
44166e26
authored
Nov 02, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
闹心的 password和ldap_password
parent
e38fb599
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
jumpserver.py
jumpserver.py
+14
-13
No files found.
jumpserver.py
View file @
44166e26
...
@@ -22,7 +22,8 @@ cur_dir = os.path.dirname(__file__)
...
@@ -22,7 +22,8 @@ cur_dir = os.path.dirname(__file__)
sys
.
path
.
append
(
'
%
s/webroot/AutoSa/'
%
cur_dir
)
sys
.
path
.
append
(
'
%
s/webroot/AutoSa/'
%
cur_dir
)
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'AutoSa.settings'
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'AutoSa.settings'
from
UserManage.models
import
User
,
Logs
,
Assets
from
UserManage.models
import
User
,
Logs
from
Assets.models
import
Assets
cf
=
ConfigParser
.
ConfigParser
()
cf
=
ConfigParser
.
ConfigParser
()
...
@@ -85,16 +86,16 @@ def getwinsize():
...
@@ -85,16 +86,16 @@ def getwinsize():
return
struct
.
unpack
(
'HHHH'
,
x
)[
0
:
2
]
return
struct
.
unpack
(
'HHHH'
,
x
)[
0
:
2
]
def
connect_db
(
user
,
passwd
,
db
,
host
=
'127.0.0.1'
,
port
=
3306
):
#
def connect_db(user, passwd, db, host='127.0.0.1', port=3306):
"""This function connect db and return db and cursor"""
#
"""This function connect db and return db and cursor"""
db
=
MySQLdb
.
connect
(
host
=
host
,
#
db = MySQLdb.connect(host=host,
port
=
port
,
#
port=port,
user
=
user
,
#
user=user,
passwd
=
passwd
,
#
passwd=passwd,
db
=
db
,
#
db=db,
charset
=
'utf8'
)
#
charset='utf8')
cursor
=
db
.
cursor
()
#
cursor = db.cursor()
return
db
,
cursor
#
return db, cursor
def
run_cmd
(
cmd
):
def
run_cmd
(
cmd
):
...
@@ -168,8 +169,8 @@ def sth_select(username='', ip=''):
...
@@ -168,8 +169,8 @@ def sth_select(username='', ip=''):
"""if username: return password elif ip return port"""
"""if username: return password elif ip return port"""
if
username
:
if
username
:
user
=
User
.
objects
.
get
(
username
=
username
)
user
=
User
.
objects
.
get
(
username
=
username
)
password
=
user
.
password
ldap_password
=
user
.
ldap_
password
return
password
return
ldap_
password
if
ip
:
if
ip
:
asset
=
Assets
.
objects
.
get
(
ip
=
ip
)
asset
=
Assets
.
objects
.
get
(
ip
=
ip
)
...
...
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