|
@ -18,7 +18,7 @@ KEYS_UP = (curses.KEY_UP, ord('k')) |
|
|
KEYS_DOWN = (curses.KEY_DOWN, ord('j')) |
|
|
KEYS_DOWN = (curses.KEY_DOWN, ord('j')) |
|
|
KEYS_SELECT = (curses.KEY_RIGHT, ord(' ')) |
|
|
KEYS_SELECT = (curses.KEY_RIGHT, ord(' ')) |
|
|
|
|
|
|
|
|
# 数据库文件 |
|
|
|
|
|
|
|
|
# 数据库文件 default |
|
|
gSqlite3File = "/usr/local/jumpserver/jumpserver.db" |
|
|
gSqlite3File = "/usr/local/jumpserver/jumpserver.db" |
|
|
|
|
|
|
|
|
# ssh_private_path ssh私钥路径 |
|
|
# ssh_private_path ssh私钥路径 |
|
@ -28,8 +28,17 @@ if system_type == "Darwin": |
|
|
elif system_type == "Linux": |
|
|
elif system_type == "Linux": |
|
|
ssh_private_path = "/home/%s/.ssh/id_rsa" |
|
|
ssh_private_path = "/home/%s/.ssh/id_rsa" |
|
|
else: |
|
|
else: |
|
|
|
|
|
print("Don't support your system(%s)" % system_type) |
|
|
exit(1) |
|
|
exit(1) |
|
|
|
|
|
|
|
|
|
|
|
def init(): |
|
|
|
|
|
global gSqlite3File |
|
|
|
|
|
jumpDb = os.environ.get("JUMPDB") |
|
|
|
|
|
if jumpDb is not None: |
|
|
|
|
|
gSqlite3File = jumpDb |
|
|
|
|
|
else: |
|
|
|
|
|
print("ERROR: Hadn't set environ var 'JUMPDB' for jump database! mod 755") |
|
|
|
|
|
exit(1) |
|
|
|
|
|
|
|
|
class Picker(object): |
|
|
class Picker(object): |
|
|
def __init__(self, options, title=None, indicator='*', default_index=0, multiselect=False, multi_select=False, |
|
|
def __init__(self, options, title=None, indicator='*', default_index=0, multiselect=False, multi_select=False, |
|
@ -278,6 +287,9 @@ def get_hosts(user): |
|
|
return resp |
|
|
return resp |
|
|
|
|
|
|
|
|
def main(): |
|
|
def main(): |
|
|
|
|
|
# 初始化检测 |
|
|
|
|
|
init() |
|
|
|
|
|
|
|
|
user = getpass.getuser() |
|
|
user = getpass.getuser() |
|
|
print("current user: " + user) |
|
|
print("current user: " + user) |
|
|
|
|
|
|
|
|