Compare commits

..

No commits in common. "dev-20261010" and "main" have entirely different histories.

3 changed files with 11 additions and 88 deletions

View file

@ -38,7 +38,6 @@ def action_db_create(
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
@ -61,10 +60,7 @@ def action_db_create(
)
)
}
),
{
"dry_run": options["dry_run"],
}
)
)
@ -73,14 +69,6 @@ def action_mkdir(
group_name,
options = None
):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec(
__helpers_misc.string_coin(
"keepassxc-cli mkdir{{macro_auth}} {{db_path}} {{group_name}}",
@ -89,10 +77,7 @@ def action_mkdir(
"group_name": group_name,
"macro_auth": macro_auth(options["key_file"]),
}
),
{
"dry_run": options["dry_run"],
}
)
)
@ -102,14 +87,6 @@ def action_add(
member_name,
options = None
):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec(
__helpers_misc.string_coin(
"keepassxc-cli add{{macro_auth}} {{db_path}} {{entry}}",
@ -118,10 +95,7 @@ def action_add(
"entry": compose_entry(group_name, member_name),
"macro_auth": macro_auth(options["key_file"]),
}
),
{
"dry_run": options["dry_run"],
}
)
)
@ -131,14 +105,6 @@ def action_rm(
member_name,
options = None
):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec(
__helpers_misc.string_coin(
"keepassxc-cli rm{{macro_auth}} {{db_path}} {{entry}}",
@ -147,10 +113,7 @@ def action_rm(
"entry": compose_entry(group_name, member_name),
"macro_auth": macro_auth(options["key_file"]),
}
),
{
"dry_run": options["dry_run"],
}
)
)
@ -162,14 +125,6 @@ def action_attachment_import(
attachment_path,
options = None
):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec(
__helpers_misc.string_coin(
"keepassxc-cli attachment-import{{macro_auth}} {{db_path}} {{entry}} '{{attachment_label}}' {{attachment_path}}",
@ -180,8 +135,5 @@ def action_attachment_import(
"attachment_path": attachment_path,
"macro_auth": macro_auth(options["key_file"]),
}
),
{
"dry_run": options["dry_run"],
}
)
)

View file

@ -43,19 +43,8 @@ def directory_create(path):
def shell_exec(
command,
options = None
command
):
options = (
{
"dry_run": False,
}
|
(options or {})
)
_sys.stderr.write("\n>> %s\n" % command)
if (options["dry_run"]):
pass
else:
_os.system(command)

View file

@ -11,8 +11,7 @@ import helpers.keepass as __helpers_keepass
def action_init(
source_directory,
database_file_name
source_directory
):
keepass_db_path = _os.path.join(source_directory, "private_keys.kdbx")
keepass_authfile_path = _os.path.join(source_directory, "private_keys.keyx")
@ -38,13 +37,11 @@ def action_key_add(
group,
name,
key_path,
keepass_db_path,
options = None
):
options = (
{
"remove_private_key": False,
"dry_run": False,
}
|
(options or {})
@ -55,15 +52,13 @@ def action_key_add(
__helpers_misc.directory_create(directory_key)
## transfer private key to keepass database
if True:
# keepass_db_path = _os.path.join(source_directory, "private_keys.kdbx")
# keepass_authfile_path = _os.path.join(source_directory, "private_keys.keyx")
keepass_authfile_path = None # (keepass_db_path + ".auth")
keepass_db_path = _os.path.join(source_directory, "private_keys.kdbx")
keepass_authfile_path = _os.path.join(source_directory, "private_keys.keyx")
__helpers_keepass.action_mkdir(
keepass_db_path,
group,
{
"key_file": keepass_authfile_path,
"dry_run": options["dry_run"],
}
)
__helpers_keepass.action_add(
@ -72,7 +67,6 @@ def action_key_add(
name,
{
"key_file": keepass_authfile_path,
"dry_run": options["dry_run"],
}
)
__helpers_keepass.action_attachment_import(
@ -83,7 +77,6 @@ def action_key_add(
path_key_private,
{
"key_file": keepass_authfile_path,
"dry_run": options["dry_run"],
}
)
## remove private key file
@ -94,10 +87,7 @@ def action_key_add(
{
"path": path_key_private,
}
),
{
"dry_run": options["dry_run"],
}
)
)
@ -283,12 +273,6 @@ def main():
metavar = "<action>",
help = "options: init | key-add | key-generate | key-remove | put",
)
argument_parser.add_argument(
"-q",
"--dry-run",
action = "store_true",
default = False,
)
argument_parser.add_argument(
"-s",
"--source-directory",
@ -349,10 +333,8 @@ def main():
args.group,
args.name,
args.key_path,
args.target_file,
{
"remove_private_key": args.remove_private_key,
"dry_run": args.dry_run,
}
)
elif (args.action == "key-generate"):