diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index 1c659309..59127d03 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -757,6 +757,9 @@ class AppBase: #return value.json() return {"success": False} + def set_file(self, infiles): + return self.set_files(infiles) + # Sets files in the backend def set_files(self, infiles): full_execution = self.full_execution @@ -1009,6 +1012,34 @@ class AppBase: return data.strip() if "split" in thistype: return data.split() + if "replace" in thistype: + print("Running replace!") + splitvalues = data.split(",") + + if len(splitvalues) > 2: + for i in range(len(splitvalues)): + if i != 0: + if splitvalues[i] == " ": + splitvalues[i] = " " + continue + + splitvalues[i] = splitvalues[i].strip() + + if splitvalues[i] == "\"\"": + splitvalues[i] = "" + if splitvalues[i] == "\" \"": + splitvalues[i] = " " + if len(splitvalues[i]) > 2: + if splitvalues[i][0] == "\"" and splitvalues[i][len(splitvalues[i])-1] == "\"": + splitvalues[i] = splitvalues[i][1:-1] + if splitvalues[i][0] == "'" and splitvalues[i][len(splitvalues[i])-1] == "'": + splitvalues[i] = splitvalues[i][1:-1] + + + replacementvalue = splitvalues[0] + return replacementvalue.replace(splitvalues[1], splitvalues[2], -1) + else: + return f"replace({data})" if "join" in thistype: print(f"SHOULD JOIN: {data}") try: @@ -1104,8 +1135,7 @@ class AppBase: except TypeError: return data, False - wrappers = ["int", "number", "lower", "upper", "trim", "strip", "split", "parse", "len", "length", "lenght", - "join"] + wrappers = ["int", "number", "lower", "upper", "trim", "strip", "split", "parse", "len", "length", "lenght", "join", "replace"] if not any(wrapper in data for wrapper in wrappers): return data, False @@ -2051,34 +2081,38 @@ class AppBase: print("KeyError body OpenAPI: %s" % e) pass + + print(f"""HANDLING {action["parameters"][counter]["value"]}""") try: newvalue = json.loads(action["parameters"][counter]["value"]) deletekeys = [] for key, value in newvalue.items(): + print(key, value) if isinstance(value, str) and len(value) == 0: deletekeys.append(key) continue + if value == "${%s}" % key: + print("Deleting %s because key = value") + deletekeys.append(key) + continue + for deletekey in deletekeys: del newvalue[deletekey] + print("Post delete: %s" % newvalue) + for key, value in newvalue.items(): + try: + value = json.loads(value) + newvalue[key] = value + except json.decoder.JSONDecodeError as e: + print("Inner overwrite issue: %s" % e) + action["parameters"][counter]["value"] = json.dumps(newvalue) except json.decoder.JSONDecodeError as e: print("Failed JSON replacement for OpenAPI keys (2) {e}") - #if "\n" in action["parameters"][counter]["value"]: - # print("MODIFYING BODY!!") - # newbody = "" - # for line in action["parameters"][counter]["value"].split("\n"): - # if ": \"\"" in line: - # print("Skipping line %s" % line) - # continue - - # newbody += line - - # print("New body: %s" % newbody) - break #print(action["parameters"]) diff --git a/backend/app_sdk/build.sh b/backend/app_sdk/build.sh index 55a612b1..7dab91cf 100644 --- a/backend/app_sdk/build.sh +++ b/backend/app_sdk/build.sh @@ -3,7 +3,7 @@ ### DEFAULT NAME=shuffle-app_sdk -VERSION=0.9.14 +VERSION=0.9.15 docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 55022474..0a01ac6a 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -3565,7 +3565,9 @@ func IterateAppGithubFolders(ctx context.Context, fs billy.Filesystem, dir []os. "OWA", "NLP", "YARA", + "ATTACK-PREDICTOR", } + //if strings.ToUpper(workflowapp.Name) == strings.ToUpper(appname) { // It's here to prevent getting them in every iteration buildLaterFirst := []shuffle.BuildLaterStruct{} diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 53317a73..352de397 100644 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -1326,7 +1326,7 @@ const ParsedAction = (props) => { */} - {(selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0 && selectedActionParameters[count].required === true && selectedActionParameters[count].unique_toggled !== undefined) || hideExtraTypes ? null : + {/*(selectedActionParameters[count].options !== undefined && selectedActionParameters[count].options !== null && selectedActionParameters[count].options.length > 0 && selectedActionParameters[count].required === true && selectedActionParameters[count].unique_toggled !== undefined) || hideExtraTypes ? null :
{}}> @@ -1349,7 +1349,7 @@ const ParsedAction = (props) => {
- } + */} {datafield} {showDropdown && showDropdownNumber === count && data.variant === "STATIC_VALUE" && jsonList.length > 0 ? diff --git a/frontend/src/views/Workflows.jsx b/frontend/src/views/Workflows.jsx index 4d896186..fcdd7121 100644 --- a/frontend/src/views/Workflows.jsx +++ b/frontend/src/views/Workflows.jsx @@ -91,10 +91,10 @@ export const GetIconInfo = (action) => { {"key": "merge", "values": ["join", "merge"]}, {"key": "search", "values": ["search", "find", "locate", "index", "analyze", "anal", "match"]}, {"key": "list", "values": ["list", "head", "options"]}, - {"key": "download", "values": ["capture", "get", "download", "return", "hello_world", "curl", "request", ]}, + {"key": "download", "values": ["capture", "get", "download", "return", "hello_world", "curl", "request", "export", "preview"]}, {"key": "add", "values": ["add"]}, {"key": "delete", "values": ["delete", "remove", "clear", "clean",]}, - {"key": "send", "values": ["send", "dispatch", "mail", "forward", "post", "submit", "mark", "set"]}, + {"key": "send", "values": ["send", "dispatch", "mail", "forward", "post", "submit", "mark", "set", "release", ]}, {"key": "repeat", "values": ["repeat", "retry", "pause", "skip", "copy", "replicat", ]}, {"key": "execute", "values": ["execute", "run", "play", "raise",]}, {"key": "extract", "values": ["extract", "unpack", "decompress", "open"]}, diff --git a/functions/extensions/aws-lambda/s3_function.py b/functions/extensions/aws-lambda/s3_function.py index c183cb89..c5e11cde 100644 --- a/functions/extensions/aws-lambda/s3_function.py +++ b/functions/extensions/aws-lambda/s3_function.py @@ -3,7 +3,7 @@ import urllib.parse import requests import os -#print('Loading function') +print('Loading function') def lambda_handler(event, context): #print("Received event: " + json.dumps(event, indent=2))