Beispiel #1
0
def main():

    command_handlers = {
        'get': get_param,
        'set': set_param,
        'list': list_params,
    }

    args = main_options()

    mooltipass = MooltipassClient()

    try:
        pass
    except Exception as e:
        print(e)
        sys.exit(1)

    # Ping the mooltipass, an integral part of the initialization process.
    if not mooltipass.ping():
        print('Mooltipass did not reply to a ping request!')
        sys.exit(1)

    command_handlers[args.command](mooltipass, args)

    sys.exit(0)
Beispiel #2
0
def main():

    logging.basicConfig(
        #format='%(levelname)s\t %(funcName)s():\t %(message)s',
        format='%(message)s',
        level=logging.INFO)
    #level=logging.DEBUG)

    command_handlers = {
        'get': get_context,
        'set': set_context,
        'del': del_context,
        'list': list_context
    }

    args = main_options()

    mooltipass = MooltipassClient()

    if mooltipass is None:
        print('Mooltipass is None, this is a problem.')
        sys.exit(0)

    try:
        # Ensure Mooltipass status
        quiet_bool = False
        if not mooltipass.get_status() == 5:
            print(
                'Insert a card and unlock the Mooltipass or cancel with ctrl-c'
            )
            while True:
                if mooltipass.get_status() == 5:
                    break
                time.sleep(1)

        command_handlers[args.command](mooltipass, args)
        sys.exit(0)
    except (KeyboardInterrupt, SystemExit):
        print('')
        pass
    except Exception as e:
        print('\nAn error occurred: \n{}'.format(e))
        raise e
    finally:
        pass
Beispiel #3
0
def main():

    command_handlers = {
        'get': get_param,
        'set': set_param,
        'list': list_params,
    }

    args = main_options()

    mooltipass = MooltipassClient()

    try:
        pass
    except Exception as e:
        print(e)
        sys.exit(1)

    # Ping the mooltipass, an integral part of the initialization process.
    if not mooltipass.ping():
        print('Mooltipass did not reply to a ping request!')
        sys.exit(1)

    # Ensure Mooltipass status
    quiet_bool = False
    while True:
        status = mooltipass.get_status()
        if status == 5:
            break
        if not quiet_bool:
            print('Insert a card and unlock the Mooltipass...')
        quiet_bool = True
        time.sleep(1)
    quiet_bool = False

    command_handlers[args.command](mooltipass, args)

    sys.exit(0)
Beispiel #4
0
def main():

    logging.basicConfig(
        #format='%(levelname)s\t %(funcName)s():\t %(message)s',
        format='%(message)s',
        level=logging.INFO)

    command_handlers = {
        'get': get_context,
        'set': set_context,
        'del': del_context,
        'list': list_context
    }

    args = main_options()

    try:
        mooltipass = MooltipassClient()
    except Exception as e:
        print('An error occurred accessing the mooltipass: \n{}'.format(e))
        sys.exit(1)

    try:
        # Ensure Mooltipass status
        quiet_bool = False
        if not mooltipass.get_status() == 5:
            print(
                'Insert a card and unlock the Mooltipass or cancel with ctrl-c'
            )
            while True:
                if mooltipass.get_status() == 5:
                    break
                time.sleep(1)

        command_handlers[args.command](mooltipass, args)
        sys.exit(0)
    except KeyboardInterrupt, SystemExit:
        pass
Beispiel #5
0
def main():

    command_handlers = {
        'get':get_param,
        'set':set_param,
        'list':list_params,
    }

    args = main_options()

    mooltipass = MooltipassClient()

    try:
        pass
    except Exception as e:
        print(e)
        sys.exit(1)

    # Ping the mooltipass, an integral part of the initialization process.
    if not mooltipass.ping():
        print('Mooltipass did not reply to a ping request!')
        sys.exit(1)

    # Ensure Mooltipass status
    quiet_bool = False
    while True:
        status = mooltipass.get_status()
        if status == 5:
            break
        if not quiet_bool:
            print('Insert a card and unlock the Mooltipass...')
        quiet_bool = True
        time.sleep(1)
    quiet_bool = False

    command_handlers[args.command](mooltipass, args)

    sys.exit(0)
