angr.knowledge_plugins.patches

class angr.knowledge_plugins.patches.Patch

Bases: object

__init__(addr, new_bytes, comment=None)
Parameters:

comment (str | None)

class angr.knowledge_plugins.patches.PatchManager

Bases: KnowledgeBasePlugin

A placeholder-style implementation for a binary patch manager. This class should be significantly changed in the future when all data about loaded binary objects are loaded into angr knowledge base from CLE. As of now, it only stores byte-level replacements.

Patches should not overlap, but it’s user’s responsibility to check for and avoid overlapping patches.

__init__(kb)
add_patch(addr, new_bytes, comment=None)
Parameters:

comment (str | None)

add_patch_obj(patch)
Parameters:

patch (Patch)

remove_patch(addr)
patch_addrs()
get_patch(addr)

Get patch at the given address.

Parameters:

addr (int) – The address of the patch.

Returns:

The patch if there is one starting at the address, or None if there isn’t any.

Return type:

Patch or None

get_all_patches(addr, size)

Retrieve all patches that cover a region specified by [addr, addr+size).

Parameters:
  • addr (int) – The address of the beginning of the region.

  • size (int) – Size of the region.

Returns:

A list of patches.

Return type:

list

keys()
items()
values()
copy()
static overlap(a0, a1, b0, b1)
apply_patches_to_binary(binary_bytes=None, patches=None)
Return type:

bytes

Parameters:
apply_patches_to_state(state)
property patched_entry_state