-
how to use s_size() primitive's argument 'math'?My code:
The problem I encounter:
|
Beta Was this translation helpful? Give feedback.
Answered by
SR4ven
Aug 1, 2022
Replies: 1 comment 1 reply
-
Sorry for the delayed answer @spwpun. I ran the following code using Python 3.10 and the current boofuzz master and it worked perfectly fine. s_initialize("bgp_openmessage")
if s_block_start("BGP"):
if s_block_start("Header"):
s_bytes(value=b"\xFF", padding=b"\xFF", size=16, name="Marker", fuzzable=False)
# The length should be calculated automatically:
# len is the open message length, 19 is the length of the header
s_size(block_name="Open", length=2, math=lambda x: x + 19, name="Length", fuzzable=False)
# s_size(block_name="Open", length=2, name="Length", fuzzable=False)
# s_word(value=4096, endian=BIG_ENDIAN, name="Length", fuzzable=True) # original field
# Type is always 1 for open messages
s_byte(value=0x01, endian=BIG_ENDIAN, name="Type", fuzzable=False)
s_block_end()
if s_block_start("Open"):
s_byte(b"1")
s_byte(b"2")
s_block_end("Open")
s_block_end() Which Python and boofuzz version are you using? |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
SR4ven
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for the delayed answer @spwpun.
I ran the following code using Python 3.10 and the current boofuzz master and it worked perfectly fine.