Beispiel #6
0
def main():

    logging.basicConfig(
            #format='%(levelname)s\t %(funcName)s():\t %(message)s',
            format='%(message)s',
            level=logging.INFO)
            #level=logging.DEBUG)

    command_handlers = {
        'get':get_context,
        'set':set_context,
        'del':del_context,
        'list':list_context
    }

    args = main_options()

    mooltipass = MooltipassClient()

    if mooltipass is None:
        print('Mooltipass is None, this is a problem.')
        sys.exit(0)

    try:
        # Ensure Mooltipass status
        quiet_bool = False
        if not mooltipass.get_status() == 5:
            print('Insert a card and unlock the Mooltipass or cancel with ctrl-c')
            while True:
                if mooltipass.get_status() == 5:
                    break
                time.sleep(1)

        command_handlers[args.command](mooltipass, args)
        sys.exit(0)
    except KeyboardInterrupt, SystemExit:
        print('')
        pass
Beispiel #7
0
def main():

    logging.basicConfig(
            #format='%(levelname)s\t %(funcName)s():\t %(message)s',
            format='%(message)s',
            level=logging.INFO)

    command_handlers = {
        'get':get_context,
        'set':set_context,
        'del':del_context,
        'list':list_context
    }

    args = main_options()

    try:
        mooltipass = MooltipassClient()
    except Exception as e:
        print('An error occurred accessing the mooltipass: \n{}'.format(e))
        sys.exit(1)

    try:
        # Ensure Mooltipass status
        quiet_bool = False
        if not mooltipass.get_status() == 5:
            print('Insert a card and unlock the Mooltipass or cancel with ctrl-c')
            while True:
                if mooltipass.get_status() == 5:
                    break
                time.sleep(1)

        command_handlers[args.command](mooltipass, args)
        sys.exit(0)
    except KeyboardInterrupt, SystemExit:
        pass
Beispiel #8
0
def main():

    command_handlers = {
        'get': get_favorite,
        'set': set_favorite,
        'del': del_favorite,
        'list': list_favorites
    }

    args = main_options()

    mooltipass = MooltipassClient()

    try:
        pass
    except Exception as e:
        print(e)
        sys.exit(1)

    # Ping the mooltipass, an integral part of the initialization process.
    if not mooltipass.ping():
        print('Mooltipass did not reply to a ping request!')
        sys.exit(1)

    # Ensure Mooltipass status
    quiet_bool = False
    while True:
        status = mooltipass.get_status()
        if status == 5:
            break
        if not quiet_bool:
            print('Insert a card and unlock the Mooltipass...')
        quiet_bool = True
        time.sleep(1)
    quiet_bool = False

    if args.skip_mgmt_enter == False:
        mooltipass.start_memory_management()
    command_handlers[args.command](mooltipass, args)
    if args.skip_mgmt_exit == False:
        mooltipass.end_memory_management()

    sys.exit(0)
Beispiel #9
0
def main():

    command_handlers = {
        'get':get_favorite,
        'set':set_favorite,
        'del':del_favorite,
        'list':list_favorites
    }

    args = main_options()

    mooltipass = MooltipassClient()

    try:
        pass
    except Exception as e:
        print(e)
        sys.exit(1)

    # Ping the mooltipass, an integral part of the initialization process.
    if not mooltipass.ping():
        print('Mooltipass did not reply to a ping request!')
        sys.exit(1)

    # Ensure Mooltipass status
    quiet_bool = False
    while True:
        status = mooltipass.get_status()
        if status == 5:
            break
        if not quiet_bool:
            print('Insert a card and unlock the Mooltipass...')
        quiet_bool = True
        time.sleep(1)
    quiet_bool = False

    if args.skip_mgmt_enter == False:
        mooltipass.start_memory_management()
    command_handlers[args.command](mooltipass, args)
    if args.skip_mgmt_exit == False:
        mooltipass.end_memory_management()

    sys.exit(0)