I'm Alessandro Secco, a 23-year-old student in Computer Engineering.
), and I'm improving it day by day.
I exchanged some emails with Simon Bennet, and I started to look inside the code of Zest.
I noticed that now zest does not support complex conditionals, so I was wondering if it could be a nice idea to implement something similar.
Simon already told me that one of the most important aim of zest is to be esy, but I think that complex conditionals could be very useful for zest scripts.
I'd like to know your opinion about this and about my idea.
An example of the current way to express a conditionals is the followin (extracted by Bodgeit_Register_XSS.zst example):
{
"regex": "\\Q\u003cscript\u003ealert(1);\u003c/script\u003e\\E",
"location": "BODY",
"ifStatements": [
{
"message": "There is an XSS in the username field",
"index": 6,
"elementType": "ZestActionFail"
}
],
"elseStatements": [
{
"targetParameter": "",
"index": 7,
"elementType": "ZestActionScan"
}
],
"index": 5,
"elementType": "ZestConditionRegex"
}
Observe that there is no way to express combination of conditional.
I think that it could be possible to represent even complex and composed Conditionals encapsulating different "SimpleConditionals" in a
single "ComposedConditional".
A SimpleConditional could be a ZestConditionRegex, a ZestConditionResponseTime, a ZestConditionStatusCode or even a ZestConditionURL.
A ComposedConditional is a collection of SimpleConditional, connected by AND, OR, NOT criterias and parenthasis.
The main goal is to allow user to use even complex conditionals writing a Zest script in a very simple way.
I know that the first aim of Zest is to be easy, otherwise people will prefer to write java, python, ... programs, but I also think that
the usage of ComposedConditionals can be very useful and not too complicated to use in the creation of a zest script.
Currently I'm not sure about how to modify Zest syntax in order to allow ComposedConditionals, but I think that a possible syntax
could be something like the following (or something similar):
{
[
{
"regex": "\\Q\u003cscript\u003ealert(1);\u003c/script\u003e\\E",
"location": "BODY",
"index":3,
"elementType": "ZestConditionRegex"
}
"booleanOperator":"AND",
{
{
"code": 200,
"index": 4,
"elementType": "ZestConditionStatusCode"
}
"booleanOperator":"OR",
{
"booleanOperator"="NOT",
{
"greaterThan": true,
"timeInMs": 1000,
"index": 5,
"elementType":"ZestConditionResponseTime"
}
}
}
]
"ifStatements": [
{
"message": "example",
"index": 6,
"elementType": "ZestActionFail"
}
],
"elseStatements": [
{
"targetParameter": "",
"index": 7,
"elementType": "ZestActionScan"
}
],
"index": 8,
"elementType": "ZestComposedCondition"
}
I'm currently not sure about some things, for example if it is really needed to represent each SimpleConditional with a different element and an index or to encapsulate everything in the container "ZestComposedCondition"
What's your opinion about this?
About the creation of these ComposedConditional, I think that a BuilderPattern is perfect: easy to use and easy to develop.
every comment, idea, opinion, feedback and anything else is welcomed!
Cheers,
Alessandro.