Skip to main content

CLE Loads Everything (at least, many binary formats!) and provides a pythonic interface to analyze what they are and what they would look like in memory.

Project description

CLE

Latest Release Python Version PyPI Statistics License

CLE loads binaries and their associated libraries, resolves imports and provides an abstraction of process memory the same way as if it was loader by the OS's loader.

Project Links

Project repository: https://github.com/angr/cle

Documentation: https://api.angr.io/projects/cle/en/latest/

Installation

pip install cle

Usage example

>>> import cle
>>> ld = cle.Loader("/bin/ls")
>>> hex(ld.main_object.entry)
'0x4048d0'
>>> ld.shared_objects
{'ld-linux-x86-64.so.2': <ELF Object ld-2.21.so, maps [0x5000000:0x522312f]>,
 'libacl.so.1': <ELF Object libacl.so.1.1.0, maps [0x2000000:0x220829f]>,
 'libattr.so.1': <ELF Object libattr.so.1.1.0, maps [0x4000000:0x4204177]>,
 'libc.so.6': <ELF Object libc-2.21.so, maps [0x3000000:0x33a1a0f]>,
 'libcap.so.2': <ELF Object libcap.so.2.24, maps [0x1000000:0x1203c37]>}
>>> ld.addr_belongs_to_object(0x5000000)
<ELF Object ld-2.21.so, maps [0x5000000:0x522312f]>
>>> libc_main_reloc = ld.main_object.imports['__libc_start_main']
>>> hex(libc_main_reloc.addr)       # Address of GOT entry for libc_start_main
'0x61c1c0'
>>> import pyvex
>>> some_text_data = ld.memory.load(ld.main_object.entry, 0x100)
>>> irsb = pyvex.lift(some_text_data, ld.main_object.entry, ld.main_object.arch)
>>> irsb.pp()
IRSB {
   t0:Ity_I32 t1:Ity_I32 t2:Ity_I32 t3:Ity_I64 t4:Ity_I64 t5:Ity_I64 t6:Ity_I32 t7:Ity_I64 t8:Ity_I32 t9:Ity_I64 t10:Ity_I64 t11:Ity_I64 t12:Ity_I64 t13:Ity_I64 t14:Ity_I64

   15 | ------ IMark(0x4048d0, 2, 0) ------
   16 | t5 = 32Uto64(0x00000000)
   17 | PUT(rbp) = t5
   18 | t7 = GET:I64(rbp)
   19 | t6 = 64to32(t7)
   20 | t2 = t6
   21 | t9 = GET:I64(rbp)
   22 | t8 = 64to32(t9)
   23 | t1 = t8
   24 | t0 = Xor32(t2,t1)
   25 | PUT(cc_op) = 0x0000000000000013
   26 | t10 = 32Uto64(t0)
   27 | PUT(cc_dep1) = t10
   28 | PUT(cc_dep2) = 0x0000000000000000
   29 | t11 = 32Uto64(t0)
   30 | PUT(rbp) = t11
   31 | PUT(rip) = 0x00000000004048d2
   32 | ------ IMark(0x4048d2, 3, 0) ------
   33 | t12 = GET:I64(rdx)
   34 | PUT(r9) = t12
   35 | PUT(rip) = 0x00000000004048d5
   36 | ------ IMark(0x4048d5, 1, 0) ------
   37 | t4 = GET:I64(rsp)
   38 | t3 = LDle:I64(t4)
   39 | t13 = Add64(t4,0x0000000000000008)
   40 | PUT(rsp) = t13
   41 | PUT(rsi) = t3
   42 | PUT(rip) = 0x00000000004048d6
   43 | t14 = GET:I64(rip)
   NEXT: PUT(rip) = t14; Ijk_Boring
}

Valid options

For a full listing and description of the options that can be provided to the loader and the methods it provides, please examine the docstrings in cle/loader.py. If anything is unclear or poorly documented (there is much) please complain through whatever channel you feel appropriate.

Loading Backends

