import os
import sys
from functools import partial

import daemonize
import docopt

from keepass_http import backends
from keepass_http.core import Conf, logging
from keepass_http.httpd.server import app
from keepass_http.utils import get_logging_filehandlers_streams_to_keep, has_gui_support

MAX_TRY_COUNT = 3
APP_NAME = "keepass_http_script"
log = logging.getLogger(APP_NAME)


def main():
    # avoid: UnboundLocalError: local variable '__doc__' referenced before assignment
    doc_ = __doc__
    kpconf = Conf()

    if has_gui_support():
        doc_ += "  --gui                     Use TKinter for a graphical interface"

    # handle arguments
    arguments = docopt.docopt(doc_)

    is_daemon = arguments["--daemon"]
    database_path = arguments["<database_path>"]
예제 #2
0
# -*- coding: utf-8 -*-
import abc
from urlparse import urlparse

from keepass_http.core import Conf, logging
from keepass_http.crypto import AESCipher

log = logging.getLogger(__name__)


class AuthenticationError(Exception):
    pass


class InvalidAuthentication(AuthenticationError):
    pass


class NotAuthenticated(AuthenticationError):
    pass


class Request(object):
    __metaclass__ = abc.ABCMeta

    def __init__(self):
        self.__kpc = None
        self.__response_kpc = None
        self.__request_dict = {}
        self.__response_dict = {"Success": False}