How to use the boofuzz.exception.SullyRuntimeError 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 / legos / misc.py View on Github external
def __init__(self, name, request, value, options=None):
        if not options:
            options = {}

        super(DNSHostname).__init__(name, request)

        self.value = value
        self.options = options

        if not self.value:
            raise exception.SullyRuntimeError("MISSING LEGO.tag DEFAULT VALUE")

        self.push(primitives.String(self.value))
github jtpereyda / boofuzz / boofuzz / blocks / request.py View on Github external
def original_value(self):
        # ensure there are no open blocks lingering.
        if self.block_stack:
            raise exception.SullyRuntimeError("UNCLOSED BLOCK: %s" % self.block_stack[-1].name)

        self._rendered = b""

        for item in self.stack:
            self._rendered += helpers.str_to_bytes(item.original_value)

        return self._rendered
github jtpereyda / boofuzz / boofuzz / sessions.py View on Github external
def _iterate_messages(self):
        """Iterates over each message without mutations.

        :raise sex.SullyRuntimeError:
        """
        if not self.targets:
            raise exception.SullyRuntimeError("No targets specified in session")

        if not self.edges_from(self.root.id):
            raise exception.SullyRuntimeError("No requests specified in session")

        self._reset_fuzz_state()

        for x in self._iterate_messages_recursive(this_node=self.root, path=[]):
            yield x
github jtpereyda / boofuzz / boofuzz / sessions.py View on Github external
def _iterate_protocol(self):
        """
        Iterates over fuzz cases and mutates appropriately.
        On each iteration, one may call fuzz_current_case to do the
        actual fuzzing.

        :raise sex.SullyRuntimeError:
        """
        # we can't fuzz if we don't have at least one target and one request.
        if not self.targets:
            raise exception.SullyRuntimeError("No targets specified in session")

        if not self.edges_from(self.root.id):
            raise exception.SullyRuntimeError("No requests specified in session")

        self._reset_fuzz_state()

        for x in self._iterate_protocol_recursive(this_node=self.root, path=[]):
            yield x
github jtpereyda / boofuzz / boofuzz / __init__.py View on Github external
def s_switch(name):
    """
    Change the current request to the one specified by "name".

    :type  name: str
    :param name: Name of request
    """

    if name not in blocks.REQUESTS:
        raise exception.SullyRuntimeError("blocks.REQUESTS NOT FOUND: %s" % name)

    blocks.CURRENT = blocks.REQUESTS[name]
github jtpereyda / boofuzz / boofuzz / blocks / checksum.py View on Github external
if not self._length and self._algorithm in self.checksum_lengths:
            self._length = self.checksum_lengths[self._algorithm]

        # Edge cases and a couple arbitrary strings (all 1s, all Es)
        self._fuzz_library = [
            "\x00" * self._length,
            "\x11" * self._length,
            "\xEE" * self._length,
            "\xFF" * self._length,
            "\xFF" * (self._length - 1) + "\xFE",
            "\x00" * (self._length - 1) + "\x01",
        ]

        if self._algorithm == "udp":
            if not self._ipv4_src_block_name:
                raise exception.SullyRuntimeError("'udp' checksum algorithm requires ipv4_src_block_name")
            if not self._ipv4_dst_block_name:
                raise exception.SullyRuntimeError("'udp' checksum algorithm requires ipv4_dst_block_name")

        self._rendered = self._get_dummy_value()

        # Set the recursion flag before calling a method that may cause a recursive loop.
        self._recursion_flag = False
github jtpereyda / boofuzz / boofuzz / sessions.py View on Github external
def _iterate_messages(self):
        """Iterates over each message without mutations.

        :raise sex.SullyRuntimeError:
        """
        if not self.targets:
            raise exception.SullyRuntimeError("No targets specified in session")

        if not self.edges_from(self.root.id):
            raise exception.SullyRuntimeError("No requests specified in session")

        self._reset_fuzz_state()

        for x in self._iterate_messages_recursive(this_node=self.root, path=[]):
            yield x
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)