bytes
type holds bytestringsb'ABCD'
.encode()
and .decode()
, which use utf-8 as a default. The latin-1
codec will map byte values to their equivilant unicode codepointsord()
and chr()
functions operate on strings, not bytestringsjoin
, upper
/lower
, translate
, etchex
and base64
are no longer string encoding codecs. For hex, use bytes.fromhex()
and bytes.hex()
. For base64 use the base64
module.print
and exec
are now builtin functions instead of statementsmap
, filter
, and zip
. reduce
is no longer a builtin; you have to import it from functools
./
operator is explicitly floating-point division, the //
operator is expliclty integer division. The magic functions for overriding these ops are __truediv__
and __floordiv__
.iterkeys
, .itervalues
, and .iteritems
methods removed, and then non-iter versions have been made to return efficient iteratorsstate.solver.eval(x, cast_to=str)
you should now say cast_to=bytes
. When creating concrete bitvectors from strings (including implicitly by just making a comparison against a string) these should be bytestrings. If they are not they will be utf-8 converted and a warning will be printed. Symbol names should be unicode strings.memory.read_bytes(addr, n) -> list[str]
memory.load(addr, n) -> bytes
memory.write_bytes(addr, list[str])
memory.store(addr, bytes)
memory.get_byte(addr) -> str
memory[addr] -> int
memory.read_addr_at(addr) -> int
memory.unpack_word(addr) -> int
memory.write_addr_at(addr, value) -> int
memory.pack_word(addr, value)
memory.stride_repr -> list[(start, end, str)]
memory.backers() -> iter[(start, bytearray)]
pack_word
and unpack_word
now take optional size
, endness
, and signed
parameters. We have also added memory.pack(addr, fmt, *data)
and memory.unpack(addr, fmt)
, which take format strings for use with the struct
module.cbackers
or read_bytes_c
functions, the conversion is a little more complicated - we were able to remove the split notion of "backers" and "updates" and replaced all backers with bytearrays that we mutate, so we can work directly with the backer objects. The backers()
function iterates through all bottom-level backer objects and their start addresses. You can provide an optional address to the function, and it will skip over all backers that end before that address.loader.find_symbol()
and object.symbols_by_addr
, where there was clearly some overlap. However, symbols_by_addr
stayed because it was the only way to enumerate symbols in an object. This has changed! symbols_by_addr
is deprecated and here is now object.symbols
, a sorted list of Symbol objects, to enumerate symbols in a binary.loader.symbols
. This change has also enabled us to add a fuzzy
parameter to find_symbol
(returns the first symbol before the given address) and make the output of loader.describe_addr
much nicer (shows offset from closest symbol).custom_
- so, custom_base_addr
, custom_entry_point
, custom_offset
, custom_arch
, and custom_ld_path
- have had the custom_
removed from the beginning of their names.state.se
has been deprecated. You should have been using state.solver
for the past few years.