@@ -2787,9 +2787,6 @@ class AppBase:
|
|||||||
correct_branches += 1
|
correct_branches += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# FIXME: Check if the previous node has a result or not
|
|
||||||
|
|
||||||
#self.logger.info("[DEBUG] Relevant conditions: %s" % branch["conditions"])
|
|
||||||
successful_conditions = []
|
successful_conditions = []
|
||||||
failed_conditions = []
|
failed_conditions = []
|
||||||
successful_conditions = 0
|
successful_conditions = 0
|
||||||
@@ -2802,27 +2799,20 @@ class AppBase:
|
|||||||
check, sourcevalue, is_loop = parse_params(action, fullexecution, condition["source"], self)
|
check, sourcevalue, is_loop = parse_params(action, fullexecution, condition["source"], self)
|
||||||
if check:
|
if check:
|
||||||
continue
|
continue
|
||||||
return False, {"success": False, "reason": "Failed condition: %s %s %s because %s" % (sourcevalue, condition["condition"]["value"], destinationvalue, check)}
|
|
||||||
|
|
||||||
#sourcevalue = sourcevalue.encode("utf-8")
|
|
||||||
sourcevalue = parse_wrapper_start(sourcevalue, self)
|
sourcevalue = parse_wrapper_start(sourcevalue, self)
|
||||||
destinationvalue = condition["destination"]["value"]
|
destinationvalue = condition["destination"]["value"]
|
||||||
|
|
||||||
check, destinationvalue, is_loop = parse_params(action, fullexecution, condition["destination"], self)
|
check, destinationvalue, is_loop = parse_params(action, fullexecution, condition["destination"], self)
|
||||||
if check:
|
if check:
|
||||||
continue
|
continue
|
||||||
return False, {"success": False, "reason": "Failed condition: %s %s %s because %s" % (sourcevalue, condition["condition"]["value"], destinationvalue, check)}
|
|
||||||
|
|
||||||
#destinationvalue = destinationvalue.encode("utf-8")
|
|
||||||
destinationvalue = parse_wrapper_start(destinationvalue, self)
|
destinationvalue = parse_wrapper_start(destinationvalue, self)
|
||||||
|
|
||||||
if not condition["condition"]["value"] in available_checks:
|
if not condition["condition"]["value"] in available_checks:
|
||||||
self.logger.warning("Skipping %s %s %s because %s is invalid." % (sourcevalue, condition["condition"]["value"], destinationvalue, condition["condition"]["value"]))
|
self.logger.warning("Skipping %s %s %s because %s is invalid." % (sourcevalue, condition["condition"]["value"], destinationvalue, condition["condition"]["value"]))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#self.logger.info(destinationvalue)
|
|
||||||
# NEGATE
|
|
||||||
|
|
||||||
# Configuration = negated because of WorkflowAppActionParam..
|
# Configuration = negated because of WorkflowAppActionParam..
|
||||||
validation = run_validation(sourcevalue, condition["condition"]["value"], destinationvalue)
|
validation = run_validation(sourcevalue, condition["condition"]["value"], destinationvalue)
|
||||||
try:
|
try:
|
||||||
@@ -2834,12 +2824,6 @@ class AppBase:
|
|||||||
if validation == True:
|
if validation == True:
|
||||||
successful_conditions += 1
|
successful_conditions += 1
|
||||||
|
|
||||||
#if not validation:
|
|
||||||
# self.logger.info("Failed condition check for %s %s %s." % (sourcevalue, condition["condition"]["value"], destinationvalue))
|
|
||||||
# return False, {"success": False, "reason": "Failed condition (3): %s %s %s" % (sourcevalue, condition["condition"]["value"], destinationvalue)}
|
|
||||||
|
|
||||||
#self.logger.info("CONDITIONS VS SUCCESS: %d vs %d" % (total_conditions, successful_conditions))
|
|
||||||
|
|
||||||
if total_conditions == successful_conditions:
|
if total_conditions == successful_conditions:
|
||||||
correct_branches += 1
|
correct_branches += 1
|
||||||
|
|
||||||
@@ -2849,15 +2833,9 @@ class AppBase:
|
|||||||
if matching_branches > 0 and correct_branches > 0:
|
if matching_branches > 0 and correct_branches > 0:
|
||||||
return True, ""
|
return True, ""
|
||||||
|
|
||||||
# FIXME: Check if previous branches are at all finished
|
|
||||||
|
|
||||||
self.logger.info("[DEBUG] Correct branches vs matching branches: %d vs %d" % (correct_branches, matching_branches))
|
self.logger.info("[DEBUG] Correct branches vs matching branches: %d vs %d" % (correct_branches, matching_branches))
|
||||||
return False, {"success": False, "reason": "Minimum of one branch's conditions must be correct to continue. Total: %d of %d" % (correct_branches, matching_branches)}
|
return False, {"success": False, "reason": "Minimum of one branch's conditions must be correct to continue. Total: %d of %d" % (correct_branches, matching_branches)}
|
||||||
|
|
||||||
#Correct branches vs matching branches: 1 vs 1
|
|
||||||
#if
|
|
||||||
return True, ""
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import {
|
|||||||
Divider,
|
Divider,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Chip,
|
Chip,
|
||||||
|
ButtonGroup,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { useAlert } from "react-alert";
|
import { useAlert } from "react-alert";
|
||||||
|
|
||||||
@@ -53,7 +54,25 @@ const responsive = {
|
|||||||
const WelcomeForm = (props) => {
|
const WelcomeForm = (props) => {
|
||||||
const { userdata, globalUrl, discoveryWrapper, setDiscoveryWrapper, appFramework, getFramework, activeStep, setActiveStep, steps, skipped, setSkipped, getApps, apps, handleSetSearch, usecaseButtons, defaultSearch, setDefaultSearch, selectionOpen, setSelectionOpen, } = props
|
const { userdata, globalUrl, discoveryWrapper, setDiscoveryWrapper, appFramework, getFramework, activeStep, setActiveStep, steps, skipped, setSkipped, getApps, apps, handleSetSearch, usecaseButtons, defaultSearch, setDefaultSearch, selectionOpen, setSelectionOpen, } = props
|
||||||
|
|
||||||
const usecaseItems = [
|
const [usecaseItems, setUsecaseItems] = useState([
|
||||||
|
{
|
||||||
|
"search": "Phishing",
|
||||||
|
"usecase_search": undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"search": "Enrichment",
|
||||||
|
"usecase_search": undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"search": "Enrichment",
|
||||||
|
"usecase_search": "SIEM alert enrichment",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"search": "Build your own",
|
||||||
|
"usecase_search": undefined,
|
||||||
|
}])
|
||||||
|
|
||||||
|
/*
|
||||||
<div style={{minWidth: "95%", maxWidth: "95%", marginLeft: 5, marginRight: 5, }}>
|
<div style={{minWidth: "95%", maxWidth: "95%", marginLeft: 5, marginRight: 5, }}>
|
||||||
<UsecaseSearch
|
<UsecaseSearch
|
||||||
globalUrl={globalUrl}
|
globalUrl={globalUrl}
|
||||||
@@ -98,7 +117,8 @@ const WelcomeForm = (props) => {
|
|||||||
userdata={userdata}
|
userdata={userdata}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
]
|
])
|
||||||
|
*/
|
||||||
|
|
||||||
const [discoveryData, setDiscoveryData] = React.useState({})
|
const [discoveryData, setDiscoveryData] = React.useState({})
|
||||||
const [name, setName] = React.useState("")
|
const [name, setName] = React.useState("")
|
||||||
@@ -166,6 +186,43 @@ const WelcomeForm = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
//navigate(`/welcome?tab=1`)
|
//navigate(`/welcome?tab=1`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const foundTemplate = params["workflow_template"];
|
||||||
|
if (foundTemplate !== null && foundTemplate !== undefined) {
|
||||||
|
console.log("Found workflow template: ", foundTemplate)
|
||||||
|
|
||||||
|
var sourceapp = undefined
|
||||||
|
var destinationapp = undefined
|
||||||
|
var action = undefined
|
||||||
|
const srcapp = params["source_app"];
|
||||||
|
if (srcapp !== null && srcapp !== undefined) {
|
||||||
|
sourceapp = srcapp
|
||||||
|
}
|
||||||
|
|
||||||
|
const dstapp = params["dest_app"];
|
||||||
|
if (dstapp !== null && dstapp !== undefined) {
|
||||||
|
destinationapp = dstapp
|
||||||
|
}
|
||||||
|
|
||||||
|
const act = params["action"];
|
||||||
|
if (act !== null && act !== undefined) {
|
||||||
|
action = act
|
||||||
|
}
|
||||||
|
|
||||||
|
//defaultSearch={foundTemplate}
|
||||||
|
//
|
||||||
|
usecaseItems[0] = {
|
||||||
|
"search": "enrichment",
|
||||||
|
"usecase_search": foundTemplate,
|
||||||
|
"sourceapp": sourceapp,
|
||||||
|
"destinationapp": destinationapp,
|
||||||
|
"autotry": action === "try",
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Adding: ", usecaseItems[0])
|
||||||
|
|
||||||
|
setUsecaseItems(usecaseItems)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@@ -417,6 +474,26 @@ const WelcomeForm = (props) => {
|
|||||||
maxWidth: buttonWidth,
|
maxWidth: buttonWidth,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const formattedCarousel = appFramework === undefined || appFramework === null ? [] : usecaseItems.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<div style={{minWidth: "95%", maxWidth: "95%", marginLeft: 5, marginRight: 5, }}>
|
||||||
|
<UsecaseSearch
|
||||||
|
globalUrl={globalUrl}
|
||||||
|
defaultSearch={item.search}
|
||||||
|
usecaseSearch={item.usecase_search}
|
||||||
|
appFramework={appFramework}
|
||||||
|
apps={apps}
|
||||||
|
getFramework={getFramework}
|
||||||
|
userdata={userdata}
|
||||||
|
autotry={item.autotry}
|
||||||
|
sourceapp={item.sourceapp}
|
||||||
|
destinationapp={item.destinationapp}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
const getStepContent = (step) => {
|
const getStepContent = (step) => {
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -676,10 +753,10 @@ const WelcomeForm = (props) => {
|
|||||||
<div style={{minWidth: 554, maxWidth: 554, borderRadius: theme.palette.borderRadius, padding: 25, }}>
|
<div style={{minWidth: 554, maxWidth: 554, borderRadius: theme.palette.borderRadius, padding: 25, }}>
|
||||||
<AliceCarousel
|
<AliceCarousel
|
||||||
style={{ backgroundColor: theme.palette.surfaceColor, minHeight: 750, maxHeight: 750, }}
|
style={{ backgroundColor: theme.palette.surfaceColor, minHeight: 750, maxHeight: 750, }}
|
||||||
items={usecaseItems}
|
items={formattedCarousel}
|
||||||
activeIndex={thumbIndex}
|
activeIndex={thumbIndex}
|
||||||
infiniteLoop
|
infiniteLoop
|
||||||
mouseTracking
|
mouseTracking={false}
|
||||||
responsive={responsive}
|
responsive={responsive}
|
||||||
// activeIndex={activeIndex}
|
// activeIndex={activeIndex}
|
||||||
controlsStrategy="responsive"
|
controlsStrategy="responsive"
|
||||||
@@ -688,7 +765,6 @@ const WelcomeForm = (props) => {
|
|||||||
animationType="fadeout"
|
animationType="fadeout"
|
||||||
animationDuration={800}
|
animationDuration={800}
|
||||||
disableButtonsControls
|
disableButtonsControls
|
||||||
disableDotsControls
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -721,6 +797,7 @@ const WelcomeForm = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const extraHeight = isCloud ? -7 : 0
|
||||||
return (
|
return (
|
||||||
<div style={{}}>
|
<div style={{}}>
|
||||||
{/*selectionOpen ?
|
{/*selectionOpen ?
|
||||||
@@ -756,7 +833,7 @@ const WelcomeForm = (props) => {
|
|||||||
disabled={activeStep === 0}
|
disabled={activeStep === 0}
|
||||||
onClick={handleBack}
|
onClick={handleBack}
|
||||||
variant={"outlined"}
|
variant={"outlined"}
|
||||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600 : -577, left: activeStep === 1 ? 105 : -145+clickdiff, }}
|
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600-extraHeight : -577, left: activeStep === 1 ? 105 : -145+clickdiff, borderRadius: "50px 0px 0px 50px", }}
|
||||||
>
|
>
|
||||||
Back
|
Back
|
||||||
</Button>
|
</Button>
|
||||||
@@ -764,7 +841,7 @@ const WelcomeForm = (props) => {
|
|||||||
variant={"outlined"}
|
variant={"outlined"}
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={handleNext}
|
onClick={handleNext}
|
||||||
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600: -577, left: activeStep === 1 ? 748 : 510+clickdiff, }}
|
style={{marginLeft: 10, height: 64, width: 100, position: "absolute", top: activeStep === 1 ? -600-extraHeight: -577, left: activeStep === 1 ? 748 : 510+clickdiff, borderRadius: "0px 50px 50px 0px", }}
|
||||||
disabled={activeStep === 0 ? orgName.length === 0 || name.length === 0 : false}
|
disabled={activeStep === 0 ? orgName.length === 0 || name.length === 0 : false}
|
||||||
>
|
>
|
||||||
{activeStep === steps.length - 1 ? "Finish" : "Next"}
|
{activeStep === steps.length - 1 ? "Finish" : "Next"}
|
||||||
|
|||||||
Reference in New Issue
Block a user