From 03a151ad62c45c4c0a286f27e19d5f74d917e98f Mon Sep 17 00:00:00 2001 From: NocteDefensor Date: Tue, 14 Nov 2023 16:30:53 -0600 Subject: [PATCH] This commit separates the functionality of saving template configuration and writing template configuration. This closes issue #181 --- certipy/commands/parsers/template.py | 6 +++++- certipy/commands/template.py | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) mode change 100755 => 100644 certipy/commands/parsers/template.py mode change 100755 => 100644 certipy/commands/template.py diff --git a/certipy/commands/parsers/template.py b/certipy/commands/parsers/template.py old mode 100755 new mode 100644 index d48441d..009aa2c --- a/certipy/commands/parsers/template.py +++ b/certipy/commands/parsers/template.py @@ -32,7 +32,11 @@ def add_subparser(subparsers: argparse._SubParsersAction) -> Tuple[str, Callable action="store_true", help="Save the old configuration", ) - + group.add_argument( + "-write-template", + action="store_true", + help="Write vulnerable properties to existing template or applies specified configuration to existing template", + ) group = subparser.add_argument_group("connection options") group.add_argument( "-scheme", diff --git a/certipy/commands/template.py b/certipy/commands/template.py old mode 100755 new mode 100644 index 7ecb365..77e6027 --- a/certipy/commands/template.py +++ b/certipy/commands/template.py @@ -60,6 +60,7 @@ def __init__( template: str = None, configuration: str = None, save_old: bool = False, + write_template: bool = False, scheme: str = "ldaps", connection: LDAPConnection = None, **kwargs, @@ -70,7 +71,7 @@ def __init__( self.save_old = save_old self.scheme = scheme self.kwargs = kwargs - + self.write_template = write_template self._connection = connection @property @@ -173,7 +174,8 @@ def set_configuration(self) -> bool: "Saved old configuration for %s to %s" % (repr(self.template_name), repr(out_file)) ) - + if self.write_template == False: + exit() changes = {} for key in old_configuration["raw_attributes"].keys(): if key in PROTECTED_ATTRIBUTES: