Modify the load_community_scripts logic to add
env and run_as_user keys.
This commit is contained in:
Charlie Powell 2024-08-15 00:41:04 -04:00
parent 751b0ef716
commit 9054c233f4
No known key found for this signature in database
GPG Key ID: E341387C3DB42462
1 changed files with 8 additions and 0 deletions

View File

@ -118,8 +118,12 @@ class Script(BaseAuditModel):
args = script["args"] if "args" in script.keys() else []
env = script["env"] if "env" in script.keys() else []
syntax = script["syntax"] if "syntax" in script.keys() else ""
run_as_user = script["run_as_user"] if "run_as_user" in script.keys() else False
supported_platforms = (
script["supported_platforms"]
if "supported_platforms" in script.keys()
@ -135,7 +139,9 @@ class Script(BaseAuditModel):
i.shell = script["shell"]
i.default_timeout = default_timeout
i.args = args
i.env_vars = env
i.syntax = syntax
i.run_as_user = run_as_user
i.filename = script["filename"]
i.supported_platforms = supported_platforms
@ -163,8 +169,10 @@ class Script(BaseAuditModel):
category=category,
default_timeout=default_timeout,
args=args,
env_vars=env,
filename=script["filename"],
syntax=syntax,
run_as_user=run_as_user,
supported_platforms=supported_platforms,
)
# new_script.hash_script_body() # also saves script