From 6a0760224b6337c4436c9b7d9f61890964cf5c88 Mon Sep 17 00:00:00 2001 From: Kyle Kotowick Date: Thu, 29 Jul 2021 20:41:57 -0400 Subject: [PATCH] Strip control characters from return JSON on Linux --- LICENSE.md | 4 ++-- run.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 5f5d351..7639b4a 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ -# Creative Commons Attribution 4.0 International +### Copyright (c) 2021 [Invicton Labs](https://invictonlabs.com) -Copyright (c) 2021 Invicton Labs (https://invictonlabs.com) +# Creative Commons Attribution 4.0 International Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. diff --git a/run.sh b/run.sh index 38019bb..c9a4b87 100644 --- a/run.sh +++ b/run.sh @@ -36,7 +36,7 @@ if [ "$_exitonfail" = "true" ] && [ $_exitcode -ne 0 ] ; then fi # Replace characters that can't be handled in JSON -_stderr=$(echo "$_stderr" | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g') -_stdout=$(echo "$_stdout" | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g') +_stderr=$(echo "$_stderr" | tr -d '\000-\010\013\014\016-\037' | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g') +_stdout=$(echo "$_stdout" | tr -d '\000-\010\013\014\016-\037' | sed -z 's/\n/__TF_MAGIC_NEWLINE_STRING/g;s/\r/__TF_MAGIC_CR_STRING/g;s/\t/__TF_MAGIC_TAB_STRING/g;s/\\/__TF_MAGIC_BACKSLASH_STRING/g;s/\"/__TF_MAGIC_QUOTE_STRING/g') echo -n "{\"stderr\": \"$_stderr\", \"stdout\": \"$_stdout\", \"exitcode\": \"$_exitcode\"}"