Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251]253BASE_MACHO = [254('NOUNDEFS', check_MACHO_NOUNDEFS),255('CANARY', check_MACHO_CANARY),256('FIXUP_CHAINS', check_MACHO_FIXUP_CHAINS),257]259CHECKS = {260lief.Binary.FORMATS.ELF: {261lief.Header.ARCHITECTURES.X86_64: BASE_ELF + [('CONTROL_FLOW', check_ELF_CONTROL_FLOW)],262lief.Header.ARCHITECTURES.ARM: BASE_ELF,263lief.Header.ARCHITECTURES.ARM64: BASE_ELF,264lief.Header.ARCHITECTURES.PPC64: BASE_ELF,265lief.Header.ARCHITECTURES.RISCV: BASE_ELF,266},267lief.Binary.FORMATS.PE: {268lief.Header.ARCHITECTURES.X86_64: BASE_PE,269},270lief.Binary.FORMATS.MACHO: {271lief.Header.ARCHITECTURES.X86_64: BASE_MACHO + [('PIE', check_PIE),272('NX', check_NX),273('CONTROL_FLOW', check_MACHO_CONTROL_FLOW)],274lief.Header.ARCHITECTURES.ARM64: BASE_MACHO + [('BRANCH_PROTECTION', check_MACHO_BRANCH_PROTECTION)],275}276}278if __name__ == '__main__':279retval: int = 0280for filename in sys.argv[1:]:281binary = lief.parse(filename)283etype = binary.format # type: ignore[union-attr]284arch = binary.abstract.header.architecture # type: ignore[union-attr]286failed: list[str] = []287for (name, func) in CHECKS[etype][arch]:288if not func(binary):289failed.append(name)290if failed:291print(f'{filename}: failed {" ".join(failed)}')292retval = 1293sys.exit(retval)
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.