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 = ( options = (
{ {
"key_file": None, "key_file": None,
"dry_run": False,
} }
| |
(options or {}) (options or {})
@ -61,10 +60,7 @@ def action_db_create(
) )
) )
} }
), )
{
"dry_run": options["dry_run"],
}
) )
@ -73,14 +69,6 @@ def action_mkdir(
group_name, group_name,
options = None options = None
): ):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec( __helpers_misc.shell_exec(
__helpers_misc.string_coin( __helpers_misc.string_coin(
"keepassxc-cli mkdir{{macro_auth}} {{db_path}} {{group_name}}", "keepassxc-cli mkdir{{macro_auth}} {{db_path}} {{group_name}}",
@ -89,10 +77,7 @@ def action_mkdir(
"group_name": group_name, "group_name": group_name,
"macro_auth": macro_auth(options["key_file"]), "macro_auth": macro_auth(options["key_file"]),
} }
), )
{
"dry_run": options["dry_run"],
}
) )
@ -102,14 +87,6 @@ def action_add(
member_name, member_name,
options = None options = None
): ):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec( __helpers_misc.shell_exec(
__helpers_misc.string_coin( __helpers_misc.string_coin(
"keepassxc-cli add{{macro_auth}} {{db_path}} {{entry}}", "keepassxc-cli add{{macro_auth}} {{db_path}} {{entry}}",
@ -118,10 +95,7 @@ def action_add(
"entry": compose_entry(group_name, member_name), "entry": compose_entry(group_name, member_name),
"macro_auth": macro_auth(options["key_file"]), "macro_auth": macro_auth(options["key_file"]),
} }
), )
{
"dry_run": options["dry_run"],
}
) )
@ -131,14 +105,6 @@ def action_rm(
member_name, member_name,
options = None options = None
): ):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec( __helpers_misc.shell_exec(
__helpers_misc.string_coin( __helpers_misc.string_coin(
"keepassxc-cli rm{{macro_auth}} {{db_path}} {{entry}}", "keepassxc-cli rm{{macro_auth}} {{db_path}} {{entry}}",
@ -147,10 +113,7 @@ def action_rm(
"entry": compose_entry(group_name, member_name), "entry": compose_entry(group_name, member_name),
"macro_auth": macro_auth(options["key_file"]), "macro_auth": macro_auth(options["key_file"]),
} }
), )
{
"dry_run": options["dry_run"],
}
) )
@ -162,14 +125,6 @@ def action_attachment_import(
attachment_path, attachment_path,
options = None options = None
): ):
options = (
{
"key_file": None,
"dry_run": False,
}
|
(options or {})
)
__helpers_misc.shell_exec( __helpers_misc.shell_exec(
__helpers_misc.string_coin( __helpers_misc.string_coin(
"keepassxc-cli attachment-import{{macro_auth}} {{db_path}} {{entry}} '{{attachment_label}}' {{attachment_path}}", "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, "attachment_path": attachment_path,
"macro_auth": macro_auth(options["key_file"]), "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( def shell_exec(
command, command
options = None
): ):
options = (
{
"dry_run": False,
}
|
(options or {})
)
_sys.stderr.write("\n>> %s\n" % command) _sys.stderr.write("\n>> %s\n" % command)
if (options["dry_run"]): _os.system(command)
pass
else:
_os.system(command)

View file

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