added logging, parser, and test client
This commit is contained in:
@@ -6,6 +6,7 @@ import platform
|
||||
import json
|
||||
import configparser
|
||||
import getpass
|
||||
import logging
|
||||
from kmip.core import enums
|
||||
from kmip.demos import utils
|
||||
from kmip.pie import client
|
||||
@@ -225,7 +226,43 @@ if __name__ == "__main__":
|
||||
#accounts = config.sections()
|
||||
# decrypt all values for easy update a
|
||||
|
||||
if True:
|
||||
# Build and parse arguments
|
||||
parser = utils.build_cli_parser(enums.Operation.DECRYPT)
|
||||
parser.add_option(
|
||||
"-e",
|
||||
"--encrypt",
|
||||
action="store_true",
|
||||
dest="encrypt",
|
||||
help="Encrypt a passphrase/password."
|
||||
)
|
||||
parser.add_option(
|
||||
"-d",
|
||||
"--decrypt",
|
||||
action="store_true",
|
||||
dest="decrypt",
|
||||
help="Decrypt a passphrase/password."
|
||||
)
|
||||
parser.add_option (
|
||||
"-v",
|
||||
"--verbose",
|
||||
action="store_true",
|
||||
dest="debug",
|
||||
help="Output debug/verbose info to the console for troubleshooting."
|
||||
)
|
||||
opts, args = parser.parse_args(sys.argv[1:])
|
||||
if opts.debug:
|
||||
logger = utils.build_console_logger(logging.DEBUG)
|
||||
else:
|
||||
logger = utils.build_console_logger(logging.INFO)
|
||||
config = opts.config
|
||||
passphrase = opts.message
|
||||
print(script_directory + "/conf/client.conf")
|
||||
client = client.ProxyKmipClient(config=config, config_file=script_directory + "/conf/client.conf")
|
||||
client.open()
|
||||
print(encrypt(client, "test"))
|
||||
client.close()
|
||||
|
||||
if False:
|
||||
#if opts.config:
|
||||
if not does_file_exist(secrets_ini_file):
|
||||
print("No Bitwarden accounts found, do you want to make a new one?")
|
||||
|
||||
Reference in New Issue
Block a user