コード例 #1
0
ファイル: connect.py プロジェクト: iselu/jumpserver
os.environ["DJANGO_SETTINGS_MODULE"] = "jumpserver.settings"
from juser.models import User
from jlog.models import Log
from jumpserver.api import CONF, BASE_DIR, ServerError, user_perm_group_api, user_perm_group_hosts_api, get_user_host
from jumpserver.api import AssetAlias, get_connect_item


try:
    import termios
    import tty
except ImportError:
    print "\033[1;31mOnly UnixLike supported.\033[0m"
    time.sleep(3)
    sys.exit()

CONF.read(os.path.join(BASE_DIR, "jumpserver.conf"))
LOG_DIR = os.path.join(BASE_DIR, "logs")
SSH_KEY_DIR = os.path.join(BASE_DIR, "keys")
SERVER_KEY_DIR = os.path.join(SSH_KEY_DIR, "server")
LOGIN_NAME = getpass.getuser()


def color_print(msg, color="blue"):
    """Print colorful string."""
    color_msg = {"blue": "\033[1;36m%s\033[0m", "green": "\033[1;32m%s\033[0m", "red": "\033[1;31m%s\033[0m"}

    print color_msg.get(color, "blue") % msg


def color_print_exit(msg, color="red"):
    """Print colorful string and exit."""
コード例 #2
0
ファイル: connect.py プロジェクト: siemon2008/jumpserver
os.environ['DJANGO_SETTINGS_MODULE'] = 'jumpserver.settings'
from juser.models import User
from jlog.models import Log
from jumpserver.api import CONF, BASE_DIR, ServerError, user_perm_group_api, user_perm_group_hosts_api, get_user_host, account_perm_group_api, user_perm_usergroup_api, user_perm_usergroup_hosts_api
from jumpserver.api import AssetAlias, get_connect_item


try:
    import termios
    import tty
except ImportError:
    print '\033[1;31mOnly UnixLike supported.\033[0m'
    time.sleep(3)
    sys.exit()

CONF.read(os.path.join(BASE_DIR, 'jumpserver.conf'))
LOG_DIR = os.path.join(BASE_DIR, 'logs')
SSH_KEY_DIR = os.path.join(BASE_DIR, 'keys')
SERVER_KEY_DIR = os.path.join(SSH_KEY_DIR, 'server')
LOGIN_NAME = getpass.getuser()
SEND_IP = CONF.get('base', 'ip')


def color_print(msg, color='blue'):
    """Print colorful string."""
    color_msg = {'blue': '\033[1;36m%s\033[0m',
                 'green': '\033[1;32m%s\033[0m',
                 'red': '\033[1;31m%s\033[0m'}

    print color_msg.get(color, 'blue') % msg
コード例 #3
0
os.environ['DJANGO_SETTINGS_MODULE'] = 'jumpserver.settings'
from juser.models import User
from jlog.models import Log
from jumpserver.api import CONF, BASE_DIR, ServerError, user_perm_group_api, user_perm_group_hosts_api, get_user_host
from jumpserver.api import AssetAlias, get_connect_item


try:
    import termios
    import tty
except ImportError:
    print '\033[1;31mOnly UnixLike supported.\033[0m'
    time.sleep(3)
    sys.exit()

CONF.read(os.path.join(BASE_DIR, 'jumpserver.conf'))
LOG_DIR = os.path.join(BASE_DIR, 'logs')
SSH_KEY_DIR = os.path.join(BASE_DIR, 'keys')
SERVER_KEY_DIR = os.path.join(SSH_KEY_DIR, 'server')
LOGIN_NAME = getpass.getuser()


def color_print(msg, color='blue'):
    """Print colorful string."""
    color_msg = {'blue': '\033[1;36m%s\033[0m',
                 'green': '\033[1;32m%s\033[0m',
                 'red': '\033[1;31m%s\033[0m'}

    print color_msg.get(color, 'blue') % msg

コード例 #4
0
ファイル: connect.py プロジェクト: siemon2008/jumpserver
os.environ['DJANGO_SETTINGS_MODULE'] = 'jumpserver.settings'
from juser.models import User
from jlog.models import Log
from jumpserver.api import CONF, BASE_DIR, ServerError, user_perm_group_api, user_perm_group_hosts_api, get_user_host, account_perm_group_api, user_perm_usergroup_api, user_perm_usergroup_hosts_api
from jumpserver.api import AssetAlias, get_connect_item

try:
    import termios
    import tty
except ImportError:
    print '\033[1;31mOnly UnixLike supported.\033[0m'
    time.sleep(3)
    sys.exit()

CONF.read(os.path.join(BASE_DIR, 'jumpserver.conf'))
LOG_DIR = os.path.join(BASE_DIR, 'logs')
SSH_KEY_DIR = os.path.join(BASE_DIR, 'keys')
SERVER_KEY_DIR = os.path.join(SSH_KEY_DIR, 'server')
LOGIN_NAME = getpass.getuser()
SEND_IP = CONF.get('base', 'ip')


def color_print(msg, color='blue'):
    """Print colorful string."""
    color_msg = {
        'blue': '\033[1;36m%s\033[0m',
        'green': '\033[1;32m%s\033[0m',
        'red': '\033[1;31m%s\033[0m'
    }