Skip to content

Commit 2cae4b4

Browse files
committed
Fixed item problem with parse-ioc
1 parent d919784 commit 2cae4b4

File tree

2 files changed

+34
-20
lines changed
  • shuffle-subflow/1.1.0/src
  • shuffle-tools/1.2.0/src

2 files changed

+34
-20
lines changed

shuffle-subflow/1.1.0/src/app.py

+32-20
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
2929
"User-Agent": "Shuffle Userinput 1.1.0",
3030
}
3131

32+
3233
result = {
3334
"success": True,
3435
"source": "userinput",
@@ -40,6 +41,11 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
4041
"ip": "",
4142
"user": "",
4243
"note": "",
44+
},
45+
"links": {
46+
"frontend_no_answer": "",
47+
"api_continue": "",
48+
"api_abort": "",
4349
}
4450
}
4551

@@ -50,26 +56,32 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
5056
if len(str(backend_url)) > 0:
5157
url = backend_url
5258

53-
print("Found backend url: %s" % url)
54-
#print("AUTH: %s" % self.full_execution["authorization"])
55-
#if len(information):
56-
# print("Should run arg: %s", information)
59+
frontend_url = url
60+
if ":5001" in frontend_url:
61+
print("Should change port to 3001.")
62+
if "appspot.com" in frontend_url:
63+
frontend_url = "https://shuffler.io"
64+
if "run.app" in frontend_url:
65+
frontend_url = "https://shuffler.io"
66+
if "ngrok" in frontend_url:
67+
frontend_url = ""
68+
69+
explore_path = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
70+
frontend_continue_url = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
71+
frontend_abort_url = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
72+
api_continue_url = "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
73+
api_abort_url = "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
74+
75+
result["links"]["frontend_no_answer"] = explore_path
76+
result["links"]["frontend_continue"] = frontend_continue_url
77+
result["links"]["frontend_abort"] = frontend_abort_url
78+
result["links"]["api_continue"] = api_continue_url
79+
result["links"]["api_abort"] = api_abort_url
5780

81+
print("Found backend url: %s" % url)
5882
if len(subflow) > 0:
59-
#print("Should run subflow: %s", subflow)
60-
61-
# Missing startnode (user input trigger)
62-
#print("Subflows to run from userinput: ", subflows)
6383

6484
subflows = subflow.split(",")
65-
frontend_url = url
66-
if ":5001" in frontend_url:
67-
print("Should change port to 3001.")
68-
if "appspot.com" in frontend_url:
69-
frontend_url = "https://shuffler.io"
70-
if "run.app" in frontend_url:
71-
frontend_url = "https://shuffler.io"
72-
7385
for item in subflows:
7486
# In case of URL being passed, and not just ID
7587
if "/" in item:
@@ -80,10 +92,10 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
8092
argument = json.dumps({
8193
"information": information,
8294
"parent_workflow": self.full_execution["workflow"]["id"],
83-
"frontend_continue": "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node),
84-
"frontend_abort": "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node),
85-
"api_continue": "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node),
86-
"api_abort": "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node),
95+
"frontend_continue": frontend_continue_url,
96+
"frontend_abort": frontend_abort_url,
97+
"api_continue": api_continue_url,
98+
"api_abort": api_abort_url,
8799
})
88100

89101
ret = self.run_subflow(user_apikey, item, argument, source_workflow=self.full_execution["workflow"]["id"], source_execution=self.full_execution["execution_id"], source_auth=self.full_execution["authorization"], startnode=startnode, backend_url=backend_url, source_node=source_node)

shuffle-tools/1.2.0/src/app.py

+2
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,8 @@ def parse_ioc(self, input_string, input_type="all"):
24802480
else:
24812481
input_type = input_type.split(",")
24822482
for i in range(len(input_type)):
2483+
item = input_type[i]
2484+
24832485
item = item.strip()
24842486
if not item.endswith("s"):
24852487
item = "%ss" % item

0 commit comments

Comments
 (0)