CLE's loader is implemented in the Loader class. There are several backends that can be used to load a single file:

  • ELF, as its name says, loads ELF binaries. ELF files loaded this way are statically parsed using PyElfTools.

  • PE is a backend to load Microsoft's Portable Executable format, effectively Windows binaries. It uses the (optional) pefile module.

  • Mach-O is a backend to load, you guessed it, Mach-O binaries. Support is limited for this backend.

  • Blob is a backend to load unknown data. It requires that you specify the architecture it would be run on, in the form of a class from ArchInfo.

Which backend you use can be specified as an argument to Loader. If left unspecified, the loader will pick a reasonable default.

Finding shared libraries

  • If the auto_load_libs option is set to False, the Loader will not automatically load libraries requested by loaded objects. Otherwise...

  • The loader determines which shared objects are needed when loading binaries, and searches for them in the following order:

    • in the current working directory
    • in folders specified in the ld_path option
    • in the same folder as the main binary
    • in the system (in the corresponding library path for the architecture of the binary, e.g., /usr/arm-linux-gnueabi/lib for ARM, note that you need to install cross libraries for this, e.g., libc6-powerpc-cross on Debian - needs emdebian repos)
    • in the system, but with mismatched version numbers from what is specified as a dependency, if the ignore_import_version_numbers option is True
  • If no binary is found with the correct architecture, the loader raises an exception if except_missing_libs option is True. Otherwise it simply leaves the dependencies unresolved.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cle-9.2.221.tar.gz (423.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cle-9.2.221-cp314-cp314-win_amd64.whl (484.9 kB view details)

Uploaded CPython 3.14Windows x86-64

cle-9.2.221-cp314-cp314-musllinux_1_2_x86_64.whl (648.7 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

cle-9.2.221-cp314-cp314-musllinux_1_2_aarch64.whl (646.2 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ ARM64

cle-9.2.221-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (649.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cle-9.2.221-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (650.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

cle-9.2.221-cp314-cp314-macosx_11_0_arm64.whl (503.6 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

cle-9.2.221-cp313-cp313-win_amd64.whl (483.3 kB view details)

Uploaded CPython 3.13Windows x86-64

cle-9.2.221-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (649.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cle-9.2.221-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (649.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

cle-9.2.221-cp313-cp313-macosx_11_0_arm64.whl (503.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cle-9.2.221-cp312-cp312-win_amd64.whl (483.3 kB view details)

Uploaded CPython 3.12Windows x86-64

cle-9.2.221-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (649.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cle-9.2.221-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (649.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

cle-9.2.221-cp312-cp312-macosx_11_0_arm64.whl (503.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file cle-9.2.221.tar.gz.

File metadata

  • Download URL: cle-9.2.221.tar.gz
  • Upload date:
  • Size: 423.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for cle-9.2.221.tar.gz
Algorithm Hash digest
SHA256 27d39e1cb852b8b19cf759effecebce01b7538b617d0b3453687548357692d8a
MD5 b29d4ba0c921700b3d458f801dd74813
BLAKE2b-256 79c63017a258bdc1c9307173bd437d9c1547bec902fbd76e7db9e911e635fa72

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221.tar.gz:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: cle-9.2.221-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 484.9 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for cle-9.2.221-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 488dac1934657456959bde942076415886cda040afe43ed1609f0d4759c37712
MD5 8093c3ace135ff07b9bb268c1d4f3596
BLAKE2b-256 9877ab9f823f42e829248a38ccb028188565e49cf4c5f532f45699f6df8bee15

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp314-cp314-win_amd64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 275236f7b3d2bceb7ac7bdb4a05247eac643b7742e28e4b29875019bf3804c10
MD5 7635d5a431264292f7aebaee5bfaf501
BLAKE2b-256 1eccff097cabc3b438de85d3c99724b95d46e8f3a8d7c10a57b7b05d23913606

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp314-cp314-musllinux_1_2_x86_64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp314-cp314-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp314-cp314-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 641c799462222d7785801b792297cbc97ec8ceaca24ae6df795825ac81eaf66c
MD5 0ff9ebe62ebdbb6afa8ab11ef9def485
BLAKE2b-256 b5e97fc2a37e75078f88a553bc11acab76e999317682dc1b002a0aa0164ef96b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp314-cp314-musllinux_1_2_aarch64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a77b1f96f995f3f4ffbfbc6240654ab9a5f28203fd12b268368c7d4ae17ec081
MD5 00211aaa4a4ef15f4f3e2559cd211580
BLAKE2b-256 5f3069698fe3190d4a8ce14ae2f3b1a9ab9424ebe4010b4cd644a4a040aeb90f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 14d8dcad3ea0d3c8fee83cd60a1e93f3cde85131f7480606da0be2d1da2ea56f
MD5 1dabdc847dbee13ea379a9bb60f10a3a
BLAKE2b-256 ae5a448baa4bed57c1a3800c4eafc0d23599cf1e28f86e2fa57f36a0fe31bd93

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 712b0273fb16e797b8642c8867c42c24362ba097af917b62482b7d4b61692c50
MD5 4307fd943726948f3e1d63e1c6711b9d
BLAKE2b-256 3aa27c794d2658a20a809bff4649783a993d1e6f3dd30f35d47809c0161f0937

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: cle-9.2.221-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 483.3 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for cle-9.2.221-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8ed1eb56f11f996a4db6e0ded722ebba70cb21fc86c8efebce4729745416df3a
MD5 e645b46389fe04d026e28644be5b7bd1
BLAKE2b-256 dd2b6fee0be315602e92723451bc705cd3fe940ec553fd1e25ffcc94c9fe91f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp313-cp313-win_amd64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a738e8b2efaf0f3a09a4f351e4b8b417e73f2043ec0685c1fbd1ee93750c5784
MD5 5213ac1e9bf7e14b57f7361ebe826a44
BLAKE2b-256 7d1577af03ff9fe419415052686d87891d9c4f0f04e0e203c02c382a2794753e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 27f440f8aca2dac39a6dea10317e1cff2653517d188d65047f9e0acdac87772b
MD5 9828c051b3e09a56c9c8dd44b8f9ae55
BLAKE2b-256 d09f88d02623679b1ec1908359880e4a26f2e9b02b053f11cd37e145c62e67c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00701f9c0094e4025b1d03728e5bba0d03e937916ef2975dfbe69241b9c55f62
MD5 f6cce9c007e67a0d486e641636b645e3
BLAKE2b-256 5666bef35a8a4025f38fea4efb12df183cb10f2c6f975e4216d5f6a66c2ba73a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: cle-9.2.221-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 483.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for cle-9.2.221-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 33d90c4a0d308e8149be6774b6295577b91f49bc5dcc1e9d1a7c67f272776bb8
MD5 b74400b2d8af1869e590b0890dcc5710
BLAKE2b-256 2d21a3db1f4373af32c24ab659870ccf85dfff13fd86e101ef71eeef81ead571

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp312-cp312-win_amd64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e3526a3db05efb10cb9f398c637d9edd42ba001406bd4f3d4faa47779001d707
MD5 9080514ee1cb2f2e037533276ba6dd63
BLAKE2b-256 c78f80cfca09d9cbe4070d19afaf76f4b7075a06c9f139cbccddfb71af073182

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5e4db9e51b502dbf902b471eab34557fcae8beee156a4a1d5ee6b0b8b541facc
MD5 9ae98d867f8c2da4b1d5bc8eabeb955e
BLAKE2b-256 5ac1e94d25e4c697673e7ad1fcd915cefee138f34d836263f00ceaa302008c0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cle-9.2.221-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cle-9.2.221-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fcf128e4ae2c5bd1c37b3383acae9e60bbd8efd26afebf839f7a828f5ecdd99f
MD5 c2a7413547d08dd1f90b67c1cb78cbf8
BLAKE2b-256 98be69feb8a0b9a9673cdb67ad4f3da388f71400d569786ba36c62b27722f5ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for cle-9.2.221-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: angr-release.yml on angr/ci-settings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page