How to use the boofuzz.blocks.CURRENT.push function in boofuzz

To help you get started, we’ve selected a few boofuzz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
:type  size:     int
    :param size:     (Optional, def=-1) Static size of this field, leave -1 for dynamic.
    :type  padding:  Character
    :param padding:  (Optional, def="\\x00") Value to use as padding to fill static field size.
    :type  encoding: str
    :param encoding: (Optonal, def="ascii") String encoding, ex: utf_16_le for Microsoft Unicode.
    :type  fuzzable: bool
    :param fuzzable: (Optional, def=True) Enable/disable fuzzing of this primitive
    :type  max_len:  int
    :param max_len:  (Optional, def=0) Maximum string length
    :type  name:     str
    :param name:     (Optional, def=None) Specifying a name gives you direct access to a primitive
    """

    s = primitives.String(value, size, padding, encoding, fuzzable, max_len, name)
    blocks.CURRENT.push(s)
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
def s_static(value, name=None):
    """
    Push a static value onto the current block stack.

    :see: Aliases: s_dunno(), s_raw(), s_unknown()

    :type  value: Raw
    :param value: Raw static data
    :type  name:  str
    :param name:  (Optional, def=None) Specifying a name gives you direct access to a primitive
    """

    static = primitives.Static(value, name)
    blocks.CURRENT.push(static)
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
:type  value:    str
    :param value:    Default string value
    :type  encoding: str
    :param encoding: (Optonal, def="ascii") String encoding, ex: utf_16_le for Microsoft Unicode.
    :type  fuzzable: bool
    :param fuzzable: (Optional, def=True) Enable/disable fuzzing of this primitive
    :type  max_len:  int
    :param max_len:  (Optional, def=0) Maximum string length
    :type  name:     str
    :param name:     (Optional, def=None) Specifying a name gives you direct access to a primitive
    :type  filename: str
    :param filename: (Mandatory) Specify filename where to read fuzz list
    """

    s = primitives.FromFile(value, encoding, fuzzable, max_len, name, filename)
    blocks.CURRENT.push(s)
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
def s_mirror(primitive_name, name=None):
    """
    Push a mirror of another primitive onto the current block stack.

    :type primitive_name:   str
    :param primitive_name:  Name of target primitive
    :type name:             str
    :param name:            (Optional, def=None) Name of current primitive
    """
    if primitive_name not in blocks.CURRENT.names:
        raise exception.SullyRuntimeError("CAN NOT ADD A MIRROR FOR A NON-EXIST PRIMITIVE CURRENTLY")

    mirror = primitives.Mirror(primitive_name, blocks.CURRENT, name)
    blocks.CURRENT.push(mirror)
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
parsed = parsed.replace("\t", "")
    parsed = parsed.replace("\r", "")
    parsed = parsed.replace("\n", "")
    parsed = parsed.replace(",", "")
    parsed = parsed.replace("0x", "")
    parsed = parsed.replace("\\x", "")

    value = b""
    while parsed:
        pair = parsed[:2]
        parsed = parsed[2:]

        value += six.int2byte(int(pair, 16))

    static = primitives.Static(value, name)
    blocks.CURRENT.push(static)
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
:type  endian:         Character
    :param endian:         (Optional, def=LITTLE_ENDIAN) Endianess of the bit field (LITTLE_ENDIAN: <, BIG_ENDIAN: >)
    :type  output_format:  str
    :param output_format:  (Optional, def=binary) Output format, "binary" or "ascii"
    :type  signed:         bool
    :param signed:         (Optional, def=False) Make size signed vs. unsigned (applicable only with format="ascii")
    :type  full_range:     bool
    :param full_range:     (Optional, def=False) If enabled the field mutates through *all* possible values.
    :type  fuzzable:       bool
    :param fuzzable:       (Optional, def=True) Enable/disable fuzzing of this primitive
    :type  name:           str
    :param name:           (Optional, def=None) Specifying a name gives you direct access to a primitive
    """

    bit_field = primitives.BitField(value, width, None, endian, output_format, signed, full_range, fuzzable, name)
    blocks.CURRENT.push(bit_field)
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
:type  endian:        Character
    :param endian:        (Optional, def=LITTLE_ENDIAN) Endianess of the bit field (LITTLE_ENDIAN: <, BIG_ENDIAN: >)
    :type  output_format: str
    :param output_format: (Optional, def=binary) Output format, "binary" or "ascii"
    :type  signed:        bool
    :param signed:        (Optional, def=False) Make size signed vs. unsigned (applicable only with format="ascii")
    :type  full_range:    bool
    :param full_range:    (Optional, def=False) If enabled the field mutates through *all* possible values.
    :type  fuzzable:      bool
    :param fuzzable:      (Optional, def=True) Enable/disable fuzzing of this primitive
    :type  name:          str
    :param name:          (Optional, def=None) Specifying a name gives you direct access to a primitive
    """

    dword = primitives.DWord(value, endian, output_format, signed, full_range, fuzzable, name)
    blocks.CURRENT.push(dword)
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
def s_block_start(name, *args, **kwargs):
    """
    Open a new block under the current request. This routine always returns an instance so you can make your fuzzer
    pretty with indenting::

        if s_block_start("header"):
            s_static("\\x00\\x01")
            if s_block_start("body"):
                ...
        s_block_close()

    :note Prefer using s_block to this function directly
    :see s_block
    """
    block = Block(name, blocks.CURRENT, *args, **kwargs)
    blocks.CURRENT.push(block)

    return block