Beispiel #1
0
 def check_with_encrypter(password):
     encrypter = make_encrypter(password)
     return check_password.check(args['data_dir'], encrypter)
Beispiel #2
0
    context.signal_map = {
        signal.SIGTERM: 'terminate',
        signal.SIGHUP: 'terminate'
    }


    if args['no_text']:
        args['password'] = ""

    if args['password'] is None:
        args['password'] = get_password(verify=check_with_encrypter)

    encrypter = make_encrypter(args['password'])

    if not check_password.check(args['data_dir'], encrypter):
        print 'Password failed'
        sys.exit(1)

    if args['change_password']:
        new_password = get_password(message="New Password: ")
        new_encrypter = make_encrypter(new_password)
        print 'Re-encrypting your keys...'
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME), encrypter, store_text=(not args['no_text']))
        astore.change_password(new_encrypter)
        # delete the old password.digest
        os.remove(os.path.join(args['data_dir'], check_password.DIGEST_NAME))
        check_password.check(args['data_dir'], new_encrypter)
        # don't assume we want the logger to run afterwards
        print 'Exiting...'
        sys.exit(0)
Beispiel #3
0
if __name__ == '__main__':
    args = vars(parse_config())

    args['data_dir'] = os.path.expanduser(args['data_dir'])

    ss = Selfstats(os.path.join(args['data_dir'], DBNAME), args)
    
    if args['limit']:
        try:
            int(args['limit'][0])
        except ValueError:
            print 'First argument to --limit must be an integer'
            sys.exit(1)
        

    if ss.need_text or ss.need_keys:
        if args['password'] is None:
            args['password'] = get_password()

        if args['password'] == "":
            models.ENCRYPTER = None
        else:
            models.ENCRYPTER = Blowfish.new(hashlib.md5(args['password']).digest())

        if not check_password.check(args['data_dir'], models.ENCRYPTER, read_only=True):
            print 'Password failed'
            sys.exit(1)

    ss.do()
Beispiel #4
0
 def check_with_encrypter(password):
     encrypter = make_encrypter(password)
     return check_password.check(args['data_dir'], encrypter)
Beispiel #5
0
    context = daemon.DaemonContext(working_directory=args['data_dir'],
                                   pidfile=lock,
                                   stderr=sys.stderr)

    context.signal_map = {
        signal.SIGTERM: 'terminate',
        signal.SIGHUP: 'terminate'
    }

    if args['no_text']:
        args['password'] = ""

    if args['password'] is None:
        args['password'] = get_password(verify=check_with_encrypter)

    encrypter = make_encrypter(args['password'])

    if not check_password.check(args['data_dir'], encrypter):
        print 'Password failed'
        sys.exit(1)

    with context:
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME),
                               encrypter,
                               store_text=(not args['no_text']))

        try:
            astore.run()
        except SystemExit:
            astore.close()
Beispiel #6
0
if __name__ == '__main__':
    args = vars(parse_config())

    args['data_dir'] = os.path.expanduser(args['data_dir'])

    ss = Selfstats(os.path.join(args['data_dir'], DBNAME), args)

    if args['limit']:
        try:
            int(args['limit'][0])
        except ValueError:
            print 'First argument to --limit must be an integer'
            sys.exit(1)

    if ss.need_text or ss.need_keys:
        if args['password'] is None:
            args['password'] = get_password()

        if args['password'] == "":
            models.ENCRYPTER = None
        else:
            models.ENCRYPTER = Blowfish.new(
                hashlib.md5(args['password']).digest())

        if not check_password.check(
                args['data_dir'], models.ENCRYPTER, read_only=True):
            print 'Password failed'
            sys.exit(1)

    ss.do()