Skip to content

how to use s_size() primitive's argument 'math'? #633

Answered by SR4ven
spwpun asked this question in Q&A
Discussion options

You must be logged in to vote

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=T…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@spwpun
Comment options

Answer selected by SR4ven
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants