In boofuzz, I'm trying to create nested s_block based on selected value from a s_group.
I'm getting two errors,
1) BLOCK NAME ALREADY EXISTS: 1,
when I try to use two groups having same opcodes. I have a outer s_group containing possible opcode values ["1", "2", "3"] and inner s_group having possible values ["1", "2"]
2) I want use the value inside the s_block to depend on value selected in the s_group.
The code I'm using is below:-
s_initialize(name="LOGIN-RQ")
with s_block("LOGIN"):
s_group("Priority", ["1","2","3"])
if(s_block_start("1", dep="Priority", dep_value="1", dep_compare="==")):
# handle '1' - for A priority
s_static("A")
s_group("Type", ["1","2"])
# handle '11 - for A priority Emergency'
if(s_block_start("1", dep="Type", dep_value="1", dep_compare="==")):
s_static("Emergency")
s_static("#")
s_string("1ab121-2345-2212-123ad21") # auth id
s_static("#")
s_static("Registered")
s_block_end()
if(s_block_start("2", dep_value="2", dep_compare="==")):
s_static("Frequent")
s_block_end()
s_block_end()
if(s_block_start("2", dep="Priority", dep_value="2", dep_compare="==")):
s_static("B")
s_block_end()
if(s_block_start("3")):
s_static("C")
s_group("Category", ["1","2"])
if(s_block_start("1", dep="Category", dep_value="1", dep_compare="==")):
s_static("Anonymous")
# handle anonymous category
s_block_end()
if(s_block_start("2", dep="Category", dep_value="2", dep_compare="==")):
s_static("Registered")
s_block_end()
s_block_end()
session.connect(session.root, s_get("LOGIN-RQ"))
session.fuzz()
Expected Possible Results:-
1A1Emergency#1ab121-2345-2212-123ad21#Registered
1A2Frequent
2B
3C1Anonymous
3C2Registered
Kindly help
Yay!
Finally got it.
I had to update the block name & provide group names to those blocks, then everything started working. This code covers all the anticipated possible scenarios.
Posting the working code here, hope this will help be helpful