├── .github ├── actions │ └── install-ghidra │ │ └── action.yml └── workflows │ ├── alpine.yml │ ├── archlinux.yml │ ├── debian-testing.yml │ ├── fedora.yml │ ├── full.yml │ ├── lint.yml │ ├── main.yml │ ├── nightly.yml │ ├── oasis.yml │ ├── opam.yml │ ├── publish-docker-image-release.yml │ ├── publish-docker-image.yml │ ├── release.yml │ ├── ubuntu-bionic.yml │ └── weekly-regress.yml ├── .gitignore ├── .gitmodules ├── .run_travis_tests.sh ├── CHANGES.md ├── LICENSE ├── Makefile ├── OMakefile ├── OMakeroot ├── README.md ├── _tags.in ├── bap-abi.opam ├── bap-analyze.opam ├── bap-api.opam ├── bap-arm.opam ├── bap-beagle-strings.opam ├── bap-beagle.opam ├── bap-bil.opam ├── bap-bml.opam ├── bap-build.opam ├── bap-bundle.opam ├── bap-byteweight-frontend.opam ├── bap-byteweight.opam ├── bap-c.opam ├── bap-cache.opam ├── bap-callgraph-collator.opam ├── bap-callsites.opam ├── bap-common.opam ├── bap-constant-tracker.opam ├── bap-core-theory.opam ├── bap-core.opam ├── bap-cxxfilt.opam ├── bap-demangle.opam ├── bap-dependencies.opam ├── bap-disassemble.opam ├── bap-dump-symbols.opam ├── bap-dwarf.opam ├── bap-elementary.opam ├── bap-elf.opam ├── bap-extra.opam ├── bap-flatten.opam ├── bap-frontc.opam ├── bap-frontend.opam ├── bap-future.opam ├── bap-ghidra.opam ├── bap-glibc-runtime.opam ├── bap-ida-plugin.opam ├── bap-ida.opam ├── bap-knowledge.opam ├── bap-llvm.opam ├── bap-llvm.opam.template ├── bap-main.opam ├── bap-mc.opam ├── bap-microx.opam ├── bap-mips.opam ├── bap-objdump.opam ├── bap-objdump.opam.template ├── bap-optimization.opam ├── bap-patterns.opam ├── bap-phoenix.opam ├── bap-piqi.opam ├── bap-plugins.opam ├── bap-powerpc.opam ├── bap-primus-dictionary.opam ├── bap-primus-exploring-scheduler.opam ├── bap-primus-greedy-scheduler.opam ├── bap-primus-limit.opam ├── bap-primus-lisp.opam ├── bap-primus-loader.opam ├── bap-primus-mark-visited.opam ├── bap-primus-powerpc.opam ├── bap-primus-print.opam ├── bap-primus-promiscuous.opam ├── bap-primus-propagate-taint.opam ├── bap-primus-random.opam ├── bap-primus-region.opam ├── bap-primus-round-robin-scheduler.opam ├── bap-primus-support.opam ├── bap-primus-symbolic-executor.opam ├── bap-primus-systems.opam ├── bap-primus-taint.opam ├── bap-primus-test.opam ├── bap-primus-track-visited.opam ├── bap-primus-wandering-scheduler.opam ├── bap-primus-x86.opam ├── bap-primus.opam ├── bap-print.opam ├── bap-radare2.opam ├── bap-raw.opam ├── bap-recipe-command.opam ├── bap-recipe.opam ├── bap-relation.opam ├── bap-relocatable.opam ├── bap-report.opam ├── bap-riscv.opam ├── bap-run.opam ├── bap-signatures.opam ├── bap-signatures.opam.template ├── bap-specification.opam ├── bap-ssa.opam ├── bap-std.opam ├── bap-strings.opam ├── bap-stub-resolver.opam ├── bap-symbol-reader.opam ├── bap-systemz.opam ├── bap-taint-propagator.opam ├── bap-taint.opam ├── bap-term-mapper.opam ├── bap-thumb.opam ├── bap-toplevel.opam ├── bap-trace.opam ├── bap-traces.opam ├── bap-trivial-condition-form.opam ├── bap-warn-unused.opam ├── bap-x86.opam ├── bap.opam ├── bare.opam ├── benchmarks ├── bench_dom.ml ├── bench_image.ml ├── bench_image.mli └── run_benchmarks.ml ├── bitvec-binprot.opam ├── bitvec-order.opam ├── bitvec-sexp.opam ├── bitvec.opam ├── configure ├── configure-omake ├── doc └── Makefile ├── docker ├── 2.4.0 │ └── Dockerfile ├── 2.5.0 │ └── Dockerfile ├── alpine │ └── Dockerfile ├── archlinux │ └── Dockerfile ├── debian │ └── testing │ │ └── Dockerfile ├── fedora │ └── Dockerfile └── ubuntu │ ├── bionic │ └── Dockerfile │ ├── noble │ └── Dockerfile │ └── xenial │ └── Dockerfile ├── dune ├── dune-project ├── graphlib.opam ├── lib ├── arm │ ├── ARM.ml │ ├── arm_bit.ml │ ├── arm_bit.mli │ ├── arm_branch.ml │ ├── arm_branch.mli │ ├── arm_cond.ml │ ├── arm_cond.mli │ ├── arm_env.ml │ ├── arm_env.mli │ ├── arm_flags.ml │ ├── arm_flags.mli │ ├── arm_helpers.ml │ ├── arm_helpers.mli │ ├── arm_insn.ml │ ├── arm_insn.mli │ ├── arm_lifter.ml │ ├── arm_lifter.mli │ ├── arm_mem.ml │ ├── arm_mem.mli │ ├── arm_mem_shift.ml │ ├── arm_mem_shift.mli │ ├── arm_mov.ml │ ├── arm_mov.mli │ ├── arm_mul.ml │ ├── arm_mul.mli │ ├── arm_op.ml │ ├── arm_op.mli │ ├── arm_reg.ml │ ├── arm_reg.mli │ ├── arm_shift.ml │ ├── arm_shift.mli │ ├── arm_target.ml │ ├── arm_target.mli │ ├── arm_types.ml │ ├── arm_utils.ml │ ├── arm_utils.mli │ └── dune ├── bap │ ├── bap.ml │ ├── bap.mli │ ├── bap_init_toplevel.ml │ ├── bap_init_toplevel.mli │ ├── bap_project.ml │ ├── bap_project.mli │ ├── bap_self.ml │ ├── bap_self.mli │ └── dune ├── bap_abi │ ├── bap_abi.ml │ ├── bap_abi.mli │ └── dune ├── bap_api │ ├── bap_api.ml │ ├── bap_api.mli │ └── dune ├── bap_bml │ ├── bap_bml.ml │ ├── bap_bml.mli │ └── dune ├── bap_build │ ├── bap_build.ml │ ├── bap_build.mli │ └── dune ├── bap_bundle │ ├── bap_bundle.ml │ ├── bap_bundle.mli │ ├── bap_bundle_config.ml.ab │ └── dune ├── bap_byteweight │ ├── bap_byteweight.ml │ ├── bap_byteweight.mli │ ├── bap_byteweight_signatures.ml │ ├── bap_byteweight_signatures.mli │ └── dune ├── bap_c │ ├── .ocamlinit │ ├── bap_c.ml │ ├── bap_c_abi.ml │ ├── bap_c_abi.mli │ ├── bap_c_attr.ml │ ├── bap_c_attr.mli │ ├── bap_c_data.ml │ ├── bap_c_data.mli │ ├── bap_c_parser.ml │ ├── bap_c_parser.mli │ ├── bap_c_size.ml │ ├── bap_c_size.mli │ ├── bap_c_term_attributes.ml │ ├── bap_c_term_attributes.mli │ ├── bap_c_type.ml │ ├── bap_c_type.mli │ ├── bap_c_type_mapper.ml │ ├── bap_c_type_mapper.mli │ ├── bap_c_type_mapper_intf.ml │ ├── bap_c_type_printer.ml │ ├── bap_c_type_printer.mli │ └── dune ├── bap_core_theory │ ├── bap_core_theory.ml │ ├── bap_core_theory.mli │ ├── bap_core_theory_IEEE754.ml │ ├── bap_core_theory_IEEE754.mli │ ├── bap_core_theory_basic.ml │ ├── bap_core_theory_basic.mli │ ├── bap_core_theory_definition.ml │ ├── bap_core_theory_effect.ml │ ├── bap_core_theory_effect.mli │ ├── bap_core_theory_empty.ml │ ├── bap_core_theory_empty.mli │ ├── bap_core_theory_grammar_definition.ml │ ├── bap_core_theory_manager.ml │ ├── bap_core_theory_manager.mli │ ├── bap_core_theory_parser.ml │ ├── bap_core_theory_parser.mli │ ├── bap_core_theory_pass.ml │ ├── bap_core_theory_pass.mli │ ├── bap_core_theory_program.ml │ ├── bap_core_theory_program.mli │ ├── bap_core_theory_target.ml │ ├── bap_core_theory_target.mli │ ├── bap_core_theory_value.ml │ ├── bap_core_theory_value.mli │ ├── bap_core_theory_var.ml │ ├── bap_core_theory_var.mli │ └── dune ├── bap_demangle │ ├── bap_demangle.ml │ ├── bap_demangle.mli │ └── dune ├── bap_disasm │ ├── OMakefile │ ├── bap_disasm.ml │ ├── bap_disasm.mli │ ├── bap_disasm_backend_types.ml │ ├── bap_disasm_basic.ml │ ├── bap_disasm_basic.mli │ ├── bap_disasm_block.ml │ ├── bap_disasm_block.mli │ ├── bap_disasm_brancher.ml │ ├── bap_disasm_brancher.mli │ ├── bap_disasm_calls.ml │ ├── bap_disasm_calls.mli │ ├── bap_disasm_driver.ml │ ├── bap_disasm_driver.mli │ ├── bap_disasm_insn.ml │ ├── bap_disasm_insn.mli │ ├── bap_disasm_linear_sweep.ml │ ├── bap_disasm_linear_sweep.mli │ ├── bap_disasm_prim.ml │ ├── bap_disasm_rec.ml │ ├── bap_disasm_rec.mli │ ├── bap_disasm_reconstructor.ml │ ├── bap_disasm_reconstructor.mli │ ├── bap_disasm_rooter.ml │ ├── bap_disasm_rooter.mli │ ├── bap_disasm_source.ml │ ├── bap_disasm_source.mli │ ├── bap_disasm_source_factory.ml │ ├── bap_disasm_source_factory.mli │ ├── bap_disasm_source_intf.ml │ ├── bap_disasm_std.ml │ ├── bap_disasm_symbolizer.ml │ ├── bap_disasm_symbolizer.mli │ ├── bap_disasm_symtab.ml │ ├── bap_disasm_symtab.mli │ ├── bap_disasm_target_factory.ml │ ├── bap_disasm_target_intf.ml │ ├── bap_disasm_types.ml │ ├── bap_insn_aliasing.ml │ ├── bap_insn_kind.ml │ ├── disasm.cpp │ ├── disasm.h │ ├── disasm.hpp │ ├── disasm_stubs.c │ └── dune ├── bap_dwarf │ ├── bap_dwarf.ml │ ├── bap_dwarf.mli │ ├── dune │ ├── dwarf_data.ml │ ├── dwarf_data.mli │ ├── dwarf_fbi.ml │ ├── dwarf_fbi.mli │ ├── dwarf_input.ml │ ├── dwarf_input.mli │ ├── dwarf_leb128.ml │ ├── dwarf_leb128.mli │ └── dwarf_types.ml ├── bap_elementary │ ├── bap_elementary.ml │ ├── bap_elementary.mli │ └── dune ├── bap_elf │ ├── LICENSE │ ├── bap_elf.ml │ ├── bap_elf.mli │ ├── dune │ ├── elf_internal_utils.ml │ ├── elf_internal_utils.mli │ ├── elf_parse.ml │ ├── elf_parse.mli │ ├── elf_types.ml │ ├── elf_utils.ml │ └── elf_utils.mli ├── bap_future │ ├── bap_future.ml │ ├── bap_future.mli │ └── dune ├── bap_ghidra │ ├── OMakefile │ ├── bap_ghidra.ml │ ├── bap_ghidra.mli │ ├── dune │ ├── ghidra_disasm.cpp │ ├── ghidra_disasm.h │ ├── ghidra_disasm.hpp │ └── ghidra_stubs.c ├── bap_ida │ ├── bap_ida.ml │ ├── bap_ida.mli │ └── dune ├── bap_image │ ├── bap_fileutils.ml │ ├── bap_fileutils.mli │ ├── bap_image.ml │ ├── bap_image.mli │ ├── bap_image_std.ml │ ├── bap_memmap.ml │ ├── bap_memmap.mli │ ├── bap_memory.ml │ ├── bap_memory.mli │ ├── bap_table.ml │ ├── bap_table.mli │ ├── dune │ ├── image_backend.ml │ ├── image_common.ml │ └── image_internal_std.ml ├── bap_language │ ├── bap_language.ml │ └── bap_language.mli ├── bap_llvm │ ├── OMakefile │ ├── bap_llvm.ml │ ├── bap_llvm.mli │ ├── bap_llvm_config.ml.ab │ ├── bap_llvm_disasm.ml │ ├── bap_llvm_disasm.mli │ ├── bap_llvm_loader.ml │ ├── bap_llvm_loader.mli │ ├── config │ │ ├── dune │ │ ├── llvm_config.ml.ab │ │ └── llvm_configurator.ml │ ├── dune │ ├── llvm_coff_loader.cpp │ ├── llvm_coff_loader.h │ ├── llvm_coff_loader.hpp │ ├── llvm_disasm.cpp │ ├── llvm_disasm.h │ ├── llvm_disasm.hpp │ ├── llvm_elf_loader.cpp │ ├── llvm_elf_loader.h │ ├── llvm_elf_loader.hpp │ ├── llvm_error_or.cpp │ ├── llvm_error_or.h │ ├── llvm_error_or.hpp │ ├── llvm_loader.cpp │ ├── llvm_loader.h │ ├── llvm_loader.hpp │ ├── llvm_loader_stubs.c │ ├── llvm_loader_stubs.h │ ├── llvm_loader_utils.cpp │ ├── llvm_loader_utils.h │ ├── llvm_loader_utils.hpp │ ├── llvm_macho_loader.cpp │ ├── llvm_macho_loader.h │ ├── llvm_macho_loader.hpp │ ├── llvm_pdb_loader.cpp │ ├── llvm_pdb_loader.h │ ├── llvm_pdb_loader.hpp │ ├── llvm_primitives.cpp │ ├── llvm_primitives.h │ ├── llvm_primitives.hpp │ └── llvm_stubs.c ├── bap_main │ ├── bap_main.ml │ ├── bap_main.mli │ ├── bap_main_config.ml.ab │ ├── bap_main_event.ml │ ├── bap_main_event.mli │ ├── bap_main_log.ml │ ├── bap_main_log.mli │ └── dune ├── bap_mips │ ├── bap_mips_target.ml │ ├── bap_mips_target.mli │ └── dune ├── bap_piqi │ ├── bil_piqi.ml │ ├── bil_piqi.mli │ ├── bir_piqi.ml │ ├── bir_piqi.mli │ ├── dune │ ├── exp.piqi │ ├── ir.piqi │ ├── stmt.piqi │ ├── test │ │ └── run_piqi_tests.ml │ └── type.piqi ├── bap_plugins │ ├── bap_common.ml │ ├── bap_common.ml.ab │ ├── bap_plugins.ml │ ├── bap_plugins.mli │ ├── bap_plugins_config.ml.ab │ ├── bap_plugins_loader_backend.ml │ ├── bap_plugins_loader_backend.mli │ ├── bap_plugins_package.ml │ ├── bap_plugins_package.mli │ ├── bap_plugins_units.ml │ ├── bap_plugins_units.mli │ ├── bap_plugins_units_intf.ml │ └── dune ├── bap_powerpc │ ├── bap_powerpc_target.ml │ ├── bap_powerpc_target.mli │ └── dune ├── bap_primus │ ├── bap_primus.ml │ ├── bap_primus.mli │ ├── bap_primus_analysis.ml │ ├── bap_primus_analysis.mli │ ├── bap_primus_env.ml │ ├── bap_primus_env.mli │ ├── bap_primus_exn.ml │ ├── bap_primus_exn.mli │ ├── bap_primus_generator.ml │ ├── bap_primus_generator.mli │ ├── bap_primus_generator_types.ml │ ├── bap_primus_info.ml │ ├── bap_primus_info.mli │ ├── bap_primus_interpreter.ml │ ├── bap_primus_interpreter.mli │ ├── bap_primus_iterator.ml │ ├── bap_primus_iterator.mli │ ├── bap_primus_linker.ml │ ├── bap_primus_linker.mli │ ├── bap_primus_lisp.ml │ ├── bap_primus_lisp.mli │ ├── bap_primus_lisp_attribute.ml │ ├── bap_primus_lisp_attribute.mli │ ├── bap_primus_lisp_attributes.ml │ ├── bap_primus_lisp_attributes.mli │ ├── bap_primus_lisp_context.ml │ ├── bap_primus_lisp_context.mli │ ├── bap_primus_lisp_def.ml │ ├── bap_primus_lisp_def.mli │ ├── bap_primus_lisp_index.ml │ ├── bap_primus_lisp_index.mli │ ├── bap_primus_lisp_loc.ml │ ├── bap_primus_lisp_loc.mli │ ├── bap_primus_lisp_parse.ml │ ├── bap_primus_lisp_parse.mli │ ├── bap_primus_lisp_program.ml │ ├── bap_primus_lisp_program.mli │ ├── bap_primus_lisp_resolve.ml │ ├── bap_primus_lisp_resolve.mli │ ├── bap_primus_lisp_semantics.ml │ ├── bap_primus_lisp_semantics.mli │ ├── bap_primus_lisp_source.ml │ ├── bap_primus_lisp_source.mli │ ├── bap_primus_lisp_type.ml │ ├── bap_primus_lisp_type.mli │ ├── bap_primus_lisp_types.ml │ ├── bap_primus_lisp_var.ml │ ├── bap_primus_lisp_var.mli │ ├── bap_primus_lisp_word.ml │ ├── bap_primus_lisp_word.mli │ ├── bap_primus_machine.ml │ ├── bap_primus_machine.mli │ ├── bap_primus_main.ml │ ├── bap_primus_main.mli │ ├── bap_primus_memory.ml │ ├── bap_primus_memory.mli │ ├── bap_primus_observation.ml │ ├── bap_primus_observation.mli │ ├── bap_primus_pos.ml │ ├── bap_primus_pos.mli │ ├── bap_primus_random.ml │ ├── bap_primus_random.mli │ ├── bap_primus_sexp.ml │ ├── bap_primus_state.ml │ ├── bap_primus_state.mli │ ├── bap_primus_system.ml │ ├── bap_primus_system.mli │ ├── bap_primus_types.ml │ ├── bap_primus_value.ml │ ├── bap_primus_value.mli │ └── dune ├── bap_primus_machine │ ├── bap_primus_machine.ml │ └── bap_primus_machine.mli ├── bap_primus_track_visited │ ├── bap_primus_track_visited.ml │ ├── bap_primus_track_visited.mli │ └── dune ├── bap_recipe │ ├── bap_recipe.ml │ ├── bap_recipe.mli │ └── dune ├── bap_relation │ ├── bap_relation.ml │ ├── bap_relation.mli │ └── dune ├── bap_riscv │ ├── bap_riscv_target.ml │ ├── bap_riscv_target.mli │ └── dune ├── bap_sema │ ├── bap_sema.ml │ ├── bap_sema_flatten.ml │ ├── bap_sema_flatten.mli │ ├── bap_sema_free_vars.ml │ ├── bap_sema_free_vars.mli │ ├── bap_sema_lift.ml │ ├── bap_sema_lift.mli │ ├── bap_sema_ssa.ml │ ├── bap_sema_ssa.mli │ ├── bap_sema_taint.ml │ ├── bap_sema_taint.mli │ └── dune ├── bap_strings │ ├── bap_strings.ml │ ├── bap_strings_detector.ml │ ├── bap_strings_detector.mli │ ├── bap_strings_index.ml │ ├── bap_strings_index.mli │ ├── bap_strings_scanner.ml │ ├── bap_strings_scanner.mli │ ├── bap_strings_unscrambler.ml │ ├── bap_strings_unscrambler.mli │ └── dune ├── bap_systemz │ ├── bap_systemz_target.ml │ ├── bap_systemz_target.mli │ └── dune ├── bap_taint │ ├── bap_taint.ml │ ├── bap_taint.mli │ └── dune ├── bap_traces │ ├── bap_trace.ml │ ├── bap_trace.mli │ ├── bap_trace_binprot.ml │ ├── bap_trace_binprot.mli │ ├── bap_trace_event_types.ml │ ├── bap_trace_events.ml │ ├── bap_trace_events.mli │ ├── bap_trace_id.ml │ ├── bap_trace_id.mli │ ├── bap_trace_meta.ml │ ├── bap_trace_meta.mli │ ├── bap_trace_meta_types.ml │ ├── bap_trace_std.ml │ ├── bap_trace_traces.ml │ ├── bap_trace_traces.mli │ ├── bap_traces.ml │ ├── bap_traces.mli │ └── dune ├── bap_types │ ├── bap_addr.ml │ ├── bap_addr.mli │ ├── bap_arch.ml │ ├── bap_arch.mli │ ├── bap_attributes.ml │ ├── bap_bil.ml │ ├── bap_bil_adt.ml │ ├── bap_bil_adt.mli │ ├── bap_bil_optimizations.ml │ ├── bap_bil_optimizations.mli │ ├── bap_bil_pass.ml │ ├── bap_bil_pass.mli │ ├── bap_bili.ml │ ├── bap_bili.mli │ ├── bap_bili_types.ml │ ├── bap_biri.ml │ ├── bap_biri.mli │ ├── bap_biri_types.ml │ ├── bap_bitvector.ml │ ├── bap_bitvector.mli │ ├── bap_common_types.ml │ ├── bap_context.ml │ ├── bap_context.mli │ ├── bap_core_theory_bil_parser.ml │ ├── bap_core_theory_bil_parser.mli │ ├── bap_eval.ml │ ├── bap_eval.mli │ ├── bap_eval_types.ml │ ├── bap_exp.ml │ ├── bap_exp.mli │ ├── bap_expi.ml │ ├── bap_expi.mli │ ├── bap_expi_types.ml │ ├── bap_helpers.ml │ ├── bap_helpers.mli │ ├── bap_int_conversions.ml │ ├── bap_int_conversions.mli │ ├── bap_integer.ml │ ├── bap_integer.mli │ ├── bap_integer_intf.ml │ ├── bap_interval_tree.ml │ ├── bap_interval_tree.mli │ ├── bap_ir.ml │ ├── bap_ir.mli │ ├── bap_ir_callgraph.ml │ ├── bap_ir_callgraph.mli │ ├── bap_ir_graph.ml │ ├── bap_ir_graph.mli │ ├── bap_monad.ml │ ├── bap_monad.mli │ ├── bap_monad_types.ml │ ├── bap_ogre.ml │ ├── bap_ogre.mli │ ├── bap_result.ml │ ├── bap_result.mli │ ├── bap_size.ml │ ├── bap_size.mli │ ├── bap_stmt.ml │ ├── bap_stmt.mli │ ├── bap_tid_graph.ml │ ├── bap_tid_graph.mli │ ├── bap_toplevel.ml │ ├── bap_toplevel.mli │ ├── bap_trie.ml │ ├── bap_trie.mli │ ├── bap_trie_intf.ml │ ├── bap_type.ml │ ├── bap_type.mli │ ├── bap_type_error.ml │ ├── bap_type_error.mli │ ├── bap_types.ml │ ├── bap_value.ml │ ├── bap_value.mli │ ├── bap_var.ml │ ├── bap_var.mli │ ├── bap_vector.ml │ ├── bap_vector.mli │ ├── bap_visitor.ml │ ├── bap_visitor.mli │ └── dune ├── bare │ ├── bare.ml │ ├── bare.mli │ └── dune ├── beagle │ ├── beagle_prey.ml │ ├── beagle_prey.mli │ └── dune ├── bitvec │ ├── bitvec.ml │ ├── bitvec.mli │ └── dune ├── bitvec_binprot │ ├── bitvec_binprot.ml │ ├── bitvec_binprot.mli │ └── dune ├── bitvec_order │ ├── bitvec_order.ml │ ├── bitvec_order.mli │ └── dune ├── bitvec_sexp │ ├── bitvec_sexp.ml │ ├── bitvec_sexp.mli │ └── dune ├── common │ ├── bap_common.ml │ ├── bap_common.mli │ └── dune ├── graphlib │ ├── dune │ ├── graphlib.ml │ ├── graphlib.mli │ ├── graphlib_graph.ml │ ├── graphlib_graph.mli │ ├── graphlib_intf.ml │ ├── graphlib_pp.ml │ ├── graphlib_pp.mli │ ├── graphlib_regular.ml │ ├── graphlib_regular.mli │ └── graphlib_regular_intf.ml ├── knowledge │ ├── bap_knowledge.ml │ ├── bap_knowledge.mli │ └── dune ├── microx │ ├── dune │ ├── microx.ml │ ├── microx_concretizer.ml │ ├── microx_concretizer.mli │ ├── microx_conqueror.ml │ └── microx_conqueror.mli ├── monads │ ├── dune │ ├── monads.ml │ ├── monads.mli │ ├── monads_monad.ml │ ├── monads_monad.mli │ ├── monads_monoid.ml │ ├── monads_monoid.mli │ └── monads_types.ml ├── ogre │ ├── dune │ ├── ogre.ml │ └── ogre.mli ├── regular │ ├── dune │ ├── regular.ml │ ├── regular.mli │ ├── regular_bytes.ml │ ├── regular_bytes.mli │ ├── regular_cache.ml │ ├── regular_cache.mli │ ├── regular_data.ml │ ├── regular_data.mli │ ├── regular_data_intf.ml │ ├── regular_data_read.ml │ ├── regular_data_read.mli │ ├── regular_data_types.ml │ ├── regular_data_write.ml │ ├── regular_data_write.mli │ ├── regular_opaque.ml │ ├── regular_regular.ml │ ├── regular_regular.mli │ ├── regular_seq.ml │ └── regular_seq.mli ├── text_tags │ ├── dune │ ├── text_tags.ml │ └── text_tags.mli └── x86_cpu │ ├── dune │ ├── x86_asm.ml │ ├── x86_asm_reg.ml │ ├── x86_asm_reg.mli │ ├── x86_asm_reg_types.ml │ ├── x86_cpu.ml │ ├── x86_cpu.mli │ ├── x86_env.ml │ ├── x86_env.mli │ ├── x86_llvm_env.ml │ ├── x86_llvm_env.mli │ ├── x86_target.ml │ ├── x86_target.mli │ └── x86_types.ml ├── lib_test ├── bap │ ├── dune │ ├── run_tests.ml │ └── run_tests.mli ├── bap_disasm │ ├── dune │ ├── test_disasm.ml │ └── test_disasm.mli ├── bap_dwarf │ ├── dwarf_fbi_test.ml │ ├── run_tests.ml │ ├── test_leb128.ml │ └── test_leb128.mli ├── bap_future │ ├── run_future_tests.ml │ ├── test_future.ml │ ├── test_future.mli │ ├── test_future_std.ml │ ├── test_future_std.mli │ ├── test_stream.ml │ └── test_stream.mli ├── bap_image │ ├── dune │ ├── test_image.ml │ ├── test_image.mli │ ├── test_memmap.ml │ ├── test_memmap.mli │ ├── test_table.ml │ └── test_table.mli ├── bap_project │ ├── dune │ ├── test_project.ml │ └── test_project.mli ├── bap_sema │ ├── dune │ ├── test_ir.ml │ └── test_ir.mli ├── bap_traces │ ├── run_traces_tests.ml │ ├── test_traces.ml │ └── test_traces.mli ├── bap_types │ ├── dune │ ├── test_bili.ml │ ├── test_bili.mli │ ├── test_bitvector.ml │ ├── test_bitvector.mli │ ├── test_bytes.ml │ ├── test_bytes.mli │ ├── test_graph.ml │ ├── test_graph.mli │ ├── test_optimizations.ml │ ├── test_optimizations.mli │ ├── test_trie.ml │ └── test_trie.mli ├── powerpc │ ├── dune │ ├── powerpc_add_tests.ml │ ├── powerpc_arith_tests.ml │ ├── powerpc_branch_tests.ml │ ├── powerpc_compare_tests.ml │ ├── powerpc_cr_tests.ml │ ├── powerpc_load_tests.ml │ ├── powerpc_logical_tests.ml │ ├── powerpc_move_tests.ml │ ├── powerpc_rotate_tests.ml │ ├── powerpc_shift_tests.ml │ ├── powerpc_store_tests.ml │ ├── powerpc_tests_helpers.ml │ ├── powerpc_tests_helpers.mli │ └── run_powerpc_tests.ml ├── stub_resolver │ ├── dune │ ├── run_stub_resolver_tests.ml │ └── stub_resolver_tests.ml └── x86 │ ├── dune │ ├── run_x86_tests.ml │ ├── test_pcmp.ml │ └── test_pshufb.ml ├── man └── bapbundle.1 ├── monads.opam ├── myocamlbuild.ml.in ├── oasis ├── abi ├── analyze ├── api ├── api.files.ab.in ├── api.setup.ml.in ├── arm ├── bap-std ├── bare ├── beagle ├── benchmarks ├── bil ├── bitvec ├── bitvec-binprot ├── bitvec-order ├── bitvec-sexp ├── build ├── bundle ├── bundle.files.ab.in ├── byteweight ├── byteweight-frontend ├── c ├── cache ├── callgraph-collator ├── callsites ├── common ├── common.files.ab.in ├── common.ocamlbuild.ml.in ├── common.omake ├── common.setup.ml.in ├── common.tags.in ├── constant-tracker ├── core-theory ├── cxxfilt ├── cxxfilt.files.ab.in ├── cxxfilt.setup.ml.in ├── demangle ├── dependencies ├── disassemble ├── dump-symbols ├── dwarf ├── elementary ├── elf-loader ├── emit-ida-script ├── flatten ├── frontc-parser ├── frontend ├── future ├── ghidra ├── glibc-runtime ├── graphlib ├── ida ├── ida.files.ab.in ├── ida.setup.ml.in ├── knowledge ├── language ├── llvm ├── llvm.files.ab.in ├── llvm.ocamlbuild.ml.in ├── llvm.setup.ml.in ├── llvm.tags.in ├── main ├── main.files.ab.in ├── main.setup.ml.in ├── map-terms ├── mc ├── microx ├── mips ├── monads ├── objdump ├── objdump.files.ab.in ├── objdump.setup.ml.in ├── ogre ├── optimization ├── patterns ├── phoenix ├── piqi-printers ├── piqi-printers.ocamlbuild.ml.in ├── piqi-printers.setup.ml.in ├── plugins ├── plugins.files.ab.in ├── powerpc ├── primus ├── primus-dictionary ├── primus-exploring ├── primus-greedy ├── primus-limit ├── primus-lisp ├── primus-lisp.files.ab.in ├── primus-lisp.setup.ml.in ├── primus-loader ├── primus-machine ├── primus-mark-visited ├── primus-powerpc ├── primus-print ├── primus-promiscuous ├── primus-propagate-taint ├── primus-random ├── primus-region ├── primus-round-robin ├── primus-symbolic-executor ├── primus-systems ├── primus-taint ├── primus-test ├── primus-track-visited ├── primus-wandering ├── primus-x86 ├── print ├── propagate-taint ├── radare2 ├── raw ├── read-symbols ├── recipe ├── recipe-command ├── regular ├── relation ├── relocatable ├── report ├── riscv ├── run ├── specification ├── ssa ├── strings ├── strings-library ├── stub-resolver ├── stub-resolver.files.ab.in ├── stub-resolver.setup.ml.in ├── systemz ├── taint ├── tests ├── text-tags ├── thumb ├── toplevel ├── trace ├── traces ├── trivial-condition-form ├── warn-unused └── x86 ├── ogre.opam ├── plugins ├── abi │ ├── abi_main.ml │ └── dune ├── analyze │ ├── analyze_core_commands.ml │ ├── analyze_core_commands.mli │ ├── analyze_main.ml │ └── dune ├── api │ ├── api │ │ └── c │ │ │ ├── android.h │ │ │ ├── dune │ │ │ ├── gnu.h │ │ │ ├── posix.h │ │ │ └── windows.h │ ├── api_main.ml │ ├── api_sites.ml.ab │ └── dune ├── arm │ ├── arm_gnueabi.ml │ ├── arm_gnueabi.mli │ ├── arm_main.ml │ ├── dune │ └── semantics │ │ ├── aarch64-arithmetic.lisp │ │ ├── aarch64-atomic.lisp │ │ ├── aarch64-branch.lisp │ │ ├── aarch64-data-movement.lisp │ │ ├── aarch64-helper.lisp │ │ ├── aarch64-logical.lisp │ │ ├── aarch64-pstate.lisp │ │ ├── aarch64-special.lisp │ │ ├── aarch64.lisp │ │ ├── arm-bits.lisp │ │ ├── arm.lisp │ │ ├── dune │ │ ├── thumb-patterns.lisp │ │ └── thumb.lisp ├── beagle │ ├── beagle_main.ml │ ├── beagle_main.mli │ └── dune ├── bil │ ├── Makefile │ ├── bil_float.ml │ ├── bil_float.mli │ ├── bil_ir.ml │ ├── bil_ir.mli │ ├── bil_lifter.ml │ ├── bil_lifter.mli │ ├── bil_main.ml │ ├── bil_semantics.ml │ ├── bil_semantics.mli │ └── dune ├── byteweight │ ├── byteweight_main.ml │ └── dune ├── cache │ ├── bap_cache.ml │ ├── bap_cache.mli │ ├── bap_cache_gc.ml │ ├── bap_cache_gc.mli │ ├── bap_cache_main.ml │ ├── bap_cache_types.ml │ ├── bap_cache_utils.ml │ ├── bap_cache_utils.mli │ └── dune ├── callgraph_collator │ ├── callgraph_collator_main.ml │ └── dune ├── callsites │ ├── callsites_main.ml │ └── dune ├── constant_tracker │ ├── constant_tracker_main.ml │ ├── dune │ └── lisp │ │ ├── check-hardcoded-values.lisp │ │ ├── check-null-pointers.lisp │ │ └── dune ├── core_theory │ ├── core_theory_main.ml │ ├── core_theory_main.mli │ └── dune ├── cxxfilt │ ├── cxxfilt_config.ml.ab │ ├── cxxfilt_main.ml │ ├── cxxfilt_main.mli │ └── dune ├── demangle │ ├── demangle_main.ml │ └── dune ├── dependencies │ ├── dependencies_main.ml │ ├── dependencies_main.mli │ └── dune ├── disassemble │ ├── disassemble_main.ml │ ├── disassemble_main.mli │ ├── disassemble_main_rules.ml │ ├── disassemble_main_rules.mli │ └── dune ├── dump_symbols │ ├── dump_symbols_main.ml │ └── dune ├── elf_loader │ ├── dune │ ├── elf_loader_main.ml │ └── elf_loader_main.mli ├── emit_ida_script │ ├── dune │ └── emit_ida_script_main.ml ├── flatten │ ├── dune │ └── flatten_main.ml ├── frontc_parser │ ├── dune │ └── frontc_parser_main.ml ├── ghidra │ ├── dune │ ├── ghidra_main.ml │ ├── ghidra_main.mli │ └── semantics │ │ ├── dune │ │ ├── pcode-cpuid.lisp │ │ └── pcode.lisp ├── glibc_runtime │ ├── dune │ ├── glibc_runtime_main.ml │ └── glibc_runtime_main.mli ├── ida │ ├── bap_ida_config.ml.ab │ ├── bap_ida_info.ml │ ├── bap_ida_info.mli │ ├── bap_ida_service.ml │ ├── bap_ida_service.mli │ ├── dune │ └── ida_main.ml ├── llvm │ ├── dune │ ├── llvm_main.ml │ └── llvm_main.mli ├── map_terms │ ├── dune │ ├── map_terms_features.ml │ └── map_terms_main.ml ├── mc │ ├── dune │ └── mc_main.ml ├── mips │ ├── dune │ ├── mips.ml │ ├── mips_abi.ml │ ├── mips_abi.mli │ ├── mips_arithmetic.ml │ ├── mips_branch.ml │ ├── mips_conditional.ml │ ├── mips_cpu.ml │ ├── mips_divide.ml │ ├── mips_dsl.ml │ ├── mips_dsl.mli │ ├── mips_load.ml │ ├── mips_logic.ml │ ├── mips_main.ml │ ├── mips_model.ml │ ├── mips_model.mli │ ├── mips_multiply.ml │ ├── mips_rtl.ml │ ├── mips_rtl.mli │ ├── mips_shift_and_rot.ml │ ├── mips_store.ml │ ├── mips_types.ml │ ├── mips_utils.ml │ └── mips_utils.mli ├── objdump │ ├── dune │ ├── objdump_config.ml.ab │ └── objdump_main.ml ├── optimization │ ├── dune │ ├── optimization_data.ml │ ├── optimization_data.mli │ └── optimization_main.ml ├── patterns │ ├── dune │ ├── patterns_main.ml │ └── semantics │ │ ├── dune │ │ └── pattern-actions.lisp ├── phoenix │ ├── dune │ ├── phoenix_dot.ml │ ├── phoenix_dot.mli │ ├── phoenix_helpers.ml │ ├── phoenix_helpers.mli │ ├── phoenix_main.ml │ ├── phoenix_options.ml │ ├── phoenix_output.ml │ ├── phoenix_output.mli │ ├── phoenix_printing.ml │ ├── phoenix_printing.mli │ ├── phoenix_root.ml │ └── phoenix_root.mli ├── piqi_printers │ ├── dune │ ├── piqi_printers_main.ml │ └── piqi_printers_main.mli ├── powerpc │ ├── dune │ ├── powerpc.ml │ ├── powerpc.mli │ ├── powerpc_abi.ml │ ├── powerpc_abi.mli │ ├── powerpc_add.ml │ ├── powerpc_branch.ml │ ├── powerpc_compare.ml │ ├── powerpc_cpu.ml │ ├── powerpc_cpu.mli │ ├── powerpc_cr.ml │ ├── powerpc_div.ml │ ├── powerpc_dsl.ml │ ├── powerpc_dsl.mli │ ├── powerpc_load.ml │ ├── powerpc_logical.ml │ ├── powerpc_main.ml │ ├── powerpc_model.ml │ ├── powerpc_model.mli │ ├── powerpc_move.ml │ ├── powerpc_mul.ml │ ├── powerpc_rotate.ml │ ├── powerpc_rtl.ml │ ├── powerpc_rtl.mli │ ├── powerpc_shift.ml │ ├── powerpc_store.ml │ ├── powerpc_sub.ml │ ├── powerpc_types.ml │ ├── powerpc_utils.ml │ ├── powerpc_utils.mli │ └── semantics │ │ ├── dune │ │ └── powerpc.lisp ├── primus_approximation │ ├── Makefile │ ├── approximation.ml │ ├── approximation.mli │ └── lisp │ │ ├── math.lisp │ │ └── test.lisp ├── primus_dictionary │ ├── dune │ └── primus_dictionary_main.ml ├── primus_exploring │ ├── dune │ └── primus_exploring_main.ml ├── primus_greedy │ ├── dune │ └── primus_greedy_main.ml ├── primus_limit │ ├── dune │ ├── primus_limit_main.ml │ └── primus_limit_main.mli ├── primus_lisp │ ├── dune │ ├── lisp │ │ ├── core.lisp │ │ ├── dune │ │ ├── init.lisp │ │ ├── memory.lisp │ │ └── pointers.lisp │ ├── primus_lisp_config.ml.ab │ ├── primus_lisp_documentation.ml │ ├── primus_lisp_documentation.mli │ ├── primus_lisp_ieee754.ml │ ├── primus_lisp_ieee754.mli │ ├── primus_lisp_io.ml │ ├── primus_lisp_io.mli │ ├── primus_lisp_main.ml │ ├── primus_lisp_main.mli │ ├── primus_lisp_primitives.ml │ ├── primus_lisp_primitives.mli │ ├── primus_lisp_run.ml │ ├── primus_lisp_semantic_primitives.ml │ ├── primus_lisp_semantic_primitives.mli │ ├── primus_lisp_show.ml │ ├── semantics │ │ ├── .gitignore │ │ ├── bits.lisp │ │ ├── dummy.lisp │ │ ├── dune │ │ └── ieee754.lisp │ └── site-lisp │ │ ├── ascii.lisp │ │ ├── atoi.lisp │ │ ├── char.lisp │ │ ├── dune │ │ ├── errno.lisp │ │ ├── floats.lisp │ │ ├── getopt.lisp │ │ ├── ieee754.lisp │ │ ├── libc-init.lisp │ │ ├── libintl.lisp │ │ ├── limit-malloc.lisp │ │ ├── llvm-x86-64-floats.lisp │ │ ├── locale.lisp │ │ ├── memory-allocator.lisp │ │ ├── posix.lisp │ │ ├── setjmp.lisp │ │ ├── simple-memory-allocator.lisp │ │ ├── stdio.lisp │ │ ├── stdlib.lisp │ │ ├── string.lisp │ │ ├── types.lisp │ │ └── unistd.lisp ├── primus_loader │ ├── dune │ ├── primus_loader_basic.ml │ ├── primus_loader_basic.mli │ └── primus_loader_main.ml ├── primus_mark_visited │ ├── dune │ └── primus_mark_visited_main.ml ├── primus_powerpc │ ├── dune │ └── primus_powerpc_main.ml ├── primus_print │ ├── dune │ └── primus_print_main.ml ├── primus_promiscuous │ ├── dune │ └── primus_promiscuous_main.ml ├── primus_propagate_taint │ ├── dune │ ├── primus_propagate_taint_main.ml │ └── primus_propagate_taint_main.mli ├── primus_random │ ├── dune │ ├── primus_random_main.ml │ └── primus_random_main.mli ├── primus_region │ ├── dune │ └── primus_region_main.ml ├── primus_round_robin │ ├── dune │ └── primus_round_robin_main.ml ├── primus_symbolic_executor │ ├── dune │ ├── lisp │ │ ├── dune │ │ ├── symbolic-stdio.lisp │ │ └── symbolic-stdlib.lisp │ └── primus_symbolic_executor_main.ml ├── primus_systems │ ├── dune │ ├── primus_systems_config.ml.ab │ ├── primus_systems_main.ml │ └── systems │ │ ├── core.asd │ │ └── dune ├── primus_taint │ ├── dune │ ├── lisp │ │ ├── dune │ │ ├── sensitive-sinks.lisp │ │ ├── taint-sources.lisp │ │ └── taint.lisp │ ├── primus_taint_main.ml │ ├── primus_taint_main.mli │ ├── primus_taint_policies.ml │ └── primus_taint_policies.mli ├── primus_test │ ├── dune │ ├── lisp │ │ ├── check-value.lisp │ │ ├── dune │ │ ├── incident.lisp │ │ ├── memcheck-malloc.lisp │ │ ├── memcheck.lisp │ │ └── warn-unused.lisp │ └── primus_test_main.ml ├── primus_wandering │ ├── dune │ └── primus_wandering_main.ml ├── primus_x86 │ ├── dune │ ├── primus_x86_loader.ml │ ├── primus_x86_loader.mli │ └── primus_x86_main.ml ├── print │ ├── dune │ └── print_main.ml ├── propagate_taint │ ├── dune │ ├── propagate_taint_main.ml │ ├── propagate_taint_main.mli │ ├── propagator.ml │ └── propagator.mli ├── radare2 │ ├── dune │ ├── radare2_main.ml │ └── radare2_main.mli ├── raw │ ├── dune │ ├── raw_main.ml │ └── raw_main.mli ├── read_symbols │ ├── dune │ └── read_symbols_main.ml ├── recipe_command │ ├── dune │ ├── recipe_command_main.ml │ └── recipe_command_main.mli ├── relocatable │ ├── dune │ └── rel_symbolizer.ml ├── report │ ├── dune │ └── report_main.ml ├── resolve_indirects │ └── resolve_indirects_main.ml ├── riscv │ ├── dune │ ├── riscv_main.ml │ ├── riscv_main.mli │ └── semantics │ │ ├── dune │ │ └── riscv.lisp ├── run │ ├── dune │ └── run_main.ml ├── specification │ ├── dune │ └── specification_main.ml ├── ssa │ ├── dune │ └── ssa_main.ml ├── strings │ ├── dune │ └── strings_main.ml ├── stub_resolver │ ├── dune │ ├── signatures │ │ ├── dune │ │ └── powerpc.stubs │ ├── stub_resolver.ml │ ├── stub_resolver.mli │ ├── stub_resolver_main.ml │ └── stub_resolver_sites.ml.ab ├── systemz │ ├── dune │ ├── systemz_lifter.ml │ ├── systemz_lifter.mli │ ├── systemz_main.ml │ └── systemz_main.mli ├── taint │ ├── dune │ └── taint_main.ml ├── thumb │ ├── dune │ ├── thumb_bits.ml │ ├── thumb_bits.mli │ ├── thumb_branch.ml │ ├── thumb_branch.mli │ ├── thumb_core.ml │ ├── thumb_core.mli │ ├── thumb_main.ml │ ├── thumb_main.mli │ ├── thumb_mem.ml │ ├── thumb_mem.mli │ ├── thumb_mov.ml │ ├── thumb_mov.mli │ └── thumb_opcodes.ml ├── trace │ ├── dune │ └── trace_main.ml ├── trivial_condition_form │ ├── dune │ └── trivial_condition_form_main.ml ├── warn_unused │ ├── dune │ └── warn_unused_main.ml └── x86 │ ├── dune │ ├── patterns │ ├── cet.xml │ └── patternconstraints.xml │ ├── semantics │ ├── dune │ ├── test.t │ ├── x86-32.lisp │ ├── x86-64-sse-intrinsics.lisp │ ├── x86-64.lisp │ └── x86-common.lisp │ ├── x86_backend.ml │ ├── x86_backend.mli │ ├── x86_btx.ml │ ├── x86_btx.mli │ ├── x86_cdq.ml │ ├── x86_cdq.mli │ ├── x86_cmpxchg.ml │ ├── x86_cmpxchg.mli │ ├── x86_disasm.ml │ ├── x86_disasm.mli │ ├── x86_endbr.ml │ ├── x86_legacy_bil.ml │ ├── x86_legacy_bil_arithmetic.ml │ ├── x86_legacy_bil_arithmetic.mli │ ├── x86_legacy_bil_ast.ml │ ├── x86_legacy_bil_ast.mli │ ├── x86_legacy_bil_big_int_convenience.ml │ ├── x86_legacy_bil_big_int_convenience.mli │ ├── x86_legacy_bil_convenience.ml │ ├── x86_legacy_bil_convenience.mli │ ├── x86_legacy_bil_disasm_i386.ml │ ├── x86_legacy_bil_disasm_i386.mli │ ├── x86_legacy_bil_lifter.ml │ ├── x86_legacy_bil_lifter.mli │ ├── x86_legacy_bil_pp.ml │ ├── x86_legacy_bil_pp.mli │ ├── x86_legacy_bil_register.ml │ ├── x86_legacy_bil_semantics.ml │ ├── x86_legacy_bil_semantics.mli │ ├── x86_legacy_bil_type.ml │ ├── x86_legacy_bil_type.mli │ ├── x86_legacy_bil_typecheck.ml │ ├── x86_legacy_bil_typecheck.mli │ ├── x86_legacy_bil_var.ml │ ├── x86_legacy_bil_var.mli │ ├── x86_legacy_bil_var_temp.ml │ ├── x86_legacy_bil_var_temp.mli │ ├── x86_legacy_fp_lifter.ml │ ├── x86_legacy_fp_lifter.mli │ ├── x86_legacy_operands.ml │ ├── x86_legacy_operands.mli │ ├── x86_lifter.ml │ ├── x86_lifter.mli │ ├── x86_main.ml │ ├── x86_mov.ml │ ├── x86_mov.mli │ ├── x86_mov_offset.ml │ ├── x86_opcode_btx.ml │ ├── x86_opcode_cdq.ml │ ├── x86_opcode_cmps.ml │ ├── x86_opcode_cmpxchg.ml │ ├── x86_opcode_ins.ml │ ├── x86_opcode_lods.ml │ ├── x86_opcode_mov.ml │ ├── x86_opcode_movs.ml │ ├── x86_opcode_outs.ml │ ├── x86_opcode_scas.ml │ ├── x86_opcode_stos.ml │ ├── x86_operands.ml │ ├── x86_operands.mli │ ├── x86_prefix.ml │ ├── x86_prefix.mli │ ├── x86_targets.ml │ ├── x86_targets.mli │ ├── x86_tools.ml │ ├── x86_tools.mli │ ├── x86_tools_flags.ml │ ├── x86_tools_flags.mli │ ├── x86_tools_imm.ml │ ├── x86_tools_imm.mli │ ├── x86_tools_mem.ml │ ├── x86_tools_mem.mli │ ├── x86_tools_prefix.ml │ ├── x86_tools_prefix.mli │ ├── x86_tools_reg.ml │ ├── x86_tools_reg.mli │ ├── x86_tools_types.ml │ ├── x86_tools_vector.ml │ ├── x86_tools_vector.mli │ └── x86_utils.ml ├── ppx_bap.opam ├── regular.opam ├── setup.ml.in ├── setup.ml.pre.in ├── src ├── bap_byteweight_main.ml ├── bap_byteweight_main.mli ├── bap_frontend.ml ├── bap_frontend.mli ├── bap_mc.ml ├── bap_mc.mli ├── baptop.ml └── dune ├── text-tags.opam ├── tools ├── bap_config.ab ├── bapbuild.ml ├── bapbundle.ml ├── bapbundle.mli ├── bapclean.sh ├── bapdoc.ml ├── baptop ├── binary-release.sh ├── build_plugins.sh ├── cat.ml ├── cat.mli ├── collect.ml ├── configure.ml ├── deb-build.sh ├── dune ├── install-ghidra.sh ├── oasis_sections.ml ├── ocp-indent-all.sh ├── opam-release.sh ├── postinstall.ml.ab ├── ppx-bap ├── release.sh ├── rewrite.ml └── rewrite.mli └── vagrant ├── jessie64 └── Vagrantfile ├── trusty64 └── Vagrantfile └── xenial64 └── Vagrantfile /.github/workflows/alpine.yml: -------------------------------------------------------------------------------- 1 | name: Alpine 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * MON" 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v4 13 | 14 | - name: Build on Alpine 15 | uses: docker/build-push-action@v2 16 | with: 17 | push: false 18 | file: docker/alpine/Dockerfile 19 | -------------------------------------------------------------------------------- /.github/workflows/archlinux.yml: -------------------------------------------------------------------------------- 1 | name: Archlinux 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * TUE" 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v4 13 | 14 | - name: Build on Archlinux 15 | uses: docker/build-push-action@v2 16 | with: 17 | push: false 18 | file: docker/archlinux/Dockerfile 19 | -------------------------------------------------------------------------------- /.github/workflows/debian-testing.yml: -------------------------------------------------------------------------------- 1 | name: Debian-testing 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * WED" 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v4 13 | 14 | - name: Build on Debian Testing 15 | uses: docker/build-push-action@v2 16 | with: 17 | push: false 18 | file: docker/debian/testing/Dockerfile 19 | -------------------------------------------------------------------------------- /.github/workflows/fedora.yml: -------------------------------------------------------------------------------- 1 | name: Fedora 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * THU" 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v4 13 | 14 | - name: Build on Fedora 15 | uses: docker/build-push-action@v2 16 | with: 17 | push: false 18 | file: docker/fedora/Dockerfile 19 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu-bionic.yml: -------------------------------------------------------------------------------- 1 | name: Ubuntu-bionic 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * FRI" 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v4 13 | 14 | - name: Build on Ubuntu Bionic 15 | uses: docker/build-push-action@v2 16 | with: 17 | push: false 18 | file: docker/ubuntu/bionic/Dockerfile 19 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/.gitmodules -------------------------------------------------------------------------------- /OMakeroot: -------------------------------------------------------------------------------- 1 | # include the standard installed configuration file. 2 | include $(STDROOT) 3 | 4 | # include the OMakefile in this directory. 5 | .SUBDIRS: . 6 | -------------------------------------------------------------------------------- /_tags.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/_tags.in -------------------------------------------------------------------------------- /bap-objdump.opam.template: -------------------------------------------------------------------------------- 1 | build: [ 2 | ["dune" "subst"] {dev} 3 | ["ocaml" "tools/configure.ml" "--prefix=%{prefix}%" 4 | "--objdump-paths=%{conf-binutils:objdumps}%"] 5 | [ 6 | "dune" 7 | "build" 8 | "-p" 9 | name 10 | "-j" 11 | jobs 12 | "--promote-install-files=false" 13 | "@install" 14 | "@runtest" {with-test} 15 | "@doc" {with-doc} 16 | ] 17 | ["dune" "install" "-p" name "--create-install-files" name] 18 | ] 19 | -------------------------------------------------------------------------------- /bap-signatures.opam.template: -------------------------------------------------------------------------------- 1 | 2 | build: [] 3 | install: [ 4 | ["tar" "xvf" "sigs.tar.gz"] 5 | ["mkdir" "-p" "%{share}%/bap/signatures/"] 6 | ["cp" "data/sigs.zip" "%{share}%/bap/signatures/byteweight.zip"] 7 | ["cp" "-r" "data/Ghidra" "%{share}%/bap/signatures/"] 8 | ] 9 | extra-source "sigs.tar.gz" { 10 | src: 11 | "https://github.com/BinaryAnalysisPlatform/bap/releases/download/v2.4.0/sigs.tar.gz" 12 | checksum: "md5=04e2ebb1b30d2d12bf2ceb240544044f" 13 | } 14 | -------------------------------------------------------------------------------- /benchmarks/bench_image.mli: -------------------------------------------------------------------------------- 1 | open Core_bench.Std 2 | 3 | val tests : Bench.Test.t list 4 | -------------------------------------------------------------------------------- /benchmarks/run_benchmarks.ml: -------------------------------------------------------------------------------- 1 | open Core 2 | open Core_bench.Std 3 | open Bap.Std 4 | 5 | let benchmarks = Bench.make_command @@ List.concat [ 6 | Bench_dom.tests; 7 | Bench_image.tests; 8 | ] 9 | 10 | 11 | let () = Command.run benchmarks 12 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: doc 2 | 3 | 4 | doc: 5 | ../bapdoc.native 2>bapdoc.log 6 | -------------------------------------------------------------------------------- /docker/2.4.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:debian-ocaml-4.14 2 | 3 | WORKDIR /home/opam 4 | 5 | RUN opam remote set-url default https://opam.ocaml.org \ 6 | && opam update \ 7 | && opam depext --update --install bap.2.4.0 --yes -j 1 \ 8 | && opam clean -acrs 9 | 10 | ENTRYPOINT ["opam", "config", "exec", "--"] 11 | -------------------------------------------------------------------------------- /docker/2.5.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:debian-ocaml-4.14 2 | 3 | WORKDIR /home/opam 4 | 5 | RUN opam remote set-url default https://opam.ocaml.org \ 6 | && opam update \ 7 | && opam depext --update --install bap.2.5.0 --yes -j 1 \ 8 | && opam clean -acrs 9 | 10 | ENTRYPOINT ["opam", "config", "exec", "--"] 11 | -------------------------------------------------------------------------------- /docker/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:alpine-ocaml-4.14 2 | 3 | WORKDIR /home/opam 4 | 5 | RUN opam remote set-url default https://opam.ocaml.org \ 6 | && opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing --all \ 7 | && opam update \ 8 | && opam depext --install bap --yes -j 1 9 | 10 | 11 | ENTRYPOINT ["opam", "config", "exec", "--"] 12 | -------------------------------------------------------------------------------- /docker/archlinux/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:archlinux-ocaml-4.14 2 | 3 | RUN opam remote set-url default https://opam.ocaml.org \ 4 | && opam repo add bap-testing git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing --all \ 5 | && opam update \ 6 | && opam depext --install bap --yes -j 1 \ 7 | && opam clean -acrs 8 | 9 | ENTRYPOINT ["opam", "config", "exec", "--"] 10 | -------------------------------------------------------------------------------- /docker/debian/testing/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:debian-ocaml-4.14 2 | 3 | WORKDIR /home/opam 4 | 5 | RUN opam remote set-url default https://opam.ocaml.org \ 6 | && opam repo add bap-testing git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing --all \ 7 | && opam update \ 8 | && opam depext --install bap --yes -j 1 \ 9 | && opam clean -acrs 10 | 11 | ENTRYPOINT ["opam", "config", "exec", "--"] 12 | -------------------------------------------------------------------------------- /docker/fedora/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:fedora-ocaml-4.14 2 | 3 | WORKDIR /home/opam 4 | 5 | RUN opam remote set-url default https://opam.ocaml.org \ 6 | && opam repo add bap-testing git+https://github.com/BinaryAnalysisPlatform/opam-repository#testing --all \ 7 | && opam update \ 8 | && opam depext --install bap --yes -j 1 \ 9 | && opam clean -acrs 10 | 11 | ENTRYPOINT ["opam", "config", "exec", "--"] 12 | -------------------------------------------------------------------------------- /docker/ubuntu/noble/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:ubuntu-24.04-ocaml-4.14 2 | 3 | WORKDIR /home/opam 4 | 5 | RUN opam remote set-url default https://opam.ocaml.org \ 6 | && opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository --all \ 7 | && opam update \ 8 | && opam depext --install bap --yes -j 1 \ 9 | && opam clean -acrs 10 | 11 | ENTRYPOINT ["opam", "config", "exec", "--" ] 12 | -------------------------------------------------------------------------------- /docker/ubuntu/xenial/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ocaml/opam:ubuntu-16.04-ocaml-4.14 2 | 3 | WORKDIR /home/opam 4 | 5 | RUN opam remote set-url default https://opam.ocaml.org \ 6 | && opam repo add bap git+https://github.com/BinaryAnalysisPlatform/opam-repository --all \ 7 | && opam update \ 8 | && opam depext --install bap --yes -j 1 \ 9 | && opam clean -acrs 10 | 11 | ENTRYPOINT ["opam", "config", "exec", "--" ] 12 | -------------------------------------------------------------------------------- /lib/arm/ARM.ml: -------------------------------------------------------------------------------- 1 | include Arm_types 2 | include Arm_lifter 3 | module Insn = Arm_insn 4 | module Cond = Arm_cond 5 | module Reg = Arm_reg 6 | module Op = Arm_op 7 | -------------------------------------------------------------------------------- /lib/arm/arm_bit.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open Arm_types 4 | 5 | 6 | 7 | val extend : dest:op -> src:op -> ?src2:op -> sign -> [< `B | `H ] -> rot:op -> op -> stmt list 8 | 9 | val bit_field_insert : dest:op -> src:op -> Word.t -> op -> stmt list 10 | 11 | 12 | val bit_extract : dest:op -> src:op -> sign -> lsb:op -> widthminus1:op -> op -> stmt list 13 | -------------------------------------------------------------------------------- /lib/arm/arm_branch.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open Arm_types 4 | 5 | val lift : op -> ?link:bool -> ?x:bool -> ?cond:op -> word -> stmt list 6 | -------------------------------------------------------------------------------- /lib/arm/arm_cond.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Regular.Std 3 | open Bap.Std 4 | open Arm_types 5 | 6 | type t = cond [@@deriving bin_io, compare, sexp] 7 | 8 | (** decodes condition value from a word *) 9 | val create : word -> cond Or_error.t 10 | 11 | include Regular.S with type t := t 12 | -------------------------------------------------------------------------------- /lib/arm/arm_flags.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open Arm_types 4 | 5 | val set_nzf : exp -> typ -> stmt list 6 | 7 | val set_vnzf_add : exp -> exp -> exp -> typ -> stmt list 8 | 9 | val set_add : exp -> exp -> exp -> typ -> stmt list 10 | 11 | val set_sub : exp -> exp -> exp -> typ -> stmt list 12 | 13 | val set_vnzf_sub : exp -> exp -> exp -> typ -> stmt list 14 | 15 | val set_adc : exp -> exp -> exp -> typ -> stmt list 16 | 17 | val set_sbc : exp -> exp -> exp -> typ -> stmt list 18 | 19 | val set_cf_data : imm:word -> data:word -> stmt 20 | -------------------------------------------------------------------------------- /lib/arm/arm_helpers.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | let sexpable_of_string t_of_sexp name = 4 | try Some (t_of_sexp @@ Sexp.of_string name) 5 | with Sexp.Of_sexp_error _ -> None 6 | -------------------------------------------------------------------------------- /lib/arm/arm_helpers.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | val sexpable_of_string : (Sexp.t -> 'a) -> string -> 'a option 4 | -------------------------------------------------------------------------------- /lib/arm/arm_insn.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Regular.Std 3 | 4 | 5 | (** insn opcode. 6 | 7 | In contradicition with BAP insn, the ARM one is just an opcode, 8 | without operands. (Possibly, opcode would be a much better 9 | name). *) 10 | type t = Arm_types.insn [@@deriving bin_io, compare, sexp] 11 | 12 | 13 | (** [create insn] translate from BAP [insn] *) 14 | val create : insn -> t option 15 | 16 | 17 | (** [of_basic insn] translate from BAP basic [insn] *) 18 | val of_basic : ('a,'b) Disasm_expert.Basic.insn -> t option 19 | 20 | include Regular.S with type t := t 21 | -------------------------------------------------------------------------------- /lib/arm/arm_lifter.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | 3 | (** [lift mem insn] lifts instruction. *) 4 | val lift : lifter 5 | 6 | module CPU : sig 7 | include module type of Arm_env 8 | include Bap.Std.CPU 9 | end 10 | -------------------------------------------------------------------------------- /lib/arm/arm_mem.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open Arm_types 4 | 5 | val lift_r : 6 | dst1:var -> 7 | ?dst2:var -> 8 | base:var -> 9 | offset:exp -> 10 | mode_r -> 11 | sign -> 12 | size -> 13 | operation -> stmt list 14 | 15 | val lift_m : var list -> var -> mode_m -> update_m -> operation -> stmt list 16 | -------------------------------------------------------------------------------- /lib/arm/arm_mov.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_core_theory 3 | open Bap.Std 4 | open Arm_types 5 | 6 | val lift : 7 | ?encoding:Theory.language -> 8 | ?dest:op -> 9 | op -> 10 | ?src2:op -> 11 | data_oper -> 12 | ?sreg:op -> 13 | ?simm:op -> 14 | word -> 15 | wflag:op -> 16 | op -> 17 | stmt list 18 | -------------------------------------------------------------------------------- /lib/arm/arm_mul.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open Arm_types 4 | 5 | val lift_mull : 6 | lodest:op -> 7 | hidest:op -> 8 | src1:op -> src2:op -> sign -> ?addend:'a -> wflag:op -> op -> stmt list 9 | 10 | val lift_smul : 11 | dest:op -> 12 | ?hidest:op -> 13 | src1:op -> 14 | src2:op -> 15 | ?accum:op -> ?hiaccum:op -> ?q:bool -> smul_size -> op -> stmt list 16 | -------------------------------------------------------------------------------- /lib/arm/arm_op.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Regular.Std 3 | 4 | type t = Arm_types.op [@@deriving bin_io, compare, sexp] 5 | include Regular.S with type t := t 6 | 7 | 8 | (** [create op] projects bap generic operand into arm specific. 9 | Floating point operands are currently ignored.*) 10 | val create : op -> t option 11 | -------------------------------------------------------------------------------- /lib/arm/arm_reg.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Regular.Std 3 | open Bap.Std 4 | open Arm_helpers 5 | 6 | type t = Arm_types.reg [@@deriving bin_io, compare, sexp] 7 | 8 | let create reg : t option = 9 | sexpable_of_string t_of_sexp (Reg.name reg) 10 | 11 | include Regular.Make(struct 12 | type nonrec t = t [@@deriving bin_io, compare, sexp] 13 | let hash (reg : t) = Hashtbl.hash reg 14 | let module_name = Some "ARM.Reg" 15 | let version = "1.0.0" 16 | let pp fmt reg = 17 | Format.fprintf fmt "%a" Sexp.pp (sexp_of_t reg) 18 | end) 19 | -------------------------------------------------------------------------------- /lib/arm/arm_reg.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Regular.Std 3 | 4 | type t = Arm_types.reg [@@deriving bin_io, compare, sexp] 5 | 6 | (** lifts basic register to a ARM one *) 7 | val create : reg -> t option 8 | 9 | include Regular.S with type t := t 10 | -------------------------------------------------------------------------------- /lib/arm/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_arm) 3 | (public_name bap-arm) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries 7 | bap 8 | bap-core-theory 9 | bap-knowledge 10 | bap-primus 11 | bap-traces 12 | bitvec 13 | bitvec-order 14 | core_kernel 15 | ogre 16 | regular)) 17 | -------------------------------------------------------------------------------- /lib/bap/bap_init_toplevel.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap/bap_init_toplevel.mli -------------------------------------------------------------------------------- /lib/bap_abi/bap_abi.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | 5 | let passes : (project -> project) list ref = ref [] 6 | 7 | let pass proj = 8 | List.fold !passes ~init:proj ~f:(fun proj pass -> 9 | pass proj) 10 | 11 | let register_pass pass = 12 | passes := pass :: !passes 13 | 14 | 15 | let name = Value.Tag.register (module String) 16 | ~uuid:"ce10e129-4cae-4f49-9b21-8e00d3635067" 17 | ~name:"abi-name" 18 | -------------------------------------------------------------------------------- /lib/bap_abi/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_abi) 3 | (public_name bap-abi) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries bap core_kernel)) 7 | -------------------------------------------------------------------------------- /lib/bap_api/bap_api.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | type filename = string 5 | type api = string 6 | 7 | module type S = sig 8 | type t 9 | val language : string 10 | val parse : (string -> string option) -> string list -> t Or_error.t 11 | val mapper : t -> Term.mapper 12 | end 13 | 14 | type t = (module S) 15 | 16 | let registry = ref [] 17 | let process api = registry := api :: !registry 18 | let processors () = !registry 19 | -------------------------------------------------------------------------------- /lib/bap_api/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_api) 3 | (public_name bap-api) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries bap core_kernel)) -------------------------------------------------------------------------------- /lib/bap_bml/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_bml) 3 | (public_name bap-bml) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap core_kernel)) 7 | -------------------------------------------------------------------------------- /lib/bap_build/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_build) 3 | (public_name bap-build) 4 | (wrapped false) 5 | (libraries findlib ocamlbuild)) -------------------------------------------------------------------------------- /lib/bap_bundle/bap_bundle_config.ml.ab: -------------------------------------------------------------------------------- 1 | let plugindir = "$plugindir" 2 | -------------------------------------------------------------------------------- /lib/bap_bundle/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_bundle) 3 | (public_name bap-bundle) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries uri camlzip unix core_kernel core_kernel.caml_unix)) 7 | 8 | (rule 9 | (target bap_bundle_config.ml) 10 | (deps bap_bundle_config.ml.ab (alias ../../config)) 11 | (action 12 | (with-stdin-from %{deps} 13 | (with-stdout-to %{target} 14 | (chdir %{workspace_root} 15 | (run ./tools/rewrite.exe -filename %{deps})))))) 16 | -------------------------------------------------------------------------------- /lib/bap_byteweight/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_byteweight) 3 | (public_name bap-byteweight) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap bap-main bap-core-theory bap-knowledge 7 | core_kernel uri camlzip)) 8 | -------------------------------------------------------------------------------- /lib/bap_c/.ocamlinit: -------------------------------------------------------------------------------- 1 | #use "topfind" 2 | #require "bap.top" 3 | #require "bap-c";; 4 | #require "FrontC";; 5 | open Bap.Std;; 6 | open Bap_c.Std;; -------------------------------------------------------------------------------- /lib/bap_c/bap_c_attr.mli: -------------------------------------------------------------------------------- 1 | (** Attribute processing. 2 | 3 | This module allows to attach a semantic action for C attributes. 4 | Each action is a term transformation, that should do nothing, if 5 | an attribute is not known to him. 6 | *) 7 | open Bap.Std 8 | open Bap_c_type 9 | 10 | (** a type of action *) 11 | type 'a pass = attr -> 'a term -> 'a term 12 | 13 | (** register an action *) 14 | val register : sub pass -> unit 15 | 16 | (** apply all registered actions *) 17 | val apply : sub pass 18 | -------------------------------------------------------------------------------- /lib/bap_c/bap_c_parser.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type decls = (string * Bap_c_type.t) list 4 | type parser = Bap_c_size.base -> string -> decls Or_error.t 5 | 6 | let parser = ref None 7 | let provide p = parser := Some p 8 | 9 | let run size file = match !parser with 10 | | None -> Or_error.error_string "C parser is not available" 11 | | Some parse -> parse size file 12 | -------------------------------------------------------------------------------- /lib/bap_c/bap_c_parser.mli: -------------------------------------------------------------------------------- 1 | (** A parser interface. 2 | 3 | The module doesn't provide any parsers by itself, but allows it to 4 | be provided by a third party module. 5 | *) 6 | open Core_kernel[@@warning "-D"] 7 | 8 | type decls = (string * Bap_c_type.t) list 9 | type parser = Bap_c_size.base -> string -> decls Or_error.t 10 | 11 | (** [run filename] parses file and returns a mapping from identifier 12 | to its type.*) 13 | val run : parser 14 | 15 | (** called by a plugin that provides a parser. *) 16 | val provide : parser -> unit 17 | -------------------------------------------------------------------------------- /lib/bap_c/bap_c_type_printer.ml: -------------------------------------------------------------------------------- 1 | let pp = Bap_c_type.pp and pp_proto = Bap_c_type.pp_proto 2 | -------------------------------------------------------------------------------- /lib/bap_c/bap_c_type_printer.mli: -------------------------------------------------------------------------------- 1 | open Format 2 | open Bap_c_type 3 | 4 | val pp : formatter -> t -> unit 5 | val pp_proto : formatter -> proto -> unit 6 | -------------------------------------------------------------------------------- /lib/bap_c/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_c) 3 | (public_name bap-c) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-abi 8 | bap-api 9 | bap-core-theory 10 | bap-knowledge 11 | core_kernel 12 | monads 13 | regular)) -------------------------------------------------------------------------------- /lib/bap_core_theory/bap_core_theory_basic.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory_definition 2 | module Make(S : Minimal) : Basic 3 | -------------------------------------------------------------------------------- /lib/bap_core_theory/bap_core_theory_empty.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory_definition 2 | 3 | module Core : Core 4 | -------------------------------------------------------------------------------- /lib/bap_core_theory/bap_core_theory_pass.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_knowledge 3 | open Bap_core_theory_definition 4 | 5 | module type trans = functor (_ : Core) -> Core 6 | 7 | 8 | val register : 9 | ?desc:string -> 10 | ?package:string -> string -> (module trans) -> unit 11 | 12 | val lookup : Knowledge.Name.t -> (module trans) 13 | 14 | val apply : Knowledge.Name.t list -> (module Core) -> (module Core) 15 | 16 | module Desugar(CT : Core) : Core 17 | -------------------------------------------------------------------------------- /lib/bap_core_theory/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_core_theory) 3 | (public_name bap-core-theory) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries bap-knowledge core_kernel core_kernel.caml_unix 7 | bitvec bitvec-order bitvec-sexp bitvec-binprot)) -------------------------------------------------------------------------------- /lib/bap_demangle/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_demangle) 3 | (public_name bap-demangle) 4 | (libraries bap-core-theory bap-knowledge core_kernel)) 5 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_disasm_calls.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_core_theory 3 | open Graphlib.Std 4 | open Bap_types.Std 5 | module Driver = Bap_disasm_driver 6 | 7 | type t [@@deriving bin_io] 8 | 9 | val empty : t 10 | val equal : t -> t -> bool 11 | val update : t -> Driver.state -> t KB.t 12 | val belongs : t -> entry:addr -> addr -> bool 13 | val entry : t -> addr -> addr 14 | val entries : t -> Set.M(Addr).t 15 | val siblings : t -> addr -> addr -> bool 16 | val domain : t KB.domain 17 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_disasm_linear_sweep.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_types.Std 3 | open Bap_image_std 4 | 5 | type insn = Bap_disasm_insn.t 6 | 7 | type t = (mem * insn option) list 8 | 9 | val sweep : ?backend:string -> arch -> mem -> t Or_error.t 10 | 11 | module With_exn : sig 12 | val sweep : ?backend:string -> arch -> mem -> t 13 | end 14 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_disasm_reconstructor.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_types.Std 3 | open Bap_image_std 4 | 5 | open Bap_disasm_block 6 | open Bap_disasm_symtab 7 | open Bap_disasm_source 8 | 9 | type cfg = Bap_disasm_rec.Cfg.t 10 | 11 | type t 12 | type reconstructor = t 13 | 14 | val create : (cfg -> symtab) -> t 15 | val default : (word -> string) -> word list -> t 16 | val of_blocks : (string * addr * addr) seq -> t 17 | val run : t -> cfg -> symtab 18 | 19 | module Factory : Factory with type t = t 20 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_disasm_source_factory.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_types.Std 3 | open Bap_image_std 4 | open Bap_disasm_source_intf 5 | open Bap_future.Std 6 | 7 | module Tab = String.Table 8 | 9 | module Factory = struct 10 | module type S = Factory 11 | module Make(T : T) = struct 12 | type t = T.t 13 | let factory : t source Tab.t = Tab.create () 14 | 15 | let register name source = 16 | Hashtbl.set factory ~key:name ~data:source 17 | 18 | let list () = Hashtbl.keys factory 19 | let find = Hashtbl.find factory 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_disasm_source_factory.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_disasm_source_intf 3 | 4 | module Factory : sig 5 | module type S = Factory 6 | module Make(T : T) : S with type t = T.t 7 | end 8 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_disasm_source_intf.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_types.Std 3 | open Bap_image_std 4 | open Bap_future.Std 5 | 6 | type 'a t = 'a Or_error.t stream 7 | type 'a source = 'a t 8 | 9 | module type Factory = sig 10 | type t 11 | val list : unit -> string list 12 | val find : string -> t source option 13 | val register : string -> t source -> unit 14 | end 15 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_disasm_types.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_types.Std 3 | open Bap_image_std 4 | 5 | module Basic = Bap_disasm_basic 6 | 7 | module Kind = Bap_insn_kind 8 | 9 | module Op = Basic.Op 10 | module Reg = Basic.Reg 11 | module Fmm = Basic.Fmm 12 | module Imm = Basic.Imm 13 | 14 | type reg = Reg.t [@@deriving bin_io, compare, sexp] 15 | type imm = Imm.t [@@deriving bin_io, compare, sexp] 16 | type fmm = Fmm.t [@@deriving bin_io, compare, sexp] 17 | type kind = Kind.t [@@deriving bin_io, compare, sexp] 18 | -------------------------------------------------------------------------------- /lib/bap_disasm/bap_insn_aliasing.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_types.Std 3 | 4 | module Dis = Bap_disasm_basic 5 | module Memory = Bap_memory 6 | 7 | let is_exec_ok gmem_min gmem_max lmem = 8 | Addr.((Memory.min_addr lmem) >= gmem_min) && 9 | Addr.((Memory.max_addr lmem) <= gmem_max) 10 | 11 | let targ_in_mem gmem_min gmem_max addr = 12 | Addr.(addr >= gmem_min && addr < gmem_max) 13 | -------------------------------------------------------------------------------- /lib/bap_dwarf/bap_dwarf.ml: -------------------------------------------------------------------------------- 1 | module Std = struct 2 | module Leb128 = Dwarf_leb128 3 | module Dwarf = struct 4 | include Dwarf_types 5 | module Fbi = Dwarf_fbi 6 | module Data = Dwarf_data 7 | module Buffer = Data.Buffer 8 | module Fn = Fbi.Fn 9 | type fn = Fn.t [@@deriving bin_io, compare, sexp] 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/bap_dwarf/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_dwarf) 3 | (public_name bap-dwarf) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap core_kernel core_kernel.binary_packing regular)) 7 | -------------------------------------------------------------------------------- /lib/bap_elementary/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_elementary) 3 | (public_name bap-elementary) 4 | (wrapped false) 5 | (libraries bap bap-core-theory bap-knowledge bitvec core_kernel)) 6 | -------------------------------------------------------------------------------- /lib/bap_elf/bap_elf.ml: -------------------------------------------------------------------------------- 1 | module Std = struct 2 | module Elf = struct 3 | include Elf_types 4 | type t = elf 5 | include Elf_utils 6 | include Elf_parse 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/bap_elf/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_elf) 3 | (public_name bap-elf) 4 | (preprocess (pps ppx_bap ppx_bitstring)) 5 | (wrapped false) 6 | (libraries bap bitstring core_kernel regular)) 7 | -------------------------------------------------------------------------------- /lib/bap_elf/elf_internal_utils.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | let int_of_int64 n = match Int64.to_int n with 4 | | Some v -> Ok v 5 | | None -> Or_error.errorf "number %LdL doesn't fit into int" n 6 | -------------------------------------------------------------------------------- /lib/bap_elf/elf_internal_utils.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | val int_of_int64 : int64 -> int Or_error.t 4 | -------------------------------------------------------------------------------- /lib/bap_elf/elf_parse.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Elf_types 3 | 4 | val from_bigstring : ?pos:int -> ?len:int -> Bigstring.t -> elf Or_error.t 5 | -------------------------------------------------------------------------------- /lib/bap_elf/elf_utils.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Elf_types 3 | 4 | (** [section_name data elf section] extracts section name from data *) 5 | val section_name : Bigstring.t -> elf -> section -> string Or_error.t 6 | 7 | 8 | val string_of_section : Bigstring.t -> section -> string Or_error.t 9 | -------------------------------------------------------------------------------- /lib/bap_future/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_future) 3 | (public_name bap-future) 4 | (wrapped false) 5 | (libraries core_kernel monads)) -------------------------------------------------------------------------------- /lib/bap_ghidra/bap_ghidra.ml: -------------------------------------------------------------------------------- 1 | external ghidra_init : string -> bool -> int = "disasm_ghidra_init_stub" 2 | 3 | let init ?(paths=["/usr/share/ghidra"]) ?(print_targets=false) () = 4 | let paths = String.concat ":" paths in 5 | if ghidra_init paths print_targets < 0 then 6 | failwith "failed to initialize ghidra backend. See stderr for information" 7 | -------------------------------------------------------------------------------- /lib/bap_ghidra/bap_ghidra.mli: -------------------------------------------------------------------------------- 1 | val init : 2 | ?paths:string list -> 3 | ?print_targets:bool -> 4 | unit -> unit 5 | -------------------------------------------------------------------------------- /lib/bap_ghidra/dune: -------------------------------------------------------------------------------- 1 | (* -*- tuareg -*- *) 2 | 3 | let () = Format.kasprintf Jbuild_plugin.V1.send {| 4 | (library 5 | (name bap_ghidra) 6 | (public_name bap-ghidra) 7 | (wrapped false) 8 | (preprocess (pps ppx_bap)) 9 | (libraries bap core_kernel mmap) 10 | (foreign_stubs 11 | (language cxx) 12 | (names ghidra_disasm) 13 | (extra_deps (glob_files *.hpp)) 14 | (flags :standard -fPIC)) 15 | (foreign_stubs 16 | (language c) 17 | (names ghidra_stubs)) 18 | (c_library_flags :standard -L/usr/lib/ghidra -ldecomp) 19 | (enabled_if %b)) 20 | |} (Sys.file_exists "/usr/lib/ghidra") 21 | -------------------------------------------------------------------------------- /lib/bap_ghidra/ghidra_disasm.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | int disasm_ghidra_init(const char *paths, int print_targets); 6 | 7 | #ifdef __cplusplus 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /lib/bap_ghidra/ghidra_disasm.hpp: -------------------------------------------------------------------------------- 1 | #include "ghidra_disasm.h" 2 | -------------------------------------------------------------------------------- /lib/bap_ghidra/ghidra_stubs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "ghidra_disasm.h" 8 | 9 | value disasm_ghidra_init_stub(value paths, value print_targets) { 10 | CAMLparam2(paths, print_targets); 11 | char *s = strdup(String_val(paths)); 12 | int r = Val_int(disasm_ghidra_init(s, Bool_val(print_targets))); 13 | free(s); 14 | CAMLreturn(r); 15 | } 16 | -------------------------------------------------------------------------------- /lib/bap_ida/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_ida) 3 | (public_name bap-ida) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries core_kernel fileutils re.posix)) 7 | -------------------------------------------------------------------------------- /lib/bap_image/bap_fileutils.mli: -------------------------------------------------------------------------------- 1 | (**Helper IO functions. *) 2 | 3 | open Core_kernel[@@warning "-D"] 4 | open Bap_types.Std 5 | 6 | val readfile : string -> Bigstring.t 7 | 8 | val parse_name : string -> (string * string option) option 9 | -------------------------------------------------------------------------------- /lib/bap_image/bap_image_std.ml: -------------------------------------------------------------------------------- 1 | (** bring to scope some basic types like [mem] and [table] *) 2 | include Image_internal_std 3 | 4 | module Image = Bap_image 5 | module Segment = Image.Segment 6 | module Symbol = Image.Symbol 7 | 8 | type image = Image.t 9 | type symbol = Symbol.t [@@deriving bin_io, compare, sexp] 10 | type segment = Segment.t [@@deriving bin_io, compare, sexp] 11 | -------------------------------------------------------------------------------- /lib/bap_image/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_image) 3 | (public_name bap-std.image) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries 7 | bap-core-theory 8 | bap-knowledge 9 | bap_types 10 | core_kernel 11 | core_kernel.caml_unix 12 | mmap 13 | monads 14 | ogre 15 | regular)) -------------------------------------------------------------------------------- /lib/bap_image/image_internal_std.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_types.Std 3 | 4 | include Image_common 5 | 6 | module Table = Bap_table 7 | type 'a table = 'a Table.t [@@deriving sexp_of] 8 | 9 | module Backend = Image_backend 10 | type backend = Backend.t 11 | 12 | module Memory = Bap_memory 13 | type mem = Memory.t [@@deriving bin_io, sexp_of] 14 | 15 | module Memmap = Bap_memmap 16 | type 'a memmap = 'a Memmap.t [@@deriving sexp_of] 17 | -------------------------------------------------------------------------------- /lib/bap_llvm/bap_llvm.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | let strip_version ver = 4 | if String.length ver <> 5 then ver 5 | else String.sub ver 0 3 6 | 7 | 8 | module Std = struct 9 | type x86_syntax = [`att | `intel] [@@deriving sexp] 10 | 11 | let llvm_version = strip_version Bap_llvm_config.version 12 | let init_disassembler = Bap_llvm_disasm.init 13 | let init_loader ?base ?pdb_path () = 14 | ok_exn @@ Bap_llvm_loader.init ?base ?pdb_path () 15 | end 16 | -------------------------------------------------------------------------------- /lib/bap_llvm/bap_llvm_config.ml.ab: -------------------------------------------------------------------------------- 1 | let version = "$llvm_version" -------------------------------------------------------------------------------- /lib/bap_llvm/bap_llvm_disasm.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type x86_syntax = [`att | `intel] [@@deriving sexp] 4 | 5 | val init : ?x86_syntax:x86_syntax -> unit -> unit Or_error.t 6 | 7 | val version : string 8 | -------------------------------------------------------------------------------- /lib/bap_llvm/bap_llvm_loader.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | val init : ?base:int64 -> ?pdb_path:string -> unit -> unit Or_error.t 4 | -------------------------------------------------------------------------------- /lib/bap_llvm/config/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name llvm_configurator) 3 | (libraries base stdio dune-configurator)) 4 | 5 | (rule 6 | (target llvm_config.ml) 7 | (deps llvm_config.ml.ab (alias ../../../config)) 8 | (action 9 | (with-stdin-from %{deps} 10 | (with-stdout-to %{target} 11 | (chdir %{workspace_root} 12 | (run ./tools/rewrite.exe -filename %{deps})))))) 13 | -------------------------------------------------------------------------------- /lib/bap_llvm/config/llvm_config.ml.ab: -------------------------------------------------------------------------------- 1 | let llvm_config = "${llvm-config}" -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_coff_loader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_coff_loader.cpp -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_coff_loader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_coff_loader.h -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_disasm.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | int disasm_llvm_init(); 6 | 7 | #ifdef __cplusplus 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_disasm.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_disasm.hpp -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_elf_loader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_elf_loader.cpp -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_elf_loader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_elf_loader.h -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_error_or.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_error_or.cpp -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_error_or.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_error_or.h -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_loader.h: -------------------------------------------------------------------------------- 1 | #ifndef LLVM_LOADER_H 2 | #define LLVM_LOADER_H 3 | 4 | #include 5 | 6 | struct bap_llvm_loader; 7 | 8 | const struct bap_llvm_loader* bap_llvm_loader_create(const char*, size_t, const char *); 9 | const char* bap_llvm_loader_data(const struct bap_llvm_loader*); 10 | bool bap_llvm_loader_failed(const struct bap_llvm_loader*); 11 | bool bap_llvm_file_not_supported(const struct bap_llvm_loader*); 12 | void bap_llvm_loader_destroy(const struct bap_llvm_loader*); 13 | 14 | #endif // LLVM_LOADER_H 15 | -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_loader_stubs.h: -------------------------------------------------------------------------------- 1 | #include "caml/mlvalues.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | value bap_llvm_load_stub(value, value); 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_loader_utils.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_loader_utils.cpp -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_loader_utils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_loader_utils.h -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_macho_loader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_macho_loader.cpp -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_macho_loader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_macho_loader.h -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_pdb_loader.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_pdb_loader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_pdb_loader.h -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_primitives.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib/bap_llvm/llvm_primitives.h -------------------------------------------------------------------------------- /lib/bap_llvm/llvm_stubs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "llvm_disasm.h" 3 | 4 | 5 | value disasm_llvm_init_stub(value unit) { 6 | return Val_int(disasm_llvm_init()); 7 | } 8 | -------------------------------------------------------------------------------- /lib/bap_main/bap_main_log.mli: -------------------------------------------------------------------------------- 1 | val in_directory : ?logdir:string -> unit -> unit 2 | val process_events : Format.formatter -> unit 3 | -------------------------------------------------------------------------------- /lib/bap_mips/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_mips) 3 | (public_name bap-mips) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap bap-core-theory bap-knowledge core_kernel ogre)) 7 | -------------------------------------------------------------------------------- /lib/bap_plugins/bap_plugins_config.ml.ab: -------------------------------------------------------------------------------- 1 | let plugindir = "$plugindir" 2 | -------------------------------------------------------------------------------- /lib/bap_plugins/bap_plugins_loader_backend.ml: -------------------------------------------------------------------------------- 1 | let load = ref Dynlink.loadfile 2 | 3 | let install loader = load := loader 4 | let load x = !load x 5 | -------------------------------------------------------------------------------- /lib/bap_plugins/bap_plugins_loader_backend.mli: -------------------------------------------------------------------------------- 1 | val install : (string -> unit) -> unit 2 | val load : string -> unit 3 | -------------------------------------------------------------------------------- /lib/bap_plugins/bap_plugins_package.ml: -------------------------------------------------------------------------------- 1 | let find_exn name = 2 | let dir = Findlib.package_directory name in 3 | let nat = if Dynlink.is_native then "native" else "byte" in 4 | let pre = ["plugin"; nat ] in 5 | let cmx = Findlib.package_property pre name "archive" in 6 | let file = Dynlink.adapt_filename cmx in 7 | Findlib.resolve_path ~base:dir file 8 | 9 | let resolve name = 10 | try Some (find_exn name) with _ -> None 11 | 12 | let list () = Findlib.list_packages' () 13 | -------------------------------------------------------------------------------- /lib/bap_plugins/bap_plugins_package.mli: -------------------------------------------------------------------------------- 1 | val resolve : string -> string option 2 | val list : unit -> string list 3 | -------------------------------------------------------------------------------- /lib/bap_plugins/bap_plugins_units.mli: -------------------------------------------------------------------------------- 1 | (** Internal module. *) 2 | 3 | module Make() : Bap_plugins_units_intf.S 4 | -------------------------------------------------------------------------------- /lib/bap_powerpc/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_powerpc) 3 | (public_name bap-powerpc) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap bap-knowledge bap-core-theory core_kernel ogre)) 7 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_analysis.ml: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Bap_knowledge 3 | 4 | module Machine = struct 5 | type 'a m = 'a Knowledge.t 6 | include Bap_primus_machine.Make(Knowledge) 7 | let collect p o = lift (Knowledge.collect p o) 8 | let resolve p o = lift (Knowledge.resolve p o) 9 | let provide p o x = lift (Knowledge.provide p o x) 10 | let suggest a p o x = lift (Knowledge.suggest a p o x) 11 | end 12 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_analysis.mli: -------------------------------------------------------------------------------- 1 | open Bap_primus_types 2 | open Bap_knowledge 3 | 4 | module Machine : sig 5 | open Knowledge 6 | include Machine with type 'a m = 'a Knowledge.t 7 | and type 'a t = 'a Bap_primus_machine.Make(Knowledge).t 8 | 9 | val collect : ('a,'p) slot -> 'a obj -> 'p t 10 | val resolve : ('a,'p opinions) slot -> 'a obj -> 'p t 11 | val provide : ('a,'p) slot -> 'a obj -> 'p -> unit t 12 | val suggest : agent -> ('a,'p opinions) slot -> 'a obj -> 'p -> unit t 13 | end 14 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_env.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Bap_primus_types 3 | 4 | module Generator = Bap_primus_generator 5 | 6 | type exn += Undefined_var of var 7 | 8 | val generated : (var * value) Bap_primus_observation.t 9 | 10 | module Make(Machine : Machine) : sig 11 | val get : var -> value Machine.t 12 | val set : var -> value -> unit Machine.t 13 | val add : var -> Generator.t -> unit Machine.t 14 | val del : var -> unit Machine.t 15 | val has : var -> bool Machine.t 16 | val all : var seq Machine.t 17 | val is_set : var -> bool Machine.t 18 | end 19 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_exn.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type t = exn = .. 4 | let to_string err = Caml.Printexc.to_string err 5 | let add_printer pr = Caml.Printexc.register_printer pr 6 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_exn.mli: -------------------------------------------------------------------------------- 1 | type t = .. 2 | val to_string : t -> string 3 | val add_printer : (t -> string option) -> unit 4 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_info.mli: -------------------------------------------------------------------------------- 1 | open Bap_knowledge 2 | 3 | type t 4 | 5 | val create : ?long:(unit -> string) -> ?desc:string -> 6 | Knowledge.Name.t -> t 7 | 8 | val name : t -> Knowledge.Name.t 9 | val desc : t -> string 10 | val long : t -> string 11 | val pp : Format.formatter -> t -> unit 12 | val normalize_text : string -> string 13 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_lisp_index.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | module type S = sig 4 | type t [@@deriving sexp_of] 5 | val null : t 6 | val next : t -> t 7 | val pp : Format.formatter -> t -> unit 8 | include Comparable.S_plain with type t := t 9 | end 10 | 11 | module Make() : S = struct 12 | let null = Int63.zero 13 | let next = Int63.succ 14 | include Int63 15 | end 16 | 17 | type ('a,'i,'e) interned = { 18 | data : 'a; 19 | id : 'i; 20 | eq : 'e; 21 | } 22 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_lisp_index.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type ('a,'i,'e) interned = { 4 | data : 'a; 5 | id : 'i; 6 | eq : 'e; 7 | } 8 | 9 | module type S = sig 10 | type t [@@deriving sexp_of] 11 | val null : t 12 | val next : t -> t 13 | val pp : Format.formatter -> t -> unit 14 | include Comparable.S_plain with type t := t 15 | end 16 | 17 | module Make() : S 18 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_lisp_loc.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | (* a region in a file *) 4 | type range = Parsexp.Positions.range [@@deriving sexp_of] 5 | 6 | 7 | (* a region in the specified file *) 8 | type loc = { 9 | file : string; 10 | range : range; 11 | } [@@deriving compare, sexp_of] 12 | 13 | type t = loc [@@deriving compare, sexp_of] 14 | 15 | val merge : t -> t -> t 16 | 17 | val nth_char : t -> int -> t 18 | 19 | val pp : Format.formatter -> t -> unit 20 | 21 | include Comparable.S_plain with type t := t 22 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_lisp_parse.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | 3 | module Context = Bap_primus_lisp_context 4 | module Program = Bap_primus_lisp_program 5 | 6 | type error 7 | 8 | val program : ?paths:string list -> Project.t -> string list -> 9 | (Program.t,error) result 10 | 11 | val pp_error : Format.formatter -> error -> unit 12 | val pp_program : Format.formatter -> Program.t -> unit 13 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_lisp_var.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_core_theory 3 | open Bap_primus_lisp_types 4 | 5 | type t = var [@@deriving compare, sexp_of] 6 | include Comparable.S_plain with type t := t 7 | val to_string : t -> string 8 | 9 | 10 | type read_error = Empty | Not_a_var | Bad_type | Bad_format 11 | 12 | val read : ?package:string -> Id.t -> Eq.t -> string -> (t,read_error) result 13 | val reify : width:int -> t -> 'a Theory.Bitv.t Theory.Var.t 14 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_lisp_word.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_primus_lisp_types 3 | 4 | type t = word [@@deriving compare, sexp_of] 5 | type read_error = Empty | Not_an_int | Unclosed | Bad_literal | Bad_type 6 | 7 | val read : Id.t -> Eq.t -> string -> (t,read_error) result 8 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_main.mli: -------------------------------------------------------------------------------- 1 | open Bap_knowledge 2 | open Bap.Std 3 | open Bap_primus_types 4 | 5 | module Main(M : Machine) : sig 6 | val run : 7 | ?envp:string array -> 8 | ?args:string array -> 9 | project -> 10 | unit M.t -> 11 | (exit_status * project) M.m 12 | end 13 | 14 | val add_component : component -> unit 15 | -------------------------------------------------------------------------------- /lib/bap_primus/bap_primus_random.mli: -------------------------------------------------------------------------------- 1 | module Iterator = Bap_primus_iterator 2 | 3 | module MCG : sig 4 | module type S = sig 5 | include Iterator.Infinite.S with type dom = Bitvec.t 6 | val size : int 7 | val create : int -> t 8 | end 9 | 10 | val create : ?min:Bitvec.t -> ?max:Bitvec.t -> int -> (module S) 11 | val create_small : ?min:int -> ?max:int -> int -> (module S) 12 | 13 | module M8 : S 14 | module M16 : S 15 | module M32 : S 16 | module M64 : S 17 | end 18 | -------------------------------------------------------------------------------- /lib/bap_primus/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus) 3 | (public_name bap-primus) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries 7 | bap 8 | bap-abi 9 | bap-c 10 | bap-core-theory 11 | bap-future 12 | bap-knowledge 13 | bap-strings 14 | bitvec 15 | bitvec-binprot 16 | core_kernel 17 | graphlib 18 | monads 19 | parsexp 20 | regular 21 | uuidm 22 | zarith)) -------------------------------------------------------------------------------- /lib/bap_primus_track_visited/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_track_visited) 3 | (public_name bap-primus-track-visited) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap bap-primus core_kernel)) 7 | -------------------------------------------------------------------------------- /lib/bap_recipe/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_recipe) 3 | (public_name bap-recipe) 4 | (wrapped false) 5 | (libraries stdlib-shims base stdio parsexp fileutils camlzip uuidm)) -------------------------------------------------------------------------------- /lib/bap_relation/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_relation) 3 | (public_name bap-relation) 4 | (libraries base)) 5 | -------------------------------------------------------------------------------- /lib/bap_riscv/bap_riscv_target.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory 2 | 3 | 4 | type r64 and r32 and r8 5 | 6 | type 'a bitv = 'a Theory.Bitv.t Theory.Value.sort 7 | 8 | val parent : Theory.Target.t 9 | val riscv32 : Theory.Target.t 10 | val riscv64 : Theory.Target.t 11 | val llvm32 : Theory.Language.t 12 | val llvm64 : Theory.Language.t 13 | -------------------------------------------------------------------------------- /lib/bap_riscv/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_riscv) 3 | (public_name bap-riscv) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap-core-theory bap-knowledge core_kernel )) 7 | -------------------------------------------------------------------------------- /lib/bap_sema/bap_sema_flatten.mli: -------------------------------------------------------------------------------- 1 | open Bap_ir 2 | open Bap_knowledge 3 | 4 | val flatten_sub : sub term -> sub term 5 | val flatten_blk : blk term -> blk term 6 | 7 | module KB : sig 8 | val flatten_sub : sub term -> sub term knowledge 9 | val flatten_blk : blk term -> blk term knowledge 10 | end 11 | -------------------------------------------------------------------------------- /lib/bap_sema/bap_sema_ssa.mli: -------------------------------------------------------------------------------- 1 | open Bap_ir 2 | open Bap_knowledge 3 | 4 | val sub : sub term -> sub term 5 | val is_transformed : sub term -> bool 6 | 7 | module KB : sig 8 | val sub : sub term -> sub term knowledge 9 | end 10 | -------------------------------------------------------------------------------- /lib/bap_sema/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_sema) 3 | (public_name bap-std.sema) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries 7 | bap-core-theory 8 | bap_disasm 9 | bap_image 10 | bap-knowledge 11 | bap_types 12 | core_kernel 13 | graphlib 14 | monads 15 | regular)) -------------------------------------------------------------------------------- /lib/bap_strings/bap_strings.ml: -------------------------------------------------------------------------------- 1 | module Std = struct 2 | module Strings = struct 3 | module Detector = Bap_strings_detector 4 | module Unscrambler = Bap_strings_unscrambler 5 | module Scanner = Bap_strings_scanner 6 | module Index = Bap_strings_index 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/bap_strings/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_strings) 3 | (public_name bap-strings) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries core_kernel)) -------------------------------------------------------------------------------- /lib/bap_systemz/bap_systemz_target.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory 2 | 3 | 4 | type r64 and r32 and r16 and r8 5 | 6 | type 'a bitv = 'a Theory.Bitv.t Theory.Value.sort 7 | 8 | val r64 : r64 bitv 9 | val r32 : r32 bitv 10 | val r16 : r16 bitv 11 | val r8 : r8 bitv 12 | 13 | val mem : (r64, r8) Theory.Mem.t Theory.var 14 | val gpr : r64 Theory.Bitv.t Theory.var list 15 | val fpr : r64 Theory.Bitv.t Theory.var list 16 | 17 | val parent : Theory.Target.t 18 | 19 | val z9 : Theory.Target.t 20 | 21 | val llvm_encoding : Theory.Language.t 22 | -------------------------------------------------------------------------------- /lib/bap_systemz/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_systemz) 3 | (public_name bap-systemz) 4 | (wrapped false) 5 | (libraries bap-core-theory bap-knowledge core_kernel)) 6 | -------------------------------------------------------------------------------- /lib/bap_taint/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_taint) 3 | (public_name bap-taint) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap bap-primus bap-strings core_kernel monads regular)) 7 | -------------------------------------------------------------------------------- /lib/bap_traces/bap_trace_binprot.mli: -------------------------------------------------------------------------------- 1 | 2 | val register: unit -> unit 3 | (** [register ()] - registers protocol, reader and writer 4 | for reading and writing traces with bin_io. *) 5 | -------------------------------------------------------------------------------- /lib/bap_traces/bap_trace_id.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Regular.Std 3 | open Bap.Std 4 | 5 | type t [@@deriving bin_io, compare, sexp] 6 | include module type of Uuidm with type t := t 7 | include Regular.S with type t := t 8 | 9 | val of_string: string -> t 10 | -------------------------------------------------------------------------------- /lib/bap_traces/bap_trace_std.ml: -------------------------------------------------------------------------------- 1 | include Bap_trace_event_types 2 | include Bap_trace_meta_types 3 | module Event = Bap_trace_events 4 | module Meta = Bap_trace_meta 5 | module Trace = Bap_trace 6 | type trace = Trace.t 7 | module Traces = Bap_trace_traces 8 | let () = Bap_trace_binprot.register () 9 | -------------------------------------------------------------------------------- /lib/bap_traces/bap_trace_traces.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | module Trace = Bap_trace 4 | 5 | let traces = Trace.Id.Table.create () 6 | 7 | let add t = Hashtbl.set traces ~key:(Trace.id t) ~data:t 8 | let remove t = Hashtbl.remove traces (Trace.id t) 9 | let to_list () = Hashtbl.data traces 10 | let enum () = to_list () |> Sequence.of_list 11 | -------------------------------------------------------------------------------- /lib/bap_traces/bap_trace_traces.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | val to_list : unit -> Bap_trace.t list 3 | val enum : unit -> Bap_trace.t Sequence.t 4 | val add : Bap_trace.t -> unit 5 | val remove : Bap_trace.t -> unit 6 | -------------------------------------------------------------------------------- /lib/bap_traces/bap_traces.ml: -------------------------------------------------------------------------------- 1 | module Unix = Caml_unix 2 | module Std = Bap_trace_std 3 | module KB = Bap_knowledge.Knowledge 4 | -------------------------------------------------------------------------------- /lib/bap_traces/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_traces) 3 | (public_name bap-traces) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries 7 | bap 8 | bap-core-theory 9 | bap-knowledge 10 | core_kernel 11 | core_kernel.caml_unix 12 | regular 13 | uri 14 | uuidm)) 15 | -------------------------------------------------------------------------------- /lib/bap_types/bap_arch.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_core_theory 3 | open Regular.Std 4 | open Bap_common_types 5 | 6 | val of_string : string -> arch option 7 | 8 | val addr_size : arch -> addr_size 9 | 10 | val endian : arch -> endian 11 | 12 | val slot : (Theory.program, arch) KB.slot 13 | 14 | val unit_slot : (Theory.Unit.cls, arch) KB.slot 15 | 16 | include Regular.S with type t := arch 17 | -------------------------------------------------------------------------------- /lib/bap_types/bap_bil_adt.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_common_types 3 | open Bap_bil 4 | open Format 5 | 6 | val pp_var : formatter -> var -> unit 7 | val pp_exp : formatter -> exp -> unit 8 | val pp_stmt : formatter -> stmt -> unit 9 | -------------------------------------------------------------------------------- /lib/bap_types/bap_bil_optimizations.mli: -------------------------------------------------------------------------------- 1 | open Bap_bil 2 | 3 | val propagate_consts : bil -> bil 4 | 5 | val prune_dead_virtuals : bil -> bil 6 | -------------------------------------------------------------------------------- /lib/bap_types/bap_bil_pass.mli: -------------------------------------------------------------------------------- 1 | open Bap_bil 2 | open Regular.Std 3 | 4 | type pass 5 | 6 | val register_pass : ?desc:string -> string -> (bil -> bil) -> pass 7 | 8 | val passes : unit -> pass list 9 | 10 | val select_passes : pass list -> unit 11 | 12 | val selected_passes : unit -> (bil -> bil) list 13 | 14 | module Pass_pp : sig 15 | val name : pass -> string 16 | include Printable.S with type t := pass 17 | end 18 | -------------------------------------------------------------------------------- /lib/bap_types/bap_bili.mli: -------------------------------------------------------------------------------- 1 | open Monads.Std 2 | open Bap_bil 3 | open Bap_bili_types 4 | 5 | class context : Context.t 6 | module type S = Bili.S 7 | module Make( M : Monad.State.S2) : S with type ('a,'e) state = ('a,'e) M.t 8 | include S with type ('a,'e) state = ('a,'e) Monad.State.t 9 | val eval : stmt list -> (#context as 'a) -> 'a 10 | -------------------------------------------------------------------------------- /lib/bap_types/bap_biri.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Monads.Std 3 | open Bap_result 4 | open Bap_ir 5 | open Bap_biri_types 6 | 7 | class context : ?main : sub term -> program term -> Context.t 8 | module type S = Biri.S 9 | 10 | module Make(M : Monad.State.S2) : S with type ('a,'e) state = ('a,'e) M.t 11 | include S with type ('a,'e) state = ('a,'e) Monad.State.t 12 | -------------------------------------------------------------------------------- /lib/bap_types/bap_context.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_result 3 | open Bap_common_types 4 | open Bap_bil 5 | 6 | type delta = result Bap_var.Map.t 7 | 8 | class t = object 9 | val delta : delta = Bap_var.Map.empty 10 | method lookup = Map.find delta 11 | method update key data = {< delta = Map.set delta ~key ~data >} 12 | method bindings = Map.to_sequence delta 13 | end 14 | -------------------------------------------------------------------------------- /lib/bap_types/bap_context.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_result 3 | open Bap_common_types 4 | open Bap_bil 5 | 6 | class t : object('s) 7 | method lookup : var -> result option 8 | method update : var -> result -> 's 9 | method bindings : (var * result) Sequence.t 10 | end 11 | -------------------------------------------------------------------------------- /lib/bap_types/bap_core_theory_bil_parser.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory 2 | open Bap_bil 3 | 4 | val t : (exp,_,stmt) Theory.Parser.t 5 | -------------------------------------------------------------------------------- /lib/bap_types/bap_eval.mli: -------------------------------------------------------------------------------- 1 | open Monads.Std 2 | open Bap_eval_types 3 | 4 | module type S = Eval.S 5 | module type S2 = Eval.S2 6 | module Make2(M : Monad.S2) : S2 with type ('a,'e) m := ('a,'e) M.t 7 | and module M := M 8 | module Make(M : Monad.S) : S with type 'a m := 'a M.t 9 | and module M := M 10 | -------------------------------------------------------------------------------- /lib/bap_types/bap_expi.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Monads.Std 3 | open Bap_common_types 4 | open Bap_bil 5 | open Bap_result 6 | open Bap_type_error 7 | open Bap_expi_types 8 | 9 | class context : Context.t 10 | 11 | module type S = Expi.S 12 | module Make(M : Monad.State.S2) : S with type ('a,'e) state = ('a,'e) M.t 13 | 14 | include S with type ('a,'e) state = ('a,'e) Monad.State.t 15 | 16 | val eval : exp -> value 17 | -------------------------------------------------------------------------------- /lib/bap_types/bap_int_conversions.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Or_error 3 | 4 | 5 | let to_int conv sexp v = match conv v with 6 | | Some v -> Ok v 7 | | None -> error "doesn't fit into int" v sexp 8 | 9 | 10 | let int_of_int64 = to_int Int64.to_int Int64.sexp_of_t 11 | let int_of_int32 = to_int Int32.to_int Int32.sexp_of_t 12 | let int_of_nativeint = to_int Nativeint.to_int Nativeint.sexp_of_t 13 | let int_of_word = Bap_bitvector.to_int 14 | -------------------------------------------------------------------------------- /lib/bap_types/bap_int_conversions.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | val int_of_int32 : int32 -> int Or_error.t 4 | val int_of_int64 : int64 -> int Or_error.t 5 | val int_of_nativeint : nativeint -> int Or_error.t 6 | val int_of_word : Bap_bitvector.t -> int Or_error.t 7 | -------------------------------------------------------------------------------- /lib/bap_types/bap_integer.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap_integer_intf 3 | 4 | module type Base = Base 5 | module type S = S 6 | 7 | module Make(Base : Base) = struct 8 | include Base 9 | let ( + ) = add 10 | let ( - ) = sub 11 | let ( * ) = mul 12 | let ( / ) = div 13 | let ( ~-) = neg 14 | let (mod) = modulo 15 | let (land) = logand 16 | let (lor) = logor 17 | let (lxor) = logxor 18 | let (lsl) = lshift 19 | let (lsr) = rshift 20 | let (asr) = arshift 21 | end 22 | -------------------------------------------------------------------------------- /lib/bap_types/bap_integer.mli: -------------------------------------------------------------------------------- 1 | open Bap_integer_intf 2 | 3 | module type Base = Base 4 | module type S = S 5 | 6 | (** Derives [S] from [R] *) 7 | module Make(R : Base) : S with type t = R.t 8 | -------------------------------------------------------------------------------- /lib/bap_types/bap_ir_callgraph.mli: -------------------------------------------------------------------------------- 1 | open Graphlib.Std 2 | open Bap_ir 3 | 4 | include Graph with type node = tid 5 | and type Node.label = tid 6 | and type Edge.label = jmp term list 7 | 8 | 9 | val create : program term -> t 10 | val pp : Format.formatter -> t -> unit 11 | -------------------------------------------------------------------------------- /lib/bap_types/bap_monad_types.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | module type State = sig 4 | type ('a,'s) t 5 | type 'a result 6 | 7 | include Monad.S2 with type ('a,'s) t := ('a,'s) t 8 | 9 | val put : 's -> (unit,'s) t 10 | val get : unit -> ('s,'s) t 11 | val gets : ('s -> 'r) -> ('r,'s) t 12 | val update : ('s -> 's) -> (unit,'s) t 13 | val modify : ('a,'s) t -> ('s -> 's) -> ('a,'s) t 14 | 15 | 16 | val run : ('a,'s) t -> 's -> ('a * 's) result 17 | val eval : ('a,'s) t -> 's -> 'a result 18 | val exec : ('a,'s) t -> 's -> 's result 19 | end 20 | -------------------------------------------------------------------------------- /lib/bap_types/bap_ogre.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory 2 | open Core_kernel[@@warning "-D"] 3 | 4 | type t = Ogre.doc [@@deriving bin_io, compare, sexp] 5 | val pp : Format.formatter -> t -> unit 6 | val slot : (Theory.Unit.cls, t) KB.slot 7 | -------------------------------------------------------------------------------- /lib/bap_types/bap_tid_graph.mli: -------------------------------------------------------------------------------- 1 | open Graphlib.Std 2 | open Bap_ir 3 | 4 | include Graph with type node = tid 5 | and type Node.label = tid 6 | and type Edge.label = tid 7 | 8 | val start : node 9 | val exit : node 10 | val create : sub term -> t 11 | -------------------------------------------------------------------------------- /lib/bap_types/bap_type.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Regular.Std 3 | open Bap_common_types 4 | 5 | module Export : sig 6 | val bool_t : typ 7 | val reg8_t : typ 8 | val reg16_t : typ 9 | val reg32_t : typ 10 | val reg64_t : typ 11 | val reg128_t: typ 12 | val reg256_t: typ 13 | val mem32_t : size -> typ 14 | val mem64_t : size -> typ 15 | end 16 | 17 | include Regular.S with type t := typ 18 | -------------------------------------------------------------------------------- /lib/bap_types/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_types) 3 | (public_name bap-std.types) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries 7 | bap-core-theory 8 | bap-knowledge 9 | bap-main 10 | bitvec 11 | bitvec-order 12 | bitvec-sexp 13 | core_kernel 14 | graphlib 15 | monads 16 | ogre 17 | regular 18 | uuidm 19 | zarith)) -------------------------------------------------------------------------------- /lib/bare/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bare) 3 | (public_name bare) 4 | (wrapped false) 5 | (libraries core_kernel parsexp)) 6 | -------------------------------------------------------------------------------- /lib/beagle/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_beagle_prey) 3 | (public_name bap-beagle) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap bap-primus core_kernel monads regular)) 7 | -------------------------------------------------------------------------------- /lib/bitvec/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bitvec) 3 | (public_name bitvec) 4 | (wrapped false) 5 | (libraries zarith)) -------------------------------------------------------------------------------- /lib/bitvec_binprot/bitvec_binprot.ml: -------------------------------------------------------------------------------- 1 | open Bin_prot.Std 2 | type t = Bitvec.t 3 | module Functions = Bin_prot.Utils.Make_binable(struct 4 | module Binable = struct 5 | type t = string [@@deriving bin_io] 6 | end 7 | type t = Bitvec.t 8 | let to_binable = Bitvec.to_binary 9 | let of_binable = Bitvec.of_binary 10 | end) [@@warning "-D"] 11 | include Functions 12 | -------------------------------------------------------------------------------- /lib/bitvec_binprot/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bitvec_binprot) 3 | (public_name bitvec-binprot) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries bitvec bin_prot)) -------------------------------------------------------------------------------- /lib/bitvec_order/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bitvec_order) 3 | (public_name bitvec-order) 4 | (wrapped false) 5 | (libraries base bitvec bitvec-sexp)) -------------------------------------------------------------------------------- /lib/bitvec_sexp/bitvec_sexp.ml: -------------------------------------------------------------------------------- 1 | open Sexplib0 2 | 3 | type t = Bitvec.t 4 | 5 | module Functions = struct 6 | let sexp_of_t x = Sexp.Atom (Bitvec.to_string x) 7 | let t_of_sexp = function 8 | | Sexp.Atom x -> Bitvec.of_string x 9 | | _ -> invalid_arg "Bitvec_sexp: expects an atom, got list" 10 | end 11 | 12 | include Functions 13 | -------------------------------------------------------------------------------- /lib/bitvec_sexp/bitvec_sexp.mli: -------------------------------------------------------------------------------- 1 | open Sexplib0 2 | 3 | type t = Bitvec.t 4 | 5 | val sexp_of_t : t -> Sexp.t 6 | val t_of_sexp : Sexp.t -> t 7 | 8 | module Functions : sig 9 | val sexp_of_t : t -> Sexp.t 10 | val t_of_sexp : Sexp.t -> t 11 | end 12 | -------------------------------------------------------------------------------- /lib/bitvec_sexp/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bitvec_sexp) 3 | (public_name bitvec-sexp) 4 | (wrapped false) 5 | (libraries bitvec sexplib0)) -------------------------------------------------------------------------------- /lib/common/bap_common.ml: -------------------------------------------------------------------------------- 1 | 2 | module Plugins = Bap_common_private_sites.Plugins.Plugins 3 | 4 | open Bap_common_private_sites.Sites 5 | let sites = function 6 | | "api" -> api 7 | | "lisp" -> lisp 8 | | "plugins" -> plugins 9 | | "primus" -> primus 10 | | "semantics" -> semantics 11 | | "signatures" -> signatures 12 | | "site-lisp" | "site_lisp" -> site_lisp 13 | | unknown -> 14 | failwith ("Invalid site: " ^ unknown) 15 | -------------------------------------------------------------------------------- /lib/common/bap_common.mli: -------------------------------------------------------------------------------- 1 | 2 | 3 | val sites : string -> string list 4 | 5 | module Plugins : sig 6 | val paths : string list 7 | val list : unit -> string list 8 | val load_all : unit -> unit 9 | val load : string -> unit 10 | end 11 | -------------------------------------------------------------------------------- /lib/common/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_common) 3 | (public_name bap-common) 4 | (wrapped false) 5 | (libraries dune-site dune-site.plugins)) 6 | 7 | (generate_sites_module 8 | (module bap_common_private_sites) 9 | (sites bap-common) 10 | (plugins (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /lib/graphlib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name graphlib) 3 | (public_name graphlib) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (private_modules graphlib_graph 7 | graphlib_intf 8 | graphlib_regular 9 | graphlib_regular_intf 10 | graphlib_pp) 11 | (libraries core_kernel core_kernel.pairing_heap 12 | regular ocamlgraph)) 13 | -------------------------------------------------------------------------------- /lib/knowledge/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name knowledge) 3 | (public_name bap-knowledge) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries core_kernel core_kernel.caml_unix monads)) -------------------------------------------------------------------------------- /lib/microx/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_microx) 3 | (public_name bap-microx) 4 | (preprocess (pps ppx_bap)) 5 | (wrapped false) 6 | (libraries bap monads core_kernel)) 7 | -------------------------------------------------------------------------------- /lib/monads/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name monads) 3 | (public_name monads) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries core_kernel core_kernel.rope) 7 | (private_modules monads_monad monads_monoid monads_types)) 8 | -------------------------------------------------------------------------------- /lib/monads/monads.ml: -------------------------------------------------------------------------------- 1 | module Std = struct 2 | module Monoid = Monads_monoid 3 | module Monad = Monads_monad 4 | end 5 | -------------------------------------------------------------------------------- /lib/ogre/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name ogre) 3 | (public_name ogre) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries core_kernel monads)) -------------------------------------------------------------------------------- /lib/regular/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name regular) 3 | (public_name regular) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (private_modules 7 | regular_bytes 8 | regular_cache 9 | regular_data 10 | regular_data_intf 11 | regular_data_types 12 | regular_data_write 13 | regular_data_read 14 | regular_opaque 15 | regular_seq) 16 | (libraries core_kernel)) 17 | -------------------------------------------------------------------------------- /lib/text_tags/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name text_tags) 3 | (public_name text-tags) 4 | (wrapped false) 5 | (libraries core_kernel core_kernel.caml_unix)) 6 | -------------------------------------------------------------------------------- /lib/x86_cpu/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_x86) 3 | (public_name bap-x86) 4 | (wrapped false) 5 | (preprocess (pps ppx_bap)) 6 | (libraries bap bap-c bap-demangle core_kernel)) 7 | 8 | (deprecated_library_name 9 | (old_public_name bap-x86-cpu) 10 | (new_public_name bap-x86)) 11 | -------------------------------------------------------------------------------- /lib/x86_cpu/x86_asm.ml: -------------------------------------------------------------------------------- 1 | 2 | module Reg = X86_asm_reg 3 | 4 | type reg = [Reg.gpr | Reg.segment_base | Reg.segment] [@@deriving sexp_poly] 5 | -------------------------------------------------------------------------------- /lib/x86_cpu/x86_asm_reg.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | include module type of X86_asm_reg_types 5 | 6 | (** [width reg_type] returns the size of the given [reg_type] *) 7 | val width : [gpr | ip] -> size 8 | 9 | (** [bitwidth reg_type] returns the width in bits of the 10 | given [reg_type] *) 11 | val bitwidth : [gpr | ip] -> int 12 | 13 | (** [decode reg] decodes the given [reg] provided by the 14 | disassembler as an x86 register if that is feasible. *) 15 | val decode : reg -> t option 16 | -------------------------------------------------------------------------------- /lib/x86_cpu/x86_llvm_env.mli: -------------------------------------------------------------------------------- 1 | (** This module exposes register functionality that is based on 2 | LLVM's disassembler. This module is only useful if you are 3 | disassembling X86 using an LLVM backend. *) 4 | 5 | open Bap.Std 6 | 7 | (** [base_var mode reg] given a [reg] operand provided by the LLVM 8 | disassembler, [base_var] returns the variable corresponding to 9 | the physical register for that [mode] if it exists. If no such 10 | register exists for our backend, None is returned. 11 | *) 12 | val base_var : X86_types.mode -> reg -> Var.t option -------------------------------------------------------------------------------- /lib_test/bap/dune: -------------------------------------------------------------------------------- 1 | (test 2 | (name run_tests) 3 | (package bap) 4 | (libraries bap bap-plugins ounit2 threads 5 | test_types 6 | test_image 7 | test_disasm 8 | test_sema 9 | test_project)) 10 | -------------------------------------------------------------------------------- /lib_test/bap/run_tests.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/lib_test/bap/run_tests.mli -------------------------------------------------------------------------------- /lib_test/bap_disasm/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name test_disasm) 3 | (preprocess (pps ppx_bap)) 4 | (wrapped false) 5 | (libraries bap core_kernel ounit2 str)) 6 | -------------------------------------------------------------------------------- /lib_test/bap_disasm/test_disasm.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_dwarf/test_leb128.mli: -------------------------------------------------------------------------------- 1 | (** this is a unit test for test_leb128 *) 2 | 3 | val suite : OUnit2.test 4 | -------------------------------------------------------------------------------- /lib_test/bap_future/run_future_tests.ml: -------------------------------------------------------------------------------- 1 | open OUnit2 2 | 3 | let () = 4 | run_test_tt_main Test_future.suite 5 | -------------------------------------------------------------------------------- /lib_test/bap_future/test_future.mli: -------------------------------------------------------------------------------- 1 | 2 | 3 | val suite : OUnit2.test 4 | -------------------------------------------------------------------------------- /lib_test/bap_future/test_future_std.ml: -------------------------------------------------------------------------------- 1 | open OUnit2 2 | 3 | let suite = 4 | "Future test" >::: 5 | [ 6 | Test_future.suite; 7 | Test_stream.suite; 8 | ] 9 | -------------------------------------------------------------------------------- /lib_test/bap_future/test_future_std.mli: -------------------------------------------------------------------------------- 1 | 2 | val suite : OUnit2.test 3 | -------------------------------------------------------------------------------- /lib_test/bap_future/test_stream.mli: -------------------------------------------------------------------------------- 1 | 2 | 3 | val suite : OUnit2.test 4 | -------------------------------------------------------------------------------- /lib_test/bap_image/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name test_image) 3 | (preprocess (pps ppx_bap)) 4 | (wrapped false) 5 | (libraries bap core_kernel ounit2)) 6 | -------------------------------------------------------------------------------- /lib_test/bap_image/test_image.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_image/test_memmap.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_image/test_table.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_project/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name test_project) 3 | (preprocess (pps ppx_bap)) 4 | (wrapped false) 5 | (libraries bap core_kernel ounit2)) 6 | -------------------------------------------------------------------------------- /lib_test/bap_project/test_project.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_sema/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name test_sema) 3 | (preprocess (pps ppx_bap)) 4 | (wrapped false) 5 | (libraries bap core_kernel ounit2)) 6 | -------------------------------------------------------------------------------- /lib_test/bap_sema/test_ir.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_traces/run_traces_tests.ml: -------------------------------------------------------------------------------- 1 | open OUnit2 2 | 3 | let () = 4 | run_test_tt_main (Test_traces.suite ()) 5 | -------------------------------------------------------------------------------- /lib_test/bap_traces/test_traces.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_types/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name test_types) 3 | (preprocess (pps ppx_bap)) 4 | (wrapped false) 5 | (libraries bap core_kernel ounit2)) 6 | -------------------------------------------------------------------------------- /lib_test/bap_types/test_bili.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_types/test_bitvector.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_types/test_bytes.mli: -------------------------------------------------------------------------------- 1 | 2 | val suite : OUnit2.test 3 | -------------------------------------------------------------------------------- /lib_test/bap_types/test_graph.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_types/test_optimizations.mli: -------------------------------------------------------------------------------- 1 | val suite : unit -> OUnit2.test 2 | -------------------------------------------------------------------------------- /lib_test/bap_types/test_trie.mli: -------------------------------------------------------------------------------- 1 | open OUnit2 2 | val suite : unit -> test 3 | -------------------------------------------------------------------------------- /lib_test/powerpc/dune: -------------------------------------------------------------------------------- 1 | (test 2 | (name run_powerpc_tests) 3 | (package bap) 4 | (libraries bap bap-plugins ounit2 threads)) 5 | -------------------------------------------------------------------------------- /lib_test/stub_resolver/dune: -------------------------------------------------------------------------------- 1 | (test 2 | (name run_stub_resolver_tests) 3 | (package bap-stub-resolver) 4 | (libraries bap bap-main bap-core-theory bap-stub-resolver.plugin ounit2 threads)) 5 | -------------------------------------------------------------------------------- /lib_test/stub_resolver/run_stub_resolver_tests.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open OUnit2 3 | 4 | let suite = "Stub_resolver" >::: [ 5 | Stub_resolver_tests.suite; 6 | ] 7 | 8 | let () = 9 | match Bap_main.init () with 10 | | Error err -> 11 | Format.eprintf "Failed to initialize BAP: %a@\n%!" 12 | Bap_main.Extension.Error.pp err; 13 | exit 1; 14 | | Ok () -> 15 | run_test_tt_main suite 16 | -------------------------------------------------------------------------------- /lib_test/x86/dune: -------------------------------------------------------------------------------- 1 | (test 2 | (name run_x86_tests) 3 | (package bap) 4 | (libraries bap bap-x86 bap-plugins ounit2 threads)) 5 | -------------------------------------------------------------------------------- /lib_test/x86/run_x86_tests.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open OUnit2 3 | open Bap_plugins.Std 4 | 5 | let suite = "X86" >::: [ 6 | Test_pshufb.suite; 7 | Test_pcmp.suite; 8 | ] 9 | 10 | 11 | let () = 12 | match Bap_main.init () with 13 | | Error err -> 14 | Format.eprintf "Failed to initialize BAP: %a@\n%!" 15 | Bap_main.Extension.Error.pp err; 16 | exit 1; 17 | | Ok () -> 18 | run_test_tt_main suite 19 | -------------------------------------------------------------------------------- /oasis/analyze: -------------------------------------------------------------------------------- 1 | Flag analyze 2 | Description: Build the KB analyze command 3 | Default: false 4 | 5 | Library analyze_plugin 6 | Build$: flag(everything) || flag(analyze) 7 | Path: plugins/analyze 8 | FindlibName: bap-plugin-analyze 9 | CompiledObject: best 10 | BuildDepends: core_kernel, monads, ppx_bap, linenoise, 11 | bap-knowledge, bap-core-theory, bap-main, bap, 12 | bitvec 13 | InternalModules: Analyze_main, Analyze_core_commands 14 | XMETADescription: implements the analyze command 15 | -------------------------------------------------------------------------------- /oasis/api.files.ab.in: -------------------------------------------------------------------------------- 1 | , plugins/api/api_sites.ml.ab -------------------------------------------------------------------------------- /oasis/api.setup.ml.in: -------------------------------------------------------------------------------- 1 | let () = 2 | add_variable ~doc:"additional sites for api files" 3 | "site_api" 4 | ~define:(function 5 | | None -> "" 6 | | Some xs -> xs) 7 | -------------------------------------------------------------------------------- /oasis/bare: -------------------------------------------------------------------------------- 1 | Flag bare 2 | Description: Build the BARE library 3 | Default: false 4 | 5 | Library bare 6 | Build$: flag(everything) || flag(bare) 7 | Path: lib/bare 8 | FindlibName: bare 9 | CompiledObject: best 10 | BuildDepends: core_kernel, parsexp 11 | Modules: Bare 12 | -------------------------------------------------------------------------------- /oasis/bil: -------------------------------------------------------------------------------- 1 | Flag bil 2 | Description: Build bil plugin 3 | Default: false 4 | 5 | Library bil_plugin 6 | XMETADescription: Provides bil optimizations 7 | Path: plugins/bil 8 | Build$: flag(everything) || flag(bil) 9 | FindlibName: bap-plugin-bil 10 | BuildDepends: bap, bap-core-theory, bap-knowledge, core_kernel, 11 | ppx_bap, bap-future, monads, bitvec, bitvec-order, ogre, bap-main 12 | XMETAExtraLines: tags="bil,analysis,semantics" 13 | InternalModules: Bil_main, Bil_lifter, Bil_semantics, Bil_ir, Bil_float 14 | -------------------------------------------------------------------------------- /oasis/bitvec: -------------------------------------------------------------------------------- 1 | Flag bitvec 2 | Description: Build the bitvec library 3 | Default: false 4 | 5 | Library bitvec 6 | Build$: flag(everything) || flag(bitvec) 7 | Path: lib/bitvec 8 | FindlibName: bitvec 9 | CompiledObject: best 10 | BuildDepends: zarith 11 | Modules: Bitvec 12 | -------------------------------------------------------------------------------- /oasis/bitvec-binprot: -------------------------------------------------------------------------------- 1 | Flag bitvec_binprot 2 | Description: Enables support for Core's Binprot protocol 3 | Default: false 4 | 5 | Library bitvec_binprot 6 | Build$: flag(everything) || flag(bitvec_binprot) 7 | Path: lib/bitvec_binprot 8 | FindlibName: bitvec-binprot 9 | CompiledObject: best 10 | BuildDepends: bitvec, bin_prot, ppx_bap 11 | Modules: Bitvec_binprot 12 | -------------------------------------------------------------------------------- /oasis/bitvec-order: -------------------------------------------------------------------------------- 1 | Flag bitvec_order 2 | Description: Provides comparators for use with JS Core 3 | Default: false 4 | 5 | Library bitvec_order 6 | Build$: flag(everything) || flag(bitvec_order) 7 | Path: lib/bitvec_order 8 | FindlibName: bitvec-order 9 | CompiledObject: best 10 | BuildDepends: base, bitvec, bitvec-sexp 11 | Modules: Bitvec_order 12 | -------------------------------------------------------------------------------- /oasis/bitvec-sexp: -------------------------------------------------------------------------------- 1 | Flag bitvec_sexp 2 | Description: Provides sexp converters for bitvectors 3 | Default: false 4 | 5 | Library bitvec_sexp 6 | Build$: flag(everything) || flag(bitvec_sexp) 7 | Path: lib/bitvec_sexp 8 | FindlibName: bitvec-sexp 9 | CompiledObject: best 10 | BuildDepends: bitvec, sexplib0 11 | Modules: Bitvec_sexp 12 | -------------------------------------------------------------------------------- /oasis/bundle.files.ab.in: -------------------------------------------------------------------------------- 1 | , lib/bap_bundle/bap_bundle_config.ml.ab 2 | -------------------------------------------------------------------------------- /oasis/byteweight-frontend: -------------------------------------------------------------------------------- 1 | 2 | Flag byteweight_frontend 3 | Description: Build bap-byteweight toolkit 4 | Default: false 5 | 6 | Executable "bap-byteweight" 7 | Path: src 8 | MainIs: bap_byteweight_main.ml 9 | Build$: flag(everything) || flag(byteweight_frontend) 10 | Install: true 11 | CompiledObject: best 12 | BuildDepends: bap, bap-byteweight, 13 | cmdliner, curl, fileutils, re.posix, findlib.dynload, ppx_bap 14 | -------------------------------------------------------------------------------- /oasis/cache: -------------------------------------------------------------------------------- 1 | Flag cache 2 | Description: Build cache plugin 3 | Default: false 4 | 5 | Library cache_plugin 6 | Build$: flag(everything) || flag(cache) 7 | Path: plugins/cache 8 | FindlibName: bap-plugin-cache 9 | BuildDepends: bap, bap-main, regular, ppx_bap, mmap, fileutils, uuidm, 10 | core_kernel, core_kernel.caml_unix 11 | InternalModules: Bap_cache, Bap_cache_gc, Bap_cache_main, Bap_cache_types, Bap_cache_utils 12 | XMETADescription: provide caching services 13 | XMETAExtraLines: tags="cache" -------------------------------------------------------------------------------- /oasis/callsites: -------------------------------------------------------------------------------- 1 | Flag callsites 2 | Description: Build callsites plugin 3 | Default: false 4 | 5 | Library callsites_plugin 6 | Build$: flag(everything) || flag(callsites) 7 | Path: plugins/callsites 8 | FindlibName: bap-plugin-callsites 9 | CompiledObject: best 10 | BuildDepends: bap, core_kernel 11 | Modules: Callsites_main 12 | XMETADescription: annotate callsites with subroutine's arguments 13 | XMETAExtraLines: tags="pass" -------------------------------------------------------------------------------- /oasis/common.files.ab.in: -------------------------------------------------------------------------------- 1 | FilesAB: tools/bap_config.ab 2 | , tools/postinstall.ml.ab 3 | -------------------------------------------------------------------------------- /oasis/common.ocamlbuild.ml.in: -------------------------------------------------------------------------------- 1 | (* OASIS_START *) 2 | (* OASIS_STOP *) 3 | 4 | let oasis_env = 5 | BaseEnvLight.load 6 | ~allow_empty:true 7 | () 8 | let expand s = BaseEnvLight.var_expand s oasis_env 9 | 10 | type rule = unit -> unit 11 | 12 | module Rules : sig 13 | val add : rule -> unit 14 | val dispatch : hook -> unit 15 | end = struct 16 | let rules : (unit -> unit) list ref = ref [] 17 | let add rule = rules := rule :: !rules 18 | let dispatch = function 19 | | Before_rules -> !rules |> List.iter (fun rule -> rule ()) 20 | | _ -> () 21 | end 22 | -------------------------------------------------------------------------------- /oasis/common.omake: -------------------------------------------------------------------------------- 1 | OASISFormat: 0.4 2 | Name: bap 3 | Version: 2.6.0-alpha 4 | OCamlVersion: >= 4.08.0 5 | Synopsis: BAP Core Library 6 | Authors: BAP Team 7 | Maintainers: Ivan Gotovchits 8 | License: MIT 9 | Copyrights: (C) 2014-2022 Carnegie Mellon University 10 | Plugins: META (0.4) 11 | AlphaFeatures: compiled_setup_ml 12 | BuildTools+: omake 13 | BuildType: OMake (0.4) 14 | InstallType: OMake (0.4) 15 | 16 | Flag everything 17 | Description: Build every feature by default 18 | Default: false 19 | -------------------------------------------------------------------------------- /oasis/common.tags.in: -------------------------------------------------------------------------------- 1 | # OASIS_START 2 | # OASIS_STOP 3 | true: debug 4 | true: warn(+a-4-6-7-9-27-29-32..42-44-45-48-50-60) 5 | : predicate(ppx_driver) 6 | : pp(ppx-bap -dump-ast -inline-test-lib bap) -------------------------------------------------------------------------------- /oasis/cxxfilt: -------------------------------------------------------------------------------- 1 | Flag cxxfilt 2 | Description: Build c++filt wrapper 3 | Default: false 4 | 5 | Library "cxxfilt_plugin" 6 | Path: plugins/cxxfilt 7 | Build$: flag(everything) || flag(cxxfilt) 8 | FindlibName: bap-plugin-cxxfilt 9 | CompiledObject: best 10 | BuildDepends: core_kernel, bap-demangle, bap, core_kernel.caml_unix 11 | InternalModules: Cxxfilt_main, Cxxfilt_config 12 | XMETADescription: provide c++filt based demangler 13 | XMETAExtraLines: tags="c++, c++filt, demangler" 14 | -------------------------------------------------------------------------------- /oasis/cxxfilt.files.ab.in: -------------------------------------------------------------------------------- 1 | , plugins/cxxfilt/cxxfilt_config.ml.ab -------------------------------------------------------------------------------- /oasis/cxxfilt.setup.ml.in: -------------------------------------------------------------------------------- 1 | 2 | let () = 3 | add_variable ~doc: 4 | "A list (OCaml syntax) of paths to all discovered c++filts" "cxxfilt_paths" 5 | ~define:(function 6 | | None -> "[]" 7 | | Some xs -> xs) 8 | -------------------------------------------------------------------------------- /oasis/dependencies: -------------------------------------------------------------------------------- 1 | Flag dependencies 2 | Description: Enable the dependencies command 3 | Default: false 4 | 5 | Library dependencies_plugin 6 | Build$: flag(everything) || flag(dependencies) 7 | XMETADescription: analyses the binary dependencies 8 | Path: plugins/dependencies 9 | FindlibName: bap-plugin-dependencies 10 | CompiledObject: best 11 | BuildDepends: bap, core_kernel, bap-main, ogre, regular, ppx_bap 12 | InternalModules: Dependencies_main 13 | XMETAExtraLines: tags="command, dependencies" 14 | -------------------------------------------------------------------------------- /oasis/dump-symbols: -------------------------------------------------------------------------------- 1 | Flag dump_symbols 2 | Description: Build dump-symbols plugin 3 | Default: false 4 | 5 | Library dump_symbols_plugin 6 | Build$: flag(everything) || flag(dump_symbols) 7 | Path: plugins/dump_symbols 8 | FindlibName: bap-plugin-dump_symbols 9 | CompiledObject: best 10 | BuildDepends: bap, core_kernel, ppx_bap, graphlib, regular 11 | InternalModules: Dump_symbols_main 12 | XMETADescription: dump symbol information as a list of blocks 13 | XMETAExtraLines: tags="printer" -------------------------------------------------------------------------------- /oasis/elementary: -------------------------------------------------------------------------------- 1 | Flag elementary 2 | Description: Build the bap-elementary library 3 | Default: false 4 | 5 | Library bap_elementary 6 | Build$: flag(everything) || flag(elementary) 7 | Path: lib/bap_elementary 8 | FindlibName: bap-elementary 9 | CompiledObject: best 10 | BuildDepends: bap, bap-knowledge, bap-core-theory, core_kernel, bitvec 11 | Modules: Bap_elementary 12 | -------------------------------------------------------------------------------- /oasis/emit-ida-script: -------------------------------------------------------------------------------- 1 | Flag emit_ida_script 2 | Description: Build IDA plugin 3 | Default: false 4 | 5 | Library emit_ida_script_plugin 6 | Build$: flag(everything) || flag(emit_ida_script) 7 | Path: plugins/emit_ida_script 8 | FindlibName: bap-plugin-emit_ida_script 9 | BuildDepends: bap, core_kernel, ppx_bap, regular 10 | Modules: Emit_ida_script_main 11 | XMETADescription: extract a IDA python script from bap 12 | XMETAExtraLines: tags="ida, python" -------------------------------------------------------------------------------- /oasis/flatten: -------------------------------------------------------------------------------- 1 | Flag flatten 2 | Description: Build the flatten plugin 3 | Default: false 4 | 5 | Library flatten_plugin 6 | Build$: flag(everything) || flag(flatten) 7 | XMETADescription: flattens (unrolls) BIR expressions into a trivial form 8 | Path: plugins/flatten 9 | FindlibName: bap-plugin-flatten 10 | CompiledObject: best 11 | BuildDepends: bap, core_kernel 12 | InternalModules: Flatten_main 13 | XMETAExtraLines: tags="pass,analysis,flatten,tac,3ac,unroll" 14 | -------------------------------------------------------------------------------- /oasis/frontc-parser: -------------------------------------------------------------------------------- 1 | Flag frontc_parser 2 | Description: Build FrontC based C parser 3 | Default: false 4 | 5 | Library frontc_parser_plugin 6 | Build$: flag(everything) || flag(frontc_parser) 7 | XMETADescription: parse c files with FrontC 8 | Path: plugins/frontc_parser 9 | FindlibName: bap-plugin-frontc_parser 10 | CompiledObject: best 11 | BuildDepends: bap, bap-c, FrontC, core_kernel, ppx_bap, core_kernel.caml_unix 12 | InternalModules: Frontc_parser_main 13 | XMETAExtraLines: tags="api,c,parser" 14 | -------------------------------------------------------------------------------- /oasis/frontend: -------------------------------------------------------------------------------- 1 | Flag frontend 2 | Description: Build the bap command line utility 3 | Default: false 4 | 5 | Executable "bap" 6 | Path: src 7 | MainIs: bap_frontend.ml 8 | Build$: flag(everything) || flag(frontend) 9 | NativeOpt: -thread 10 | CompiledObject: best 11 | BuildDepends: bap-main, bap, bap-core-theory, bap-knowledge, 12 | core_kernel, ppx_bap, findlib.dynload, regular 13 | -------------------------------------------------------------------------------- /oasis/ida.files.ab.in: -------------------------------------------------------------------------------- 1 | , plugins/ida/bap_ida_config.ml.ab 2 | -------------------------------------------------------------------------------- /oasis/ida.setup.ml.in: -------------------------------------------------------------------------------- 1 | 2 | let define_headless = function 3 | | Some "true" when BaseEnv.var_get "system" <> "linux" -> 4 | invalid_arg "headless mode is supported only on linux" 5 | | None -> "false" 6 | | Some ("true"|"1"|"yes") -> "true" 7 | | Some _ -> "false" 8 | 9 | let () = 10 | add_variable ~doc:"A directory with IDA Pro" "ida_path"; 11 | add_variable ~define:define_headless 12 | ~doc:"Run IDA in a headless mode" "ida_headless" 13 | -------------------------------------------------------------------------------- /oasis/knowledge: -------------------------------------------------------------------------------- 1 | Flag knowledge 2 | Description: Build the knowledge library 3 | Default: false 4 | 5 | Library knowledge 6 | Build$: flag(everything) || flag(knowledge) 7 | Path: lib/knowledge 8 | FindlibName: bap-knowledge 9 | CompiledObject: best 10 | BuildDepends: core_kernel, core_kernel.caml_unix, monads, ppx_bap 11 | Modules: Bap_knowledge 12 | -------------------------------------------------------------------------------- /oasis/language: -------------------------------------------------------------------------------- 1 | Flag language 2 | Description: Build language support library 3 | Default: false 4 | -------------------------------------------------------------------------------- /oasis/llvm.files.ab.in: -------------------------------------------------------------------------------- 1 | , lib/bap_llvm/bap_llvm_config.ml.ab -------------------------------------------------------------------------------- /oasis/llvm.ocamlbuild.ml.in: -------------------------------------------------------------------------------- 1 | let () = 2 | flag ["c++"; "compile"; "use_libllvm"] (Sh (expand "${llvm_cxxflags}")) 3 | -------------------------------------------------------------------------------- /oasis/llvm.tags.in: -------------------------------------------------------------------------------- 1 | : use_libllvm -------------------------------------------------------------------------------- /oasis/main: -------------------------------------------------------------------------------- 1 | Flag main 2 | Description: Build BAP Main Framework Configuration Library 3 | Default: false 4 | 5 | Library bap_main 6 | Path: lib/bap_main 7 | Build$: flag(everything) || flag(main) 8 | FindLibName: bap-main 9 | CompiledObject: best 10 | BuildDepends: stdlib-shims, base, stdio, cmdliner, bap-future, 11 | bap-bundle, bap-plugins, bap-recipe, core_kernel, 12 | fileutils, core_kernel.caml_unix 13 | Modules: Bap_main, Bap_main_config, Bap_main_event 14 | InternalModules: Bap_main_log 15 | -------------------------------------------------------------------------------- /oasis/main.files.ab.in: -------------------------------------------------------------------------------- 1 | , lib/bap_main/bap_main_config.ml.ab 2 | -------------------------------------------------------------------------------- /oasis/main.setup.ml.in: -------------------------------------------------------------------------------- 1 | 2 | let () = 3 | add_variable "build_id" 4 | ~doc:"Adds a build id to bap version" 5 | ~define:(function 6 | | Some x -> x 7 | | None -> 8 | try 9 | if Sys.file_exists ".git" && Sys.is_directory ".git" then 10 | OASISExec.run_read_one_line ~ctxt 11 | ~f_exit_code:ignore 12 | "git" ["rev-parse"; "--verify"; "--quiet"; "--short=7"; "HEAD"; ] 13 | else "" 14 | with _ -> "") 15 | -------------------------------------------------------------------------------- /oasis/microx: -------------------------------------------------------------------------------- 1 | Flag microx 2 | Description: Build microx library 3 | Default: false 4 | 5 | Library microx 6 | Build$: flag(everything) || flag(microx) 7 | Path: lib/microx 8 | FindlibName: bap-microx 9 | BuildDepends: bap, monads, core_kernel, ppx_bap 10 | Modules: Microx, Microx_concretizer, Microx_conqueror 11 | -------------------------------------------------------------------------------- /oasis/monads: -------------------------------------------------------------------------------- 1 | Flag monads 2 | Description: Build monad library 3 | Default: false 4 | 5 | Library monads 6 | Build$: flag(everything) || flag(monads) 7 | Path: lib/monads 8 | FindlibName: monads 9 | CompiledObject: best 10 | BuildDepends: core_kernel, ppx_bap, core_kernel.rope 11 | Modules: Monads 12 | InternalModules: Monads_monad, 13 | Monads_monoid, 14 | Monads_types 15 | -------------------------------------------------------------------------------- /oasis/objdump.files.ab.in: -------------------------------------------------------------------------------- 1 | , plugins/objdump/objdump_config.ml.ab -------------------------------------------------------------------------------- /oasis/objdump.setup.ml.in: -------------------------------------------------------------------------------- 1 | let () = 2 | add_variable ~doc:"A list (OCaml syntax) of paths to all discovered objdumps" "objdump_paths" 3 | ~define:(function 4 | | None -> "[\"objdump\"]" 5 | | Some xs -> xs) 6 | -------------------------------------------------------------------------------- /oasis/ogre: -------------------------------------------------------------------------------- 1 | ######## Ogre library ##### 2 | 3 | Flag ogre 4 | Description: Build ogre library 5 | Default: false 6 | 7 | Library ogre 8 | Build$: flag(everything) || flag(ogre) 9 | Path: lib/ogre 10 | FindlibName: ogre 11 | Modules: Ogre 12 | BuildDepends: core_kernel, monads, ppx_bap 13 | -------------------------------------------------------------------------------- /oasis/optimization: -------------------------------------------------------------------------------- 1 | Flag optimization 2 | Description: Build the optimization plugin 3 | Default: false 4 | 5 | Library optimization_plugin 6 | Build$: flag(everything) || flag(optimization) 7 | XMETADescription: automatically removes dead code and propagates consts 8 | Path: plugins/optimization 9 | FindlibName: bap-plugin-optimization 10 | CompiledObject: best 11 | BuildDepends: bap, core_kernel, graphlib, ppx_bap, regular 12 | InternalModules: Optimization_main, Optimization_data 13 | XMETAExtraLines: tags="pass,analysis,optimization" 14 | -------------------------------------------------------------------------------- /oasis/plugins.files.ab.in: -------------------------------------------------------------------------------- 1 | , lib/bap_plugins/bap_plugins_config.ml.ab 2 | , lib/bap_plugins/bap_common.ml.ab 3 | -------------------------------------------------------------------------------- /oasis/primus-dictionary: -------------------------------------------------------------------------------- 1 | Flag primus_dictionary 2 | Description: Build Primus Dictionary Tool 3 | Default: false 4 | 5 | Library primus_dictionary_library_plugin 6 | Build$: flag(everything) || flag(primus_dictionary) 7 | Path: plugins/primus_dictionary 8 | BuildDepends: bap-primus, bap, core_kernel, bap-core-theory 9 | FindlibName: bap-plugin-primus_dictionary 10 | CompiledObject: best 11 | InternalModules: Primus_dictionary_main 12 | XMETADescription: provides a key-value storage 13 | XMETAExtraLines: tags="primus, primus-library" -------------------------------------------------------------------------------- /oasis/primus-exploring: -------------------------------------------------------------------------------- 1 | Flag primus_exploring 2 | Description: build Primus exploring scheduler 3 | Default: false 4 | 5 | Library primus_exploring_scheduler_plugin 6 | Path: plugins/primus_exploring 7 | Build$: flag(everything) || flag(primus_exploring) 8 | FindlibName: bap-plugin-primus_exploring 9 | CompiledObject: best 10 | BuildDepends: bap, bap-primus, core_kernel, monads, bap-future 11 | XMETADescription: evaluates all machines, prioritizing the least visited 12 | Modules: Primus_exploring_main 13 | XMETAExtraLines: tags="primus, scheduler" -------------------------------------------------------------------------------- /oasis/primus-greedy: -------------------------------------------------------------------------------- 1 | Flag primus_greedy 2 | Description: build Primus greedy scheduler 3 | Default: false 4 | 5 | Library primus_greedy_scheduler_plugin 6 | Path: plugins/primus_greedy 7 | Build$: flag(everything) || flag(primus_greedy) 8 | FindlibName: bap-plugin-primus_greedy 9 | CompiledObject: best 10 | BuildDepends: bap, bap-primus, core_kernel, monads 11 | XMETADescription: evaluates all machines in the DFS order 12 | Modules: Primus_greedy_main 13 | XMETAExtraLines: tags="primus, scheduler" 14 | -------------------------------------------------------------------------------- /oasis/primus-limit: -------------------------------------------------------------------------------- 1 | Flag primus_limit 2 | Description: build Primus limit plugin 3 | Default: false 4 | 5 | Library primus_limit 6 | Path: plugins/primus_limit 7 | Build$: flag(everything) || flag(primus_limit) 8 | FindlibName: bap-plugin-primus_limit 9 | CompiledObject: best 10 | BuildDepends: bap, bap-primus, bap, core_kernel, monads, bap-future, regular 11 | XMETADescription: ensures termination by limiting Primus machines 12 | Modules: Primus_limit_main 13 | XMETAExtraLines: tags="primus" 14 | -------------------------------------------------------------------------------- /oasis/primus-lisp.files.ab.in: -------------------------------------------------------------------------------- 1 | , plugins/primus_lisp/primus_lisp_config.ml.ab -------------------------------------------------------------------------------- /oasis/primus-lisp.setup.ml.in: -------------------------------------------------------------------------------- 1 | let () = 2 | add_variable ~doc:"additional sites for lisp files" 3 | "site_lisp" 4 | ~define:(function 5 | | None -> "" 6 | | Some xs -> xs); 7 | add_variable ~doc:"additional sites for site-lisp files" 8 | "site_site_lisp" 9 | ~define:(function 10 | | None -> "" 11 | | Some xs -> xs); 12 | add_variable ~doc:"additional sites for semantics files" 13 | "site_semantics" 14 | ~define:(function 15 | | None -> "" 16 | | Some xs -> xs) 17 | -------------------------------------------------------------------------------- /oasis/primus-loader: -------------------------------------------------------------------------------- 1 | Flag primus_loader 2 | Description: build Primus loader 3 | Default: false 4 | 5 | Library primus_loader_plugin 6 | Path: plugins/primus_loader 7 | Build$: flag(everything) || flag(primus_loader) 8 | FindlibName: bap-plugin-primus_loader 9 | CompiledObject: best 10 | BuildDepends: bap, bap-core-theory, bap-primus, core_kernel, ogre, ppx_bap 11 | XMETADescription: generic program loader for Primus 12 | Modules: Primus_loader_main 13 | InternalModules: Primus_loader_basic 14 | XMETAExtraLines: tags="abi, loader, primus" -------------------------------------------------------------------------------- /oasis/primus-machine: -------------------------------------------------------------------------------- 1 | Flag primus_machine 2 | Description: Build Primus Machine monad 3 | Default: false 4 | 5 | Library bap_primus_machine 6 | Build$: flag(everything) || flag(primus_machine) 7 | XMETADescription: provides Primus Machine monad 8 | XMETAExtraLines: tags="primus" 9 | Path: lib/bap_primus_machine 10 | FindlibName: bap-primus-machine 11 | CompiledObject: best 12 | BuildDepends: bap-knowledge, core_kernel, monads, ppx_bap 13 | Modules: Bap_primus_machine 14 | -------------------------------------------------------------------------------- /oasis/primus-mark-visited: -------------------------------------------------------------------------------- 1 | Flag primus_mark_visited 2 | Description: build Primus mark visited plugin 3 | Default: false 4 | 5 | Library primus_mark_visited_plugin 6 | Path: plugins/primus_mark_visited 7 | Build$: flag(everything) || flag(primus_mark_visited) 8 | FindlibName: bap-plugin-primus_mark_visited 9 | CompiledObject: best 10 | BuildDepends: bap-main, bap, bap-primus, bap-primus-track-visited 11 | XMETADescription: registers the bap:mark-visited component 12 | InternalModules: Primus_mark_visited_main 13 | XMETAExtraLines: tags="primus" -------------------------------------------------------------------------------- /oasis/primus-powerpc: -------------------------------------------------------------------------------- 1 | Flag primus_powerpc 2 | Description: build Primus powerpc support package 3 | Default: false 4 | 5 | Library primus_powerpc_plugin 6 | Path: plugins/primus_powerpc 7 | Build$: flag(everything) || flag(primus_powerpc) 8 | FindlibName: bap-plugin-primus_powerpc 9 | CompiledObject: best 10 | BuildDepends: bap, bap-primus, core_kernel 11 | XMETADescription: powerpc support package 12 | Modules: Primus_powerpc_main 13 | XMETAExtraLines: tags="primus, powerpc" 14 | -------------------------------------------------------------------------------- /oasis/primus-print: -------------------------------------------------------------------------------- 1 | Flag primus_print 2 | Description: build Primus print plugin 3 | Default: false 4 | 5 | Library primus_print_plugin 6 | Path: plugins/primus_print 7 | Build$: flag(everything) || flag(primus_print) 8 | FindlibName: bap-plugin-primus_print 9 | CompiledObject: best 10 | BuildDepends: bap-primus, bare, bap, bap-knowledge, bap-core-theory, core_kernel, ppx_bap, bap-future, monads 11 | XMETADescription: prints Primus states and observations 12 | Modules: Primus_print_main 13 | XMETAExtraLines: tags="primus, printer" -------------------------------------------------------------------------------- /oasis/primus-promiscuous: -------------------------------------------------------------------------------- 1 | Flag primus_promiscuous 2 | Description: build Primus promiscuous plugin 3 | Default: false 4 | 5 | Library primus_promiscuous_plugin 6 | Path: plugins/primus_promiscuous 7 | Build$: flag(everything) || flag(primus_promiscuous) 8 | FindlibName: bap-plugin-primus_promiscuous 9 | CompiledObject: best 10 | BuildDepends: bap, bap-primus, core_kernel, monads 11 | XMETADescription: enables the promiscuous mode of execution 12 | Modules: Primus_promiscuous_main 13 | XMETAExtraLines: tags="primus, fuzz" -------------------------------------------------------------------------------- /oasis/primus-region: -------------------------------------------------------------------------------- 1 | Flag primus_region 2 | Description: Build Primus Region Tool 3 | Default: false 4 | 5 | Library primus_region_library_plugin 6 | Build$: flag(everything) || flag(primus_region) 7 | Path: plugins/primus_region 8 | BuildDepends: bap-core-theory, bap-primus, bap, core_kernel, ppx_bap, monads 9 | FindlibName: bap-plugin-primus_region 10 | CompiledObject: best 11 | InternalModules: Primus_region_main 12 | XMETADescription: interval sets 13 | XMETAExtraLines: tags="primus, primus-library" -------------------------------------------------------------------------------- /oasis/primus-round-robin: -------------------------------------------------------------------------------- 1 | Flag primus_round_robin 2 | Description: build Primus round robin scheduler 3 | Default: false 4 | 5 | 6 | Library primus_round_robin_scheduler_plugin 7 | Path: plugins/primus_round_robin 8 | Build$: flag(everything) || flag(primus_round_robin) 9 | FindlibName: bap-plugin-primus_round_robin 10 | CompiledObject: best 11 | BuildDepends: bap, bap-primus, core_kernel, monads, bap-future 12 | XMETADescription: evaluates all machines in the BFS order 13 | Modules: Primus_round_robin_main 14 | XMETAExtraLines: tags="primus, scheduler" -------------------------------------------------------------------------------- /oasis/primus-track-visited: -------------------------------------------------------------------------------- 1 | Flag primus_track_visited 2 | Description: build Primus track visited library 3 | Default: false 4 | 5 | Library bap_primus_track_visited 6 | Path: lib/bap_primus_track_visited 7 | Build$: flag(everything) || flag(primus_track_visited) 8 | FindlibName: bap-primus-track-visited 9 | CompiledObject: best 10 | BuildDepends: bap-primus, bap, core_kernel, ppx_bap 11 | XMETADescription: tracks basic blocks visited by Primus 12 | Modules: Bap_primus_track_visited 13 | XMETAExtraLines: tags="primus" -------------------------------------------------------------------------------- /oasis/primus-wandering: -------------------------------------------------------------------------------- 1 | 2 | Flag primus_wandering 3 | Description: build Primus wandering scheduler 4 | Default: false 5 | 6 | Library primus_wandering_scheduler_plugin 7 | Path: plugins/primus_wandering 8 | Build$: flag(everything) || flag(primus_wandering) 9 | FindlibName: bap-plugin-primus_wandering 10 | CompiledObject: best 11 | BuildDepends: bap, bap-primus, core_kernel, monads, bap-future 12 | XMETADescription: evaluates all machines while 13 | Modules: Primus_wandering_main 14 | XMETAExtraLines: tags="primus, scheduler" -------------------------------------------------------------------------------- /oasis/primus-x86: -------------------------------------------------------------------------------- 1 | Flag primus_x86 2 | Description: build Primus x86 support package 3 | Default: false 4 | 5 | Library primus_x86_plugin 6 | Path: plugins/primus_x86 7 | Build$: flag(everything) || flag(primus_x86) 8 | FindlibName: bap-plugin-primus_x86 9 | CompiledObject: best 10 | BuildDepends: bap, bap-core-theory, bap-primus, core_kernel, bap-x86-cpu, regular 11 | XMETADescription: x86 support package 12 | Modules: Primus_x86_main 13 | InternalModules: Primus_x86_loader 14 | XMETAExtraLines: tags="primus, x86" -------------------------------------------------------------------------------- /oasis/propagate-taint: -------------------------------------------------------------------------------- 1 | Flag propagate_taint 2 | Description: Build a taint propagation plugin 3 | Default: false 4 | 5 | Library propagate_taint_plugin 6 | Build$: flag(everything) || flag(propagate_taint) 7 | Path: plugins/propagate_taint 8 | FindlibName: bap-plugin-propagate_taint 9 | BuildDepends: bap, bap-core-theory, bap-microx, core_kernel, ppx_bap, monads, regular, graphlib 10 | InternalModules: Propagate_taint_main, Propagator 11 | XMETADescription: propagate taints through a program 12 | XMETAExtraLines: tags="dataflow, pass, taint" -------------------------------------------------------------------------------- /oasis/raw: -------------------------------------------------------------------------------- 1 | Flag raw 2 | Description: Builds the raw loader plugin 3 | Default: false 4 | 5 | Library bap_raw_plugin 6 | Build$: flag(everything) || flag(raw) 7 | Path: plugins/raw 8 | FindlibName: bap-plugin-raw 9 | CompiledObject: best 10 | BuildDepends: bap, core_kernel, ppx_bap, bap-main, bitvec, ogre, core_kernel.caml_unix 11 | Modules: Raw_main 12 | -------------------------------------------------------------------------------- /oasis/read-symbols: -------------------------------------------------------------------------------- 1 | Flag read_symbols 2 | Description: Build read-symbols plugin 3 | Default: false 4 | 5 | Library read_symbols_plugin 6 | Build$: flag(everything) || flag(read_symbols) 7 | Path: plugins/read_symbols 8 | FindlibName: bap-plugin-read_symbols 9 | BuildDepends: bap-main, core_kernel, bap-core-theory, bap-knowledge, 10 | bitvec, bap-relation 11 | Modules: Read_symbols_main 12 | XMETADescription: read symbol information from file 13 | XMETAExtraLines: tags="reconstructor, rooter, symbolizer" -------------------------------------------------------------------------------- /oasis/recipe: -------------------------------------------------------------------------------- 1 | Flag recipe 2 | Description: Build the BAP recipe library 3 | Default: false 4 | 5 | Library recipe 6 | Build$: flag(everything) || flag(recipe) 7 | Path: lib/bap_recipe 8 | FindlibName: bap-recipe 9 | CompiledObject: best 10 | BuildDepends: stdlib-shims, base, stdio, parsexp, fileutils, camlzip, uuidm 11 | Modules: Bap_recipe 12 | XMETADescription: stores command line parameters and resources in a single file 13 | -------------------------------------------------------------------------------- /oasis/recipe-command: -------------------------------------------------------------------------------- 1 | Flag recipe_command 2 | Description: Build the BAP recipe command plugin 3 | Default: false 4 | 5 | Library bap_recipe_command_plugin 6 | Build$: flag(everything) || flag(recipe_command) 7 | Path: plugins/recipe_command 8 | FindlibName: bap-plugin-recipe_command 9 | CompiledObject: best 10 | BuildDepends: bap, bap-recipe, bap-main, base, stdio, stdlib-shims 11 | Modules: Recipe_command_main 12 | XMETADescription: manipulates bap recipes 13 | XMETAExtraLines: tags="recipe,command" 14 | -------------------------------------------------------------------------------- /oasis/relation: -------------------------------------------------------------------------------- 1 | Flag relation 2 | Description: Build the relation library 3 | Default: false 4 | 5 | Library bap_relation 6 | Build$: flag(everything) || flag(relation) 7 | Path: lib/bap_relation 8 | FindlibName: bap-relation 9 | BuildDepends: base 10 | Modules: Bap_relation 11 | -------------------------------------------------------------------------------- /oasis/report: -------------------------------------------------------------------------------- 1 | Flag report 2 | Description: Build the report bars plugin 3 | Default: false 4 | 5 | Library report_plugin 6 | Build$: flag(everything) || flag(report) 7 | Path: plugins/report 8 | FindlibName: bap-plugin-report 9 | CompiledObject: best 10 | BuildDepends: bap, core_kernel, bap-future, core_kernel.caml_unix 11 | InternalModules: Report_main 12 | XMETADescription: reports program status 13 | XMETAExtraLines: tags="report, visualization" 14 | -------------------------------------------------------------------------------- /oasis/run: -------------------------------------------------------------------------------- 1 | Flag run 2 | Description: build run plugin 3 | Default: false 4 | 5 | Library run_plugin 6 | Build$: flag(everything) || flag(run) 7 | Path: plugins/run 8 | FindlibName: bap-plugin-run 9 | CompiledObject: best 10 | BuildDepends: bap, bap-primus, core_kernel, graphlib, monads, regular, 11 | bap-knowledge, bap-core-theory 12 | InternalModules: Run_main 13 | XMETADescription: a pass that will run a program 14 | XMETAExtraLines: tags="emulator, pass, primus" 15 | -------------------------------------------------------------------------------- /oasis/specification: -------------------------------------------------------------------------------- 1 | Flag specification 2 | Description: Enable the specification command 3 | Default: false 4 | 5 | Library specification_plugin 6 | Build$: flag(everything) || flag(specification) 7 | XMETADescription: prints the specification of the binary (like readelf) 8 | Path: plugins/specification 9 | FindlibName: bap-plugin-specification 10 | CompiledObject: best 11 | BuildDepends: bap, core_kernel, bap-main, ogre, regular 12 | InternalModules: Specification_main 13 | XMETAExtraLines: tags="command, specification" 14 | -------------------------------------------------------------------------------- /oasis/ssa: -------------------------------------------------------------------------------- 1 | Flag ssa 2 | Description: Build the SSA plugin 3 | Default: false 4 | 5 | 6 | Library ssa_plugin 7 | Build$: flag(everything) || flag(ssa) 8 | XMETADescription: translates a program into the SSA form 9 | Path: plugins/ssa 10 | FindlibName: bap-plugin-ssa 11 | CompiledObject: best 12 | BuildDepends: bap 13 | InternalModules: Ssa_main 14 | XMETAExtraLines: tags="pass,analysis,ssa" 15 | -------------------------------------------------------------------------------- /oasis/strings: -------------------------------------------------------------------------------- 1 | Flag strings 2 | Description: Build strings plugin 3 | Default: false 4 | 5 | Library strings_plugin 6 | Build$: flag(everything) || flag(strings) 7 | Path: plugins/strings 8 | FindlibName: bap-plugin-strings 9 | BuildDepends: bap, bap-strings, bap-beagle-prey, core_kernel, regular 10 | InternalModules: Strings_main 11 | XMETAExtraLines: tags="pass, strings" 12 | XMETADescription: find strings of characters 13 | -------------------------------------------------------------------------------- /oasis/strings-library: -------------------------------------------------------------------------------- 1 | Flag strings_library 2 | Description: Build string analysis library 3 | Default: false 4 | 5 | 6 | Library bap_strings 7 | Build$: flag(everything) || flag(strings_library) 8 | Path: lib/bap_strings 9 | FindlibName: bap-strings 10 | BuildDepends: core_kernel,ppx_bap 11 | Modules: Bap_strings, 12 | Bap_strings_detector, 13 | Bap_strings_index, 14 | Bap_strings_unscrambler, 15 | Bap_strings_scanner 16 | -------------------------------------------------------------------------------- /oasis/stub-resolver.files.ab.in: -------------------------------------------------------------------------------- 1 | , plugins/stub_resolver/stub_resolver_sites.ml.ab -------------------------------------------------------------------------------- /oasis/stub-resolver.setup.ml.in: -------------------------------------------------------------------------------- 1 | let () = 2 | add_variable ~doc:"additional sites for signatures" 3 | "site_signatures" 4 | ~define:(function 5 | | None -> "" 6 | | Some xs -> xs) 7 | -------------------------------------------------------------------------------- /oasis/text-tags: -------------------------------------------------------------------------------- 1 | Flag text_tags 2 | Description: Build text-tags library 3 | Default: false 4 | 5 | Library "text-tags" 6 | Path: lib/text_tags 7 | Build$: flag(everything) || flag(text_tags) 8 | FindlibName: text-tags 9 | CompiledObject: best 10 | BuildDepends: core_kernel, core_kernel.caml_unix 11 | Modules: Text_tags 12 | -------------------------------------------------------------------------------- /oasis/toplevel: -------------------------------------------------------------------------------- 1 | Flag toplevel 2 | Description: Build the baptop utility 3 | Default: false 4 | 5 | Executable "baptop" 6 | Path: src 7 | MainIs: baptop.ml 8 | Build$: flag(everything) || flag(toplevel) 9 | ByteOpt: -thread 10 | CompiledObject: byte 11 | BuildDepends: utop, threads, findlib.dynload 12 | -------------------------------------------------------------------------------- /oasis/trace: -------------------------------------------------------------------------------- 1 | Flag trace 2 | Description: Build BAP trace dump utility 3 | Default: false 4 | 5 | Library trace_plugin 6 | Path: plugins/trace 7 | Build$: flag(everything) || flag(trace) 8 | FindlibName: bap-plugin-trace 9 | CompiledObject: best 10 | Modules: Trace_main 11 | BuildDepends: bap, bap-traces, core_kernel, ppx_bap, bap-plugins, 12 | bap-future, uri, regular, core_kernel.caml_unix 13 | XMETADescription: manage execution traces 14 | XMETAExtraLines: tags="dynamic, pass, printer, trace" -------------------------------------------------------------------------------- /oasis/trivial-condition-form: -------------------------------------------------------------------------------- 1 | Flag trivial_condition_form 2 | Description: Build trivial_condition_form plugin 3 | Default: false 4 | 5 | Library trivial_condition_form_plugin 6 | Build$: flag(everything) || flag(trivial_condition_form) 7 | Path: plugins/trivial_condition_form 8 | FindlibName: bap-plugin-trivial_condition_form 9 | CompiledObject: best 10 | BuildDepends: bap, core_kernel 11 | Modules: Trivial_condition_form_main 12 | XMETADescription: eliminates complex conditionals in branches 13 | XMETAExtraLines: tags="pass" -------------------------------------------------------------------------------- /oasis/warn-unused: -------------------------------------------------------------------------------- 1 | Flag warn_unused 2 | Description: Build a warn-unused plugin 3 | Default: false 4 | 5 | Library warn_unused_plugin 6 | Build$: flag(everything) || flag(warn_unused) 7 | Path: plugins/warn_unused 8 | FindlibName: bap-plugin-warn_unused 9 | BuildDepends: bap, core_kernel 10 | InternalModules: Warn_unused_main 11 | XMETADescription: warn about unused results of certain functions 12 | XMETAExtraLines: tags="analysis, checker, pass, security" -------------------------------------------------------------------------------- /plugins/abi/abi_main.ml: -------------------------------------------------------------------------------- 1 | let provides = ["abi"; "pass"] 2 | let doc = {| 3 | # DESCRIPTION 4 | 5 | Runs ABI-specific passes. The passes are registered using 6 | Bap_abi.register_pass function, by target-specific plugins, 7 | depending on the binary architecture and command line options, 8 | provided by a user. 9 | 10 | # SEE ALSO 11 | 12 | $(b,bap-plugin-x86)(1), $(b,bap-plugin-arm)(1), $(b,bap-abi)(3) 13 | |} 14 | open Bap.Std 15 | open Bap_main 16 | 17 | 18 | let () = Extension.declare ~provides ~doc (fun _ -> 19 | Project.register_pass ~autorun:true Bap_abi.pass; 20 | Ok ()) 21 | -------------------------------------------------------------------------------- /plugins/abi/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name abi) 3 | (public_name bap-abi.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-abi bap-main)) 6 | 7 | (plugin 8 | (name abi) 9 | (package bap-abi) 10 | (libraries bap-abi.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/analyze/analyze_core_commands.mli: -------------------------------------------------------------------------------- 1 | val register : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/analyze/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_analyze) 3 | (public_name bap-analyze.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-knowledge 9 | bap-main 10 | bitvec 11 | core_kernel 12 | linenoise 13 | monads)) 14 | 15 | (plugin 16 | (name analyze) 17 | (package bap-analyze) 18 | (libraries bap-analyze.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/api/api/c/android.h: -------------------------------------------------------------------------------- 1 | void __libc_init(char **argv, void *on_exit, int (*main) (int, char **, char **)); 2 | -------------------------------------------------------------------------------- /plugins/api/api/c/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files 3 | (android.h as c/android.h) 4 | (posix.h as c/posix.h) 5 | (windows.h as c/windows.h) 6 | (gnu.h as c/gnu.h)) 7 | (package bap-api) 8 | (section (site (bap-common api)))) 9 | -------------------------------------------------------------------------------- /plugins/api/api/c/gnu.h: -------------------------------------------------------------------------------- 1 | int __libc_start_main(int (*main) (int, char **, char **), int, char **, void *auxv); 2 | void __stack_chk_fail(void) __attribute__((noreturn)); 3 | -------------------------------------------------------------------------------- /plugins/api/api/c/windows.h: -------------------------------------------------------------------------------- 1 | void __security_init_cookie(void); 2 | -------------------------------------------------------------------------------- /plugins/api/api_sites.ml.ab: -------------------------------------------------------------------------------- 1 | let paths = [${site_api}] -------------------------------------------------------------------------------- /plugins/arm/arm_gnueabi.mli: -------------------------------------------------------------------------------- 1 | val setup : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/arm/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_arm_plugin) 3 | (public_name bap-arm.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-abi 8 | bap-api 9 | bap-arm 10 | bap-c 11 | bap-core-theory 12 | bap-main 13 | core_kernel 14 | monads)) 15 | 16 | (plugin 17 | (name arm) 18 | (package bap-arm) 19 | (libraries bap-arm.plugin) 20 | (site (bap-common plugins))) 21 | -------------------------------------------------------------------------------- /plugins/arm/semantics/arm.lisp: -------------------------------------------------------------------------------- 1 | (declare (context (target arm-family))) 2 | (defpackage llvm-armv7 (:use arm)) 3 | (in-package arm) 4 | 5 | (require bits) 6 | 7 | (defun CLZ (rd rn pre _) 8 | (when (condition-holds pre) 9 | (set$ rd (clz rn)))) 10 | -------------------------------------------------------------------------------- /plugins/arm/semantics/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (package bap-primus-lisp) 3 | (section (site (bap-common semantics))) 4 | (files 5 | aarch64-arithmetic.lisp 6 | aarch64-atomic.lisp 7 | aarch64-branch.lisp 8 | aarch64-data-movement.lisp 9 | aarch64-helper.lisp 10 | aarch64.lisp 11 | aarch64-logical.lisp 12 | aarch64-pstate.lisp 13 | aarch64-special.lisp 14 | arm-bits.lisp 15 | arm.lisp 16 | thumb.lisp 17 | thumb-patterns.lisp)) 18 | -------------------------------------------------------------------------------- /plugins/arm/semantics/thumb-patterns.lisp: -------------------------------------------------------------------------------- 1 | (in-package bap) 2 | 3 | (declare (context (target arm-family) 4 | (patterns enabled))) 5 | 6 | (defmethod bap:patterns-action (action addr attrs) 7 | (when (= action 'setcontext) 8 | (let ((name (patterns-attribute attrs :name)) 9 | (mode (patterns-attribute attrs :value))) 10 | (when (and name mode (= name 'TMode)) 11 | (let ((lang (if (= mode '1) :T32 :A32))) 12 | (arm-set-encoding addr lang)))))) 13 | -------------------------------------------------------------------------------- /plugins/beagle/beagle_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/beagle/beagle_main.mli -------------------------------------------------------------------------------- /plugins/beagle/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_beagle_plugin) 3 | (public_name bap-beagle.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-beagle 8 | bap-future 9 | bap-microx 10 | bap-primus 11 | bap-strings 12 | core_kernel 13 | monads 14 | regular)) 15 | 16 | (plugin 17 | (name beagle) 18 | (package bap-beagle) 19 | (libraries bap-beagle.plugin) 20 | (site (bap-common plugins))) 21 | -------------------------------------------------------------------------------- /plugins/bil/Makefile: -------------------------------------------------------------------------------- 1 | 2 | float: 3 | bapbuild -pkgs findlib.dynload,monads,bap-primus,oUnit,bap-core-theory,bap-knowledge bil_float_tests.native 4 | 5 | clean: 6 | rm -rf _build 7 | rm -f bil_float_tests.native 8 | -------------------------------------------------------------------------------- /plugins/bil/bil_ir.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Bap_core_theory 3 | 4 | type t 5 | 6 | val slot : (Theory.Semantics.cls, t) KB.slot 7 | 8 | val reify : t -> blk term list 9 | val init : unit -> unit 10 | 11 | module Theory : Theory.Core 12 | -------------------------------------------------------------------------------- /plugins/bil/bil_lifter.mli: -------------------------------------------------------------------------------- 1 | type ispec = [ 2 | | `any 3 | | `unk 4 | | `special 5 | | `tag of string 6 | | `asm of string 7 | | `insn of string * string 8 | ] 9 | 10 | 11 | val init : 12 | enable_intrinsics:ispec list -> 13 | with_fp:bool -> unit -> unit 14 | -------------------------------------------------------------------------------- /plugins/bil/bil_semantics.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Bap_core_theory 3 | 4 | module Core : Theory.Core 5 | module Core_with_fp_emulation : Theory.Core 6 | -------------------------------------------------------------------------------- /plugins/bil/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_bil_plugin) 3 | (public_name bap-bil.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-future 9 | bap-knowledge 10 | bap-main 11 | bitvec 12 | bitvec-order 13 | core_kernel 14 | monads 15 | ogre)) 16 | 17 | (plugin 18 | (name bil) 19 | (package bap-bil) 20 | (libraries bap-bil.plugin) 21 | (site (bap-common plugins))) 22 | -------------------------------------------------------------------------------- /plugins/byteweight/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_byteweight_plugin) 3 | (public_name bap-byteweight.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-byteweight 8 | bap-core-theory 9 | bap-knowledge 10 | bap-main 11 | bitvec 12 | bitvec-order 13 | core_kernel)) 14 | 15 | (plugin 16 | (name byteweight) 17 | (package bap-byteweight) 18 | (libraries bap-byteweight.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/cache/bap_cache.mli: -------------------------------------------------------------------------------- 1 | (** All operations in this module are atomic. *) 2 | 3 | open Bap_cache_types 4 | 5 | val init : unit -> unit 6 | 7 | val size : unit -> int 8 | 9 | val set_root : string -> unit 10 | 11 | val root : unit -> string 12 | 13 | val data : unit -> string 14 | 15 | val gc_threshold : config -> int 16 | 17 | val read_config : unit -> config 18 | 19 | val write_config : config -> unit 20 | -------------------------------------------------------------------------------- /plugins/cache/bap_cache_gc.mli: -------------------------------------------------------------------------------- 1 | open Bap_cache_types 2 | 3 | val shrink : ?by_threshold:bool -> config -> unit 4 | 5 | val clean : unit -> unit 6 | -------------------------------------------------------------------------------- /plugins/cache/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_cache_plugin) 3 | (public_name bap-cache.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-main 8 | core_kernel 9 | core_kernel.caml_unix 10 | fileutils 11 | mmap 12 | regular 13 | uuidm)) 14 | 15 | (plugin 16 | (name cache) 17 | (package bap-cache) 18 | (libraries bap-cache.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/callgraph_collator/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_callgraph_collator_plugin) 3 | (public_name bap-callgraph-collator.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-main core_kernel graphlib re.pcre)) 6 | 7 | (plugin 8 | (name callgraph-collator) 9 | (package bap-callgraph-collator) 10 | (libraries bap-callgraph-collator.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/callsites/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_callsites_plugin) 3 | (public_name bap-callsites.plugin) 4 | (libraries bap core_kernel)) 5 | 6 | (plugin 7 | (name callsites) 8 | (package bap-callsites) 9 | (libraries bap-callsites.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/constant_tracker/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_constant_tracker_plugin) 3 | (public_name bap-constant-tracker.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-primus core_kernel)) 6 | 7 | (plugin 8 | (name constant-tracker) 9 | (package bap-constant-tracker) 10 | (libraries bap-constant-tracker.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/constant_tracker/lisp/check-hardcoded-values.lisp: -------------------------------------------------------------------------------- 1 | (defun check-hardcoded-socket-address (sockaddr-ptr) 2 | (when (points-to-static-data sockaddr-ptr 16) 3 | (incident-report 'hardcoded-socket-address (incident-location)))) 4 | 5 | 6 | (defmethod call (name fd addr) 7 | (when (is-in name 'accept 'bind 'connect) 8 | (check-hardcoded-socket-address addr))) 9 | 10 | (defmethod call (name fd buf size flags addr len) 11 | (when (is-in name 'sendto 'recvfrom) 12 | (check-hardcoded-socket-address addr))) 13 | -------------------------------------------------------------------------------- /plugins/constant_tracker/lisp/check-null-pointers.lisp: -------------------------------------------------------------------------------- 1 | (defun check-null-pointer (ptr) 2 | (when (and (not ptr) (all-static-constant ptr)) 3 | (incident-report 'null-pointer-dereference (incident-location)))) 4 | 5 | (defmethod loading (ptr) 6 | (check-null-pointer ptr)) 7 | 8 | (defmethod storing (ptr) 9 | (check-null-pointer ptr)) 10 | -------------------------------------------------------------------------------- /plugins/constant_tracker/lisp/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files check-hardcoded-values.lisp check-null-pointers.lisp) 3 | (package bap-constant-tracker) 4 | (section (site (bap-common site_lisp)))) 5 | -------------------------------------------------------------------------------- /plugins/core_theory/core_theory_main.mli: -------------------------------------------------------------------------------- 1 | (* nothing is exported *) 2 | -------------------------------------------------------------------------------- /plugins/core_theory/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_core_theory_plugin) 3 | (public_name bap-core-theory.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap-core-theory bap-knowledge bap-main 6 | bitvec core_kernel monads)) 7 | 8 | (plugin 9 | (name core-theory) 10 | (package bap-core-theory) 11 | (libraries bap-core-theory.plugin) 12 | (site (bap-common plugins))) 13 | -------------------------------------------------------------------------------- /plugins/cxxfilt/cxxfilt_config.ml.ab: -------------------------------------------------------------------------------- 1 | let cxxfilts = $cxxfilt_paths 2 | -------------------------------------------------------------------------------- /plugins/cxxfilt/cxxfilt_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/cxxfilt/cxxfilt_main.mli -------------------------------------------------------------------------------- /plugins/cxxfilt/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_cxxfilt_plugin) 3 | (public_name bap-cxxfilt.plugin) 4 | (libraries bap bap-demangle core_kernel core_kernel.caml_unix)) 5 | 6 | (plugin 7 | (name cxxfilt) 8 | (package bap-cxxfilt) 9 | (libraries bap-cxxfilt.plugin) 10 | (site (bap-common plugins))) 11 | 12 | (rule 13 | (target cxxfilt_config.ml) 14 | (deps cxxfilt_config.ml.ab (alias ../../config)) 15 | (action 16 | (with-stdin-from %{deps} 17 | (with-stdout-to %{target} 18 | (chdir %{workspace_root} 19 | (run ./tools/rewrite.exe -filename %{deps})))))) 20 | -------------------------------------------------------------------------------- /plugins/demangle/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name demangle) 3 | (public_name bap-demangle.plugin) 4 | (libraries 5 | bap-core-theory 6 | bap-demangle 7 | bap-knowledge 8 | bap-main 9 | core_kernel)) 10 | 11 | (plugin 12 | (name demangle) 13 | (package bap-demangle) 14 | (libraries bap-demangle.plugin) 15 | (site (bap-common plugins))) 16 | -------------------------------------------------------------------------------- /plugins/dependencies/dependencies_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/dependencies/dependencies_main.mli -------------------------------------------------------------------------------- /plugins/dependencies/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_dependencies_plugin) 3 | (public_name bap-dependencies.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-main core_kernel ogre regular)) 6 | 7 | (plugin 8 | (name dependencies) 9 | (package bap-dependencies) 10 | (libraries bap-dependencies.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/disassemble/disassemble_main.mli: -------------------------------------------------------------------------------- 1 | (* bap frontend *) 2 | -------------------------------------------------------------------------------- /plugins/disassemble/disassemble_main_rules.mli: -------------------------------------------------------------------------------- 1 | (* exports nothing *) 2 | -------------------------------------------------------------------------------- /plugins/disassemble/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name disassemble) 3 | (public_name bap-disassemble.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-knowledge 9 | bap-main 10 | bap-relation 11 | bitvec 12 | bitvec-binprot 13 | bitvec-order 14 | bitvec-sexp 15 | core_kernel 16 | monads 17 | ogre 18 | regular)) 19 | 20 | (plugin 21 | (name disassemble) 22 | (package bap-disassemble) 23 | (libraries bap-disassemble.plugin) 24 | (site (bap-common plugins))) 25 | -------------------------------------------------------------------------------- /plugins/dump_symbols/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_dump_symbols_plugin) 3 | (public_name bap-dump-symbols.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap core_kernel graphlib regular)) 6 | 7 | (plugin 8 | (name dump-symbols) 9 | (package bap-dump-symbols) 10 | (libraries bap-dump-symbols.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/elf_loader/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_elf_loader_plugin) 3 | (public_name bap-elf.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-elf bap-dwarf core_kernel regular)) 6 | 7 | (plugin 8 | (name elf-loader) 9 | (package bap-elf) 10 | (libraries bap-elf.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/elf_loader/elf_loader_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/elf_loader/elf_loader_main.mli -------------------------------------------------------------------------------- /plugins/emit_ida_script/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_emit_ida_script_plugin) 3 | (public_name bap-ida-plugin.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap core_kernel regular)) 6 | 7 | (plugin 8 | (name emit-ida-script) 9 | (package bap-ida-plugin) 10 | (libraries bap-ida-plugin.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/flatten/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_flatten_plugin) 3 | (public_name bap-flatten.plugin) 4 | (libraries bap bap-main)) 5 | 6 | (plugin 7 | (name flatten) 8 | (package bap-flatten) 9 | (libraries bap-flatten.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/frontc_parser/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_frontc_parser_plugin) 3 | (public_name bap-frontc.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-c FrontC core_kernel core_kernel.caml_unix)) 6 | 7 | (plugin 8 | (name frontc-parser) 9 | (package bap-frontc) 10 | (libraries bap-frontc.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/ghidra/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (optional) 3 | (name bap_ghidra_plugin) 4 | (public_name bap-ghidra.plugin) 5 | (libraries bap bap-ghidra bap-main core_kernel)) 6 | 7 | (plugin 8 | (optional) 9 | (name ghidra) 10 | (package bap-ghidra) 11 | (libraries bap-ghidra.plugin) 12 | (site (bap-common plugins))) 13 | -------------------------------------------------------------------------------- /plugins/ghidra/ghidra_main.mli: -------------------------------------------------------------------------------- 1 | (* a private module *) 2 | -------------------------------------------------------------------------------- /plugins/ghidra/semantics/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files pcode-cpuid.lisp pcode.lisp) 3 | (package bap-ghidra) 4 | (section (site (bap-common semantics)))) 5 | -------------------------------------------------------------------------------- /plugins/glibc_runtime/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_glibc_runtime_plugin) 3 | (public_name bap-glibc-runtime.plugin) 4 | (libraries bap bap-abi bap-c bap-core-theory bap-main core_kernel ogre)) 5 | 6 | (plugin 7 | (name glibc-runtime) 8 | (package bap-glibc-runtime) 9 | (libraries bap-glibc-runtime.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/glibc_runtime/glibc_runtime_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/glibc_runtime/glibc_runtime_main.mli -------------------------------------------------------------------------------- /plugins/ida/bap_ida_config.ml.ab: -------------------------------------------------------------------------------- 1 | let ida_path = "$ida_path" 2 | let is_headless = $ida_headless 3 | -------------------------------------------------------------------------------- /plugins/ida/bap_ida_service.mli: -------------------------------------------------------------------------------- 1 | 2 | (** [register ida_info ida_mode] registers the IDA service with 3 | Bap_ida library *) 4 | val register : Bap_ida_info.t -> Bap_ida_info.mode option -> unit 5 | -------------------------------------------------------------------------------- /plugins/llvm/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name llvm_plugin) 3 | (public_name bap-llvm.plugin) 4 | (libraries bap bap-llvm bap-main core_kernel)) 5 | 6 | (plugin 7 | (name llvm) 8 | (package bap-llvm) 9 | (libraries bap-llvm.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/llvm/llvm_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/llvm/llvm_main.mli -------------------------------------------------------------------------------- /plugins/map_terms/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_map_terms_plugin) 3 | (public_name bap-term-mapper.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-bml bap-main core_kernel regular)) 6 | 7 | (plugin 8 | (name map-terms) 9 | (package bap-term-mapper) 10 | (libraries bap-term-mapper.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/mc/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name mc_plugin) 3 | (public_name bap-mc.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-knowledge 9 | bap-main 10 | bitvec 11 | core_kernel 12 | ogre 13 | regular)) 14 | 15 | (plugin 16 | (name mc) 17 | (package bap-mc) 18 | (libraries bap-mc.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/mips/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_mips_plugin) 3 | (public_name bap-mips.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-abi 8 | bap-api 9 | bap-c 10 | bap-core-theory 11 | bap-knowledge 12 | bap-main 13 | bap-mips 14 | core_kernel 15 | regular 16 | zarith)) 17 | 18 | (plugin 19 | (name mips) 20 | (package bap-mips) 21 | (libraries bap-mips.plugin) 22 | (site (bap-common plugins))) 23 | -------------------------------------------------------------------------------- /plugins/mips/mips_abi.mli: -------------------------------------------------------------------------------- 1 | val setup : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/mips/mips_types.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | open Mips_rtl 5 | open Mips_dsl 6 | open Mips_utils 7 | open Mips_model 8 | 9 | type cpu = { 10 | load : exp -> bitwidth -> exp; 11 | store : exp -> exp -> bitwidth -> rtl; 12 | jmp : exp -> rtl; 13 | cia : exp; 14 | word_width : exp; 15 | delay : exp; 16 | word_bitwidth : bitwidth; 17 | reg : (op -> exp) ec; 18 | gpr : int -> exp; 19 | fpr : int -> exp; 20 | hi : exp; 21 | lo : exp; 22 | } 23 | -------------------------------------------------------------------------------- /plugins/mips/mips_utils.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | let mips_fail format = 5 | let fail str = failwith (sprintf "MIPS lifter fail: %s" str) in 6 | Printf.ksprintf fail format 7 | -------------------------------------------------------------------------------- /plugins/mips/mips_utils.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | 3 | (** [mips_fail error_string] - raise a failure with [error_string] *) 4 | val mips_fail : ('a, unit, string, 'b) format4 -> 'a 5 | -------------------------------------------------------------------------------- /plugins/objdump/objdump_config.ml.ab: -------------------------------------------------------------------------------- 1 | let objdumps = $objdump_paths 2 | -------------------------------------------------------------------------------- /plugins/optimization/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_optimization_plugin) 3 | (public_name bap-optimization.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap core_kernel graphlib regular)) 6 | 7 | (plugin 8 | (name optimization) 9 | (package bap-optimization) 10 | (libraries bap-optimization.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/optimization/optimization_data.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open Regular.Std 4 | 5 | type t 6 | 7 | val mark_updated : 'a term -> 'a term 8 | 9 | val create : deads:Tid.Set.t -> sub term -> t 10 | 11 | val apply : sub term -> t -> sub term 12 | 13 | 14 | val update : sub term -> t -> sub term 15 | 16 | val find_unreachable : sub term -> t -> t 17 | 18 | val remove_dead_code : sub term -> t -> sub term 19 | 20 | 21 | include Data.S with type t := t 22 | -------------------------------------------------------------------------------- /plugins/patterns/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_patterns_plugin) 3 | (public_name bap-patterns.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-knowledge 9 | bap-main 10 | bap-primus 11 | bap-relation 12 | bitvec 13 | bitvec-binprot 14 | bitvec-order 15 | bitvec-sexp 16 | core_kernel 17 | fileutils 18 | uri 19 | xmlm 20 | zarith)) 21 | 22 | (plugin 23 | (name patterns) 24 | (package bap-patterns) 25 | (libraries bap-patterns.plugin) 26 | (site (bap-common plugins))) 27 | -------------------------------------------------------------------------------- /plugins/patterns/semantics/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files pattern-actions.lisp) 3 | (package bap-patterns) 4 | (section (site (bap-common semantics)))) 5 | -------------------------------------------------------------------------------- /plugins/patterns/semantics/pattern-actions.lisp: -------------------------------------------------------------------------------- 1 | (in-package bap) 2 | 3 | (declare (context (patterns enabled))) 4 | 5 | (defmethod bap:patterns-action (action addr attrs) 6 | (when (is-in action 'funcstart 'possiblefuncstart) 7 | (promise-function-start addr))) 8 | -------------------------------------------------------------------------------- /plugins/phoenix/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_phoenix_plugin) 3 | (public_name bap-phoenix.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | core_kernel 8 | core_kernel.caml_unix 9 | ezjsonm 10 | graphlib 11 | ocamlgraph 12 | regular 13 | text-tags)) 14 | 15 | (plugin 16 | (name phoenix) 17 | (package bap-phoenix) 18 | (libraries bap-phoenix.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/phoenix/phoenix_dot.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | module Make(Env : sig 5 | val project : project 6 | val options : Phoenix_options.t 7 | module Target : Target 8 | end) : sig 9 | val fprint_graph : Format.formatter -> Symtab.fn -> unit 10 | val output_graph : Out_channel.t -> Symtab.fn -> unit 11 | end 12 | -------------------------------------------------------------------------------- /plugins/phoenix/phoenix_helpers.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | (** [bil_of_block blk] *) 5 | 6 | module Make(Env : sig 7 | val options : Phoenix_options.t 8 | val project : project 9 | module Target : Target 10 | end) : sig 11 | val bil_of_block : block -> bil 12 | val bil_of_insns : (mem * insn) list -> bil 13 | val bil_of_insn : mem * insn -> bil 14 | end 15 | -------------------------------------------------------------------------------- /plugins/phoenix/phoenix_options.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | type label_format = [ `with_asm | `with_bil | `with_name ] 5 | [@@deriving sexp] 6 | 7 | type t = { 8 | output_folder : string; 9 | cfg_format : label_format list; 10 | no_resolve : bool; 11 | keep_alive : bool; 12 | no_inline : bool; 13 | keep_consts : bool; 14 | no_optimizations : bool; 15 | } [@@deriving sexp, fields] 16 | -------------------------------------------------------------------------------- /plugins/piqi_printers/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_piqi_printers_plugin) 3 | (public_name bap-piqi.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap-piqi)) 6 | 7 | (plugin 8 | (name piqi_printers) 9 | (package bap-piqi) 10 | (libraries bap-piqi.plugin) 11 | (optional) 12 | (site (bap-common plugins))) 13 | -------------------------------------------------------------------------------- /plugins/piqi_printers/piqi_printers_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/piqi_printers/piqi_printers_main.mli -------------------------------------------------------------------------------- /plugins/powerpc/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_powerpc_plugin) 3 | (public_name bap-powerpc.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-abi 8 | bap-api 9 | bap-c 10 | bap-core-theory 11 | bap-powerpc 12 | core_kernel 13 | monads 14 | regular 15 | zarith)) 16 | 17 | (plugin 18 | (name powerpc) 19 | (package bap-powerpc) 20 | (libraries bap-powerpc.plugin) 21 | (site (bap-common plugins))) 22 | -------------------------------------------------------------------------------- /plugins/powerpc/powerpc_abi.mli: -------------------------------------------------------------------------------- 1 | val setup : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/powerpc/powerpc_cpu.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | open Powerpc_rtl 3 | open Powerpc_types 4 | 5 | val make_cpu : addr_size -> endian -> mem -> cpu 6 | -------------------------------------------------------------------------------- /plugins/powerpc/powerpc_utils.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | let ppc_fail format = 5 | let fail str = failwith (sprintf "PowerPC lifter fail: %s" str) in 6 | Printf.ksprintf fail format 7 | -------------------------------------------------------------------------------- /plugins/powerpc/powerpc_utils.mli: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | 3 | (** [ppc_fail error_string] - raise a failure with [error_string] *) 4 | val ppc_fail : ('a, unit, string, 'b) format4 -> 'a 5 | -------------------------------------------------------------------------------- /plugins/powerpc/semantics/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files powerpc.lisp) 3 | (package bap-powerpc) 4 | (section (site (bap-common semantics)))) 5 | -------------------------------------------------------------------------------- /plugins/powerpc/semantics/powerpc.lisp: -------------------------------------------------------------------------------- 1 | (declare (context (target powerpc))) 2 | 3 | (defpackage powerpc (:use core target)) 4 | (defpackage llvm-powerpc32 (:use powerpc)) 5 | 6 | 7 | (defun NOP () 8 | (empty)) 9 | -------------------------------------------------------------------------------- /plugins/primus_approximation/Makefile: -------------------------------------------------------------------------------- 1 | 2 | float: 3 | bapbuild -pkgs monads,bap-primus,bap-core-theory,bap-knowledge approximation.plugin 4 | bapbundle install approximation.plugin 5 | clean: 6 | rm -rf _build 7 | rm -f approximation.plugin 8 | -------------------------------------------------------------------------------- /plugins/primus_approximation/approximation.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/primus_approximation/approximation.mli -------------------------------------------------------------------------------- /plugins/primus_approximation/lisp/math.lisp: -------------------------------------------------------------------------------- 1 | (defun sin (x) 2 | (declare (external "sin")) 3 | (approximate 'sin 64 x)) 4 | 5 | (defun cos (x) 6 | (declare (external "cos")) 7 | (approximate 'cos 64 x)) 8 | 9 | (defun log (x) 10 | (declare (external "log")) 11 | (approximate 'log 64 x)) 12 | -------------------------------------------------------------------------------- /plugins/primus_approximation/lisp/test.lisp: -------------------------------------------------------------------------------- 1 | (require math) 2 | 3 | (defmethod init () 4 | (msg "hello from math $0" (sin 4611686018427387904:64)) 5 | (msg "hello from math sin(316.159265358979326) = $0" (sin 4644269548807471931:64)) 6 | (msg "hello from math sin(7853981635.97448254) = $0" (sin 4755029503896426363:64)) 7 | (msg "hello from math sin(8.28318530717958623) = $0" (sin 4620852636837615244:64)) 8 | ) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /plugins/primus_dictionary/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_dictionary_plugin) 3 | (public_name bap-primus-dictionary.plugin) 4 | (libraries bap bap-primus bap-core-theory core_kernel)) 5 | 6 | (plugin 7 | (name primus-dictionary) 8 | (package bap-primus-dictionary) 9 | (libraries bap-primus-dictionary.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_exploring/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_exploring_plugin) 3 | (public_name bap-primus-exploring-scheduler.plugin) 4 | (libraries bap bap-primus monads core_kernel)) 5 | 6 | (plugin 7 | (name primus-exploring) 8 | (package bap-primus-exploring-scheduler) 9 | (libraries bap-primus-exploring-scheduler.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_greedy/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_greedy_plugin) 3 | (public_name bap-primus-greedy-scheduler.plugin) 4 | (libraries bap bap-primus monads core_kernel)) 5 | 6 | (plugin 7 | (name primus-greedy) 8 | (package bap-primus-greedy-scheduler) 9 | (libraries bap-primus-greedy-scheduler.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_limit/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_limit_plugin) 3 | (public_name bap-primus-limit.plugin) 4 | (libraries bap bap-primus bap-future monads core_kernel regular)) 5 | 6 | (plugin 7 | (name primus-limit) 8 | (package bap-primus-limit) 9 | (libraries bap-primus-limit.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_limit/primus_limit_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/primus_limit/primus_limit_main.mli -------------------------------------------------------------------------------- /plugins/primus_lisp/lisp/core.lisp: -------------------------------------------------------------------------------- 1 | ;; defines the core of the Primus Lisp language 2 | ;; required automatically by the primus-lisp program loader 3 | (require init) 4 | (require pointers) 5 | (require memory) 6 | -------------------------------------------------------------------------------- /plugins/primus_lisp/lisp/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files core.lisp init.lisp memory.lisp pointers.lisp) 3 | (package bap-primus-lisp) 4 | (section (site (bap-common lisp)))) 5 | -------------------------------------------------------------------------------- /plugins/primus_lisp/primus_lisp_config.ml.ab: -------------------------------------------------------------------------------- 1 | module Sites = struct 2 | let lisp = [${site_lisp}] 3 | let site_lisp = [${site_site_lisp}] 4 | let semantics = [${site_semantics}] 5 | end 6 | -------------------------------------------------------------------------------- /plugins/primus_lisp/primus_lisp_documentation.mli: -------------------------------------------------------------------------------- 1 | open Bap_primus.Std 2 | 3 | val print : string option -> Primus.Lisp.Doc.index -> unit 4 | -------------------------------------------------------------------------------- /plugins/primus_lisp/primus_lisp_ieee754.mli: -------------------------------------------------------------------------------- 1 | val init : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/primus_lisp/primus_lisp_io.mli: -------------------------------------------------------------------------------- 1 | val standard_channels : string list 2 | 3 | val init : (string * string) list -> unit 4 | -------------------------------------------------------------------------------- /plugins/primus_lisp/primus_lisp_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/primus_lisp/primus_lisp_main.mli -------------------------------------------------------------------------------- /plugins/primus_lisp/primus_lisp_primitives.mli: -------------------------------------------------------------------------------- 1 | val init : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/primus_lisp/primus_lisp_semantic_primitives.mli: -------------------------------------------------------------------------------- 1 | val provide : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/primus_lisp/semantics/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/primus_lisp/semantics/.gitignore -------------------------------------------------------------------------------- /plugins/primus_lisp/semantics/dummy.lisp: -------------------------------------------------------------------------------- 1 | ;; a dummy file to prevent build and install scripts from failing 2 | ;; will remove it in the future 3 | -------------------------------------------------------------------------------- /plugins/primus_lisp/semantics/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files bits.lisp dummy.lisp ieee754.lisp) 3 | (package bap-primus-lisp) 4 | (section (site (bap-common semantics)))) 5 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/char.lisp: -------------------------------------------------------------------------------- 1 | (in-package posix) 2 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/errno.lisp: -------------------------------------------------------------------------------- 1 | (in-package posix) 2 | (declare (visibility :private)) 3 | 4 | (require posix) 5 | (require types) 6 | 7 | (declare (static errno-location)) 8 | 9 | (defmethod init () 10 | (set errno-location brk) 11 | (+= brk (sizeof int))) 12 | 13 | (defun errno-location () 14 | (declare (visibility :public) 15 | (external "__errno_location")) 16 | errno-location) 17 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/floats.lisp: -------------------------------------------------------------------------------- 1 | (require llvm-x86-64-floats) 2 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/libintl.lisp: -------------------------------------------------------------------------------- 1 | (in-package posix) 2 | 3 | (defun bindtextdomain (_ dir) 4 | (declare (external "bindtextdomain")) 5 | dir) 6 | 7 | (defun textdomain (dom) 8 | (declare (external "textdomain")) 9 | dom) 10 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/limit-malloc.lisp: -------------------------------------------------------------------------------- 1 | ;; up to 4 Mb each chunk, up to 128 Mbytes total 2 | (in-package posix) 3 | 4 | (defmethod init () 5 | (set *malloc-max-chunk-size* (* 4 1024 1024)) 6 | (set *malloc-guard-edges* 0) 7 | (set *malloc-max-arena-size* (* 32 *malloc-max-chunk-size*)) 8 | (set *malloc-arena-start* brk) 9 | (set *malloc-zero-sentinel* 0)) 10 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/locale.lisp: -------------------------------------------------------------------------------- 1 | (in-package posix) 2 | 3 | (require types) 4 | 5 | (defparameter *lconv-size* (* 20 (sizeof ptr_t))) 6 | 7 | (declare (static LCONV)) 8 | 9 | (defmethod init () 10 | (set LCONV brk) 11 | (+= brk *lconv-size*)) 12 | 13 | (defun setlocale (_ locale) 14 | (declare (external "setlocale")) 15 | locale) 16 | 17 | (defun lconv () 18 | (declare (external "lconv")) 19 | LCONV) 20 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/memory-allocator.lisp: -------------------------------------------------------------------------------- 1 | ;; how to provide an extensible dispatch hook? 2 | ;; 3 | ;; - the require declaration should be also overridable 4 | 5 | ;; the default memory allocator 6 | (require simple-memory-allocator) 7 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/posix.lisp: -------------------------------------------------------------------------------- 1 | (require stdlib) 2 | (require stdio) 3 | (require string) 4 | (require errno) 5 | (require ascii) 6 | (require locale) 7 | (require libintl) 8 | (require unistd) 9 | (require setjmp) 10 | (require getopt) 11 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/setjmp.lisp: -------------------------------------------------------------------------------- 1 | (in-package posix) 2 | 3 | (defun setjmp (_) 4 | (declare (external "setjmp" "_setjmp")) 5 | 0) 6 | 7 | (defun sigsetjmp (_ _) 8 | (declare (external "sigsetjmp" "_sigsetjmp")) 9 | 0) 10 | 11 | (defun longjmp (_ _) 12 | (declare (external "longjmp" "_longjmp" "siglongjmp" "_siglongjmp")) 13 | (exit 1)) 14 | -------------------------------------------------------------------------------- /plugins/primus_lisp/site-lisp/unistd.lisp: -------------------------------------------------------------------------------- 1 | (in-package posix) 2 | 3 | (defun isatty (fd) 4 | (declare (external "isatty")) 5 | (< fd 3)) 6 | 7 | (defun ioctl (_ _) (declare (external "ioctl")) 0) 8 | (defun ioctl (_ _ _) (declare (external "ioctl")) 0) 9 | (defun ioctl (_ _ _ _) (declare (external "ioctl")) 0) 10 | (defun ioctl (_ _ _ _ _) (declare (external "ioctl")) 0) 11 | (defun ioctl (_ _ _ _ _ _) (declare (external "ioctl")) 0) 12 | 13 | (defun getpagesize () 14 | (declare (external "getpagesize")) 15 | (* 64 1024)) 16 | -------------------------------------------------------------------------------- /plugins/primus_loader/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_loader_plugin) 3 | (public_name bap-primus-loader.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-core-theory bap-primus monads core_kernel ogre)) 6 | 7 | (plugin 8 | (name primus-loader) 9 | (package bap-primus-loader) 10 | (libraries bap-primus-loader.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/primus_mark_visited/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_mark_visited_plugin) 3 | (public_name bap-primus-mark-visited.plugin) 4 | (libraries bap bap-core-theory bap-main bap-primus-track-visited)) 5 | 6 | (plugin 7 | (name primus-mark-visited) 8 | (package bap-primus-mark-visited) 9 | (libraries bap-primus-mark-visited.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_powerpc/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_powerpc_plugin) 3 | (public_name bap-primus-powerpc.plugin) 4 | (libraries bap bap-primus core_kernel)) 5 | 6 | (plugin 7 | (name primus-powerpc) 8 | (package bap-primus-powerpc) 9 | (libraries bap-primus-powerpc.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_print/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_print_plugin) 3 | (public_name bap-primus-print.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-future 9 | bap-knowledge 10 | bap-primus 11 | bare 12 | core_kernel 13 | monads)) 14 | 15 | (plugin 16 | (name primus-print) 17 | (package bap-primus-print) 18 | (libraries bap-primus-print.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/primus_promiscuous/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_promiscuous_plugin) 3 | (public_name bap-primus-promiscuous.plugin) 4 | (libraries bap bap-primus core_kernel monads)) 5 | 6 | (plugin 7 | (name primus-promiscuous) 8 | (package bap-primus-promiscuous) 9 | (libraries bap-primus-promiscuous.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_propagate_taint/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_propagate_taint_plugin) 3 | (public_name bap-primus-propagate-taint.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-future 9 | bap-knowledge 10 | bap-microx 11 | bap-primus 12 | bap-taint 13 | core_kernel 14 | graphlib 15 | monads 16 | regular)) 17 | 18 | (plugin 19 | (name primus-propagate-taint) 20 | (package bap-primus-propagate-taint) 21 | (libraries bap-primus-propagate-taint.plugin) 22 | (site (bap-common plugins))) 23 | -------------------------------------------------------------------------------- /plugins/primus_random/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_random_plugin) 3 | (public_name bap-primus-random.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-main 8 | bap-primus 9 | bitvec 10 | bitvec-sexp 11 | core_kernel 12 | zarith 13 | bap-core-theory)) 14 | 15 | (plugin 16 | (name primus-random) 17 | (package bap-primus-random) 18 | (libraries bap-primus-random.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/primus_random/primus_random_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/primus_random/primus_random_main.mli -------------------------------------------------------------------------------- /plugins/primus_region/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_region_plugin) 3 | (public_name bap-primus-region.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-core-theory bap-primus monads core_kernel)) 6 | 7 | (plugin 8 | (name primus-region) 9 | (package bap-primus-region) 10 | (libraries bap-primus-region.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/primus_round_robin/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_round_robin_plugin) 3 | (public_name bap-primus-round-robin-scheduler.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-future bap-primus monads core_kernel)) 6 | 7 | (plugin 8 | (name primus-round-robin) 9 | (package bap-primus-round-robin-scheduler) 10 | (libraries bap-primus-round-robin-scheduler.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/primus_symbolic_executor/lisp/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files symbolic-stdio.lisp symbolic-stdlib.lisp) 3 | (package bap-primus-symbolic-executor) 4 | (section (site (bap-common site_lisp)))) 5 | -------------------------------------------------------------------------------- /plugins/primus_symbolic_executor/lisp/symbolic-stdlib.lisp: -------------------------------------------------------------------------------- 1 | (in-package posix) 2 | (declare (context (component bap:symbolic-computer))) 3 | -------------------------------------------------------------------------------- /plugins/primus_systems/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_systems_plugin) 3 | (public_name bap-primus-systems.plugin) 4 | (libraries bap-knowledge bap-main bap-primus core_kernel)) 5 | 6 | (plugin 7 | (name primus-systems) 8 | (package bap-primus-systems) 9 | (libraries bap-primus-systems.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_systems/primus_systems_config.ml.ab: -------------------------------------------------------------------------------- 1 | let path = "$primus_systems_path" 2 | -------------------------------------------------------------------------------- /plugins/primus_systems/systems/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files (core.asd as systems/core.asd)) 3 | (package bap-primus-systems) 4 | (section (site (bap-common primus)))) 5 | -------------------------------------------------------------------------------- /plugins/primus_taint/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_taint_plugin) 3 | (public_name bap-primus-taint.plugin) 4 | (libraries bap bap-primus bap-taint core_kernel regular monads)) 5 | 6 | (plugin 7 | (name primus-taint) 8 | (package bap-primus-taint) 9 | (libraries bap-primus-taint.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_taint/lisp/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files sensitive-sinks.lisp taint.lisp taint-sources.lisp) 3 | (package bap-primus-taint) 4 | (section (site (bap-common site_lisp)))) 5 | -------------------------------------------------------------------------------- /plugins/primus_taint/primus_taint_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/primus_taint/primus_taint_main.mli -------------------------------------------------------------------------------- /plugins/primus_taint/primus_taint_policies.mli: -------------------------------------------------------------------------------- 1 | val init : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/primus_test/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_test_plugin) 3 | (public_name bap-primus-test.plugin) 4 | (libraries 5 | bap 6 | bap-primus 7 | bitvec 8 | bitvec-order 9 | core_kernel 10 | monads 11 | regular 12 | zarith)) 13 | 14 | (plugin 15 | (name primus-test) 16 | (package bap-primus-test) 17 | (libraries bap-primus-test.plugin) 18 | (site (bap-common plugins))) 19 | -------------------------------------------------------------------------------- /plugins/primus_test/lisp/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files check-value.lisp 3 | incident.lisp 4 | memcheck.lisp 5 | memcheck-malloc.lisp 6 | warn-unused.lisp) 7 | (package bap-primus-test) 8 | (section (site (bap-common site_lisp)))) 9 | -------------------------------------------------------------------------------- /plugins/primus_wandering/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_wandering_plugin) 3 | (public_name bap-primus-wandering-scheduler.plugin) 4 | (libraries bap bap-future bap-primus core_kernel monads)) 5 | 6 | (plugin 7 | (name primus-wandering) 8 | (package bap-primus-wandering-scheduler) 9 | (libraries bap-primus-wandering-scheduler.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/primus_x86/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_primus_x86_plugin) 3 | (public_name bap-primus-x86.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-core-theory bap-primus bap-x86 regular)) 6 | 7 | (plugin 8 | (name primus-x86) 9 | (package bap-primus-x86) 10 | (libraries bap-primus-x86.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/primus_x86/primus_x86_loader.mli: -------------------------------------------------------------------------------- 1 | open Bap_primus.Std 2 | 3 | module InitializeRegisters : Primus.Machine.Component 4 | module SetupPLT : Primus.Machine.Component 5 | -------------------------------------------------------------------------------- /plugins/print/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name print) 3 | (public_name bap-print.plugin) 4 | (libraries 5 | bap 6 | bap-core-theory 7 | bap-demangle 8 | bap-knowledge 9 | core_kernel 10 | core_kernel.caml_unix 11 | graphlib 12 | ogre 13 | regular 14 | re.pcre 15 | text-tags)) 16 | 17 | (plugin 18 | (name print) 19 | (package bap-print) 20 | (libraries bap-print.plugin) 21 | (site (bap-common plugins))) 22 | -------------------------------------------------------------------------------- /plugins/propagate_taint/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_propagate_taint_plugin) 3 | (public_name bap-taint-propagator.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-core-theory 8 | bap-microx 9 | core_kernel 10 | graphlib 11 | monads 12 | regular)) 13 | 14 | (plugin 15 | (name propagate-taint) 16 | (package bap-taint-propagator) 17 | (libraries bap-taint-propagator.plugin) 18 | (site (bap-common plugins))) 19 | -------------------------------------------------------------------------------- /plugins/propagate_taint/propagate_taint_main.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /plugins/radare2/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (optional) 3 | (name bap_radare2_plugin) 4 | (public_name bap-radare2.plugin) 5 | (libraries 6 | bap 7 | bap-arm 8 | bap-core-theory 9 | bap-future 10 | bap-knowledge 11 | bap-relation 12 | bitvec 13 | core_kernel 14 | core_kernel.caml_unix 15 | regular 16 | re.pcre 17 | yojson 18 | zarith)) 19 | 20 | (plugin 21 | (optional) 22 | (name radare2) 23 | (package bap-radare2) 24 | (libraries bap-radare2.plugin) 25 | (site (bap-common plugins))) 26 | -------------------------------------------------------------------------------- /plugins/radare2/radare2_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/radare2/radare2_main.mli -------------------------------------------------------------------------------- /plugins/raw/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_raw_plugin) 3 | (public_name bap-raw.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-main bitvec 6 | core_kernel core_kernel.caml_unix ogre)) 7 | 8 | (plugin 9 | (name raw) 10 | (package bap-raw) 11 | (libraries bap-raw.plugin) 12 | (site (bap-common plugins))) 13 | -------------------------------------------------------------------------------- /plugins/raw/raw_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/raw/raw_main.mli -------------------------------------------------------------------------------- /plugins/read_symbols/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_read_symbols_plugin) 3 | (public_name bap-symbol-reader.plugin) 4 | (libraries 5 | bap-core-theory 6 | bap-knowledge 7 | bap-main 8 | bap-relation 9 | bitvec 10 | core_kernel)) 11 | 12 | (plugin 13 | (name read-symbols) 14 | (package bap-symbol-reader) 15 | (libraries bap-symbol-reader.plugin) 16 | (site (bap-common plugins))) 17 | -------------------------------------------------------------------------------- /plugins/recipe_command/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_recipe_command_plugin) 3 | (public_name bap-recipe-command.plugin) 4 | (libraries bap-recipe bap-main base)) 5 | 6 | (plugin 7 | (name recipe-command) 8 | (package bap-recipe-command) 9 | (libraries bap-recipe-command.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/recipe_command/recipe_command_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/recipe_command/recipe_command_main.mli -------------------------------------------------------------------------------- /plugins/relocatable/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_relocatable_plugin) 3 | (public_name bap-relocatable.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-arm 8 | bap-core-theory 9 | bap-knowledge 10 | bap-main 11 | bap-powerpc 12 | bap-x86 13 | bitvec 14 | bitvec-order 15 | bitvec-sexp 16 | core_kernel 17 | monads 18 | ogre)) 19 | 20 | (plugin 21 | (name relocatable) 22 | (package bap-relocatable) 23 | (libraries bap-relocatable.plugin) 24 | (site (bap-common plugins))) 25 | -------------------------------------------------------------------------------- /plugins/report/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_report_plugin) 3 | (public_name bap-report.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-future core_kernel core_kernel.caml_unix)) 6 | 7 | (plugin 8 | (name report) 9 | (package bap-report) 10 | (libraries bap-report.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/riscv/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_riscv_plugin) 3 | (public_name bap-riscv.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-abi 8 | bap-api 9 | bap-c 10 | bap-core-theory 11 | bap-knowledge 12 | bap-main 13 | bap-riscv 14 | core_kernel 15 | monads 16 | ogre)) 17 | 18 | (plugin 19 | (name riscv) 20 | (package bap-riscv) 21 | (libraries bap-riscv.plugin) 22 | (site (bap-common plugins))) 23 | -------------------------------------------------------------------------------- /plugins/riscv/riscv_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/riscv/riscv_main.mli -------------------------------------------------------------------------------- /plugins/riscv/semantics/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files riscv.lisp) 3 | (package bap-riscv) 4 | (section (site (bap-common semantics)))) 5 | -------------------------------------------------------------------------------- /plugins/run/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_run_plugin) 3 | (public_name bap-run.plugin) 4 | (libraries 5 | bap 6 | bap-core-theory 7 | bap-knowledge 8 | bap-primus 9 | core_kernel 10 | graphlib 11 | monads 12 | regular)) 13 | 14 | (plugin 15 | (name run) 16 | (package bap-run) 17 | (libraries bap-run.plugin) 18 | (site (bap-common plugins))) 19 | -------------------------------------------------------------------------------- /plugins/specification/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name specification) 3 | (public_name bap-specification.plugin) 4 | (libraries bap core_kernel bap-main ogre regular)) 5 | 6 | (plugin 7 | (name specification) 8 | (package bap-specification) 9 | (libraries bap-specification.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/ssa/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_ssa_plugin) 3 | (public_name bap-ssa.plugin) 4 | (libraries bap bap-main)) 5 | 6 | (plugin 7 | (name ssa) 8 | (package bap-ssa) 9 | (libraries bap-ssa.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/ssa/ssa_main.ml: -------------------------------------------------------------------------------- 1 | let provides = ["pass"; "analysis"; "ssa"] 2 | let doc = {| 3 | # DESCRIPTION 4 | 5 | Translates the whole program into the SSA form. 6 | 7 | ]|} 8 | 9 | open Bap.Std 10 | 11 | let main = Project.map_program ~f:(Term.map sub_t ~f:Sub.ssa) 12 | let () = Bap_main.Extension.declare ~doc ~provides @@ fun _ -> 13 | Project.register_pass main; 14 | Ok () 15 | -------------------------------------------------------------------------------- /plugins/strings/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_strings_plugin) 3 | (public_name bap-beagle-strings.plugin) 4 | (libraries bap bap-strings bap-beagle core_kernel regular)) 5 | 6 | (plugin 7 | (name strings) 8 | (package bap-beagle-strings) 9 | (libraries bap-beagle-strings.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/stub_resolver/signatures/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (files powerpc.stubs) 3 | (package bap-powerpc) 4 | (section (site (bap-common signatures)))) 5 | -------------------------------------------------------------------------------- /plugins/stub_resolver/signatures/powerpc.stubs: -------------------------------------------------------------------------------- 1 | ; a list of words that commonly start a stub, 2 | ; one per line, with `;' for comments. 3 | 4 | 0x3d601001 ; lis r11, 4097 5 | 0x3d601002 ; lis r11, 4098 6 | 0x3d601003 ; lis r11, 4099 7 | 0x3d601004 ; lis r11, 4100 8 | -------------------------------------------------------------------------------- /plugins/stub_resolver/stub_resolver_sites.ml.ab: -------------------------------------------------------------------------------- 1 | let paths = [${site_signatures}] -------------------------------------------------------------------------------- /plugins/systemz/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_systemz_plugin) 3 | (public_name bap-systemz.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap bap-core-theory bap-knowledge bap-main bap-systemz)) 6 | 7 | (plugin 8 | (name systemz) 9 | (package bap-systemz) 10 | (libraries bap-systemz.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/systemz/systemz_lifter.mli: -------------------------------------------------------------------------------- 1 | val load : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/systemz/systemz_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/systemz/systemz_main.mli -------------------------------------------------------------------------------- /plugins/taint/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_taint_plugin) 3 | (public_name bap-taint.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries bap core_kernel regular)) 6 | 7 | (plugin 8 | (name taint) 9 | (package bap-taint) 10 | (libraries bap-taint.plugin) 11 | (site (bap-common plugins))) 12 | -------------------------------------------------------------------------------- /plugins/thumb/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_thumb_plugin) 3 | (public_name bap-thumb.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-arm 8 | bap-core-theory 9 | bap-knowledge 10 | bap-main 11 | bitvec 12 | core_kernel 13 | ogre)) 14 | 15 | (plugin 16 | (name thumb) 17 | (package bap-thumb) 18 | (libraries bap-thumb.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/thumb/thumb_bits.ml: -------------------------------------------------------------------------------- 1 | open Bap_core_theory 2 | open Base 3 | open KB.Syntax 4 | open Thumb_core 5 | 6 | module Make(CT : Theory.Core) = struct 7 | open Thumb_core.Make(CT) 8 | open Syntax 9 | 10 | let sx s rd rm = 11 | rd <-? CT.signed s32 (CT.low s (var rm)) 12 | 13 | let ux s rd rm = 14 | rd <-? CT.unsigned s32 (CT.low s (var rm)) 15 | end 16 | -------------------------------------------------------------------------------- /plugins/thumb/thumb_bits.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory 2 | open Thumb_core 3 | open Thumb_opcodes 4 | 5 | module Make(_ : Theory.Core) : sig 6 | open Theory 7 | val sx : 'a Bitv.t Value.sort -> r32 reg -> _ reg -> cond -> unit eff 8 | val ux : 'a Bitv.t Value.sort -> r32 reg -> _ reg -> cond -> unit eff 9 | end 10 | -------------------------------------------------------------------------------- /plugins/thumb/thumb_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/plugins/thumb/thumb_main.mli -------------------------------------------------------------------------------- /plugins/trace/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_trace_plugin) 3 | (public_name bap-trace.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-future 8 | bap-plugins 9 | bap-traces 10 | core_kernel 11 | core_kernel.caml_unix 12 | regular 13 | uri)) 14 | 15 | (plugin 16 | (name trace) 17 | (package bap-trace) 18 | (libraries bap-trace.plugin) 19 | (site (bap-common plugins))) 20 | -------------------------------------------------------------------------------- /plugins/trivial_condition_form/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_trivial_condition_form_plugin) 3 | (public_name bap-trivial-condition-form.plugin) 4 | (libraries bap core_kernel)) 5 | 6 | (plugin 7 | (name trivial-condition-form) 8 | (package bap-trivial-condition-form) 9 | (libraries bap-trivial-condition-form.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/warn_unused/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bap_warn_unused_plugin) 3 | (public_name bap-warn-unused.plugin) 4 | (libraries bap core_kernel)) 5 | 6 | (plugin 7 | (name warn-unused) 8 | (package bap-warn-unused) 9 | (libraries bap-warn-unused.plugin) 10 | (site (bap-common plugins))) 11 | -------------------------------------------------------------------------------- /plugins/x86/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name x86) 3 | (public_name bap-x86.plugin) 4 | (preprocess (pps ppx_bap)) 5 | (libraries 6 | bap 7 | bap-abi 8 | bap-api 9 | bap-c 10 | bap-core-theory 11 | bap-future 12 | bap-knowledge 13 | bap-llvm 14 | bap-main 15 | bap-primus 16 | bap-x86 17 | bitvec 18 | core_kernel 19 | ogre 20 | str 21 | zarith)) 22 | 23 | (plugin 24 | (name x86) 25 | (package bap-x86) 26 | (libraries bap-x86.plugin) 27 | (site (bap-common plugins))) 28 | -------------------------------------------------------------------------------- /plugins/x86/patterns/cet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0xf30f1efa 0x55 4 | 5 | 6 | 7 | 8 | 0xf30f1efa 0x53 9 | 10 | 11 | 12 | 13 | 0xf30f1efa 0x415. 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /plugins/x86/patterns/patternconstraints.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | cet.xml 4 | 5 | 6 | -------------------------------------------------------------------------------- /plugins/x86/semantics/dune: -------------------------------------------------------------------------------- 1 | (install 2 | (section (site (bap-common semantics))) 3 | (package bap-x86) 4 | (files x86-32.lisp 5 | x86-64.lisp 6 | x86-64-sse-intrinsics.lisp 7 | x86-common.lisp)) 8 | 9 | (env 10 | (_ 11 | (binaries (%{workspace_root}/src/bap_frontend.exe as run)))) 12 | 13 | (cram 14 | (deps 15 | (package bap) 16 | (glob_files *.lisp) 17 | %{bin:run})) 18 | -------------------------------------------------------------------------------- /plugins/x86/semantics/x86-32.lisp: -------------------------------------------------------------------------------- 1 | (declare (context (target i386) (bits 32))) 2 | 3 | (require x86-common) 4 | (in-package x86-32) 5 | 6 | (defun pop (dst) 7 | (set$ dst (load-word ESP)) 8 | (+= ESP 4)) 9 | 10 | (defun POPA32 () 11 | (pop 'EDI) 12 | (pop 'ESI) 13 | (pop 'EBP) 14 | (+= ESP 4) 15 | (pop 'EBX) 16 | (pop 'EDX) 17 | (pop 'ECX) 18 | (pop 'EAX)) 19 | -------------------------------------------------------------------------------- /plugins/x86/x86_backend.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | type opcode = string 5 | 6 | module type S = sig 7 | val register : opcode -> lifter -> unit 8 | module Make (T : Target) : Target 9 | end 10 | 11 | module IA32 : S 12 | module AMD64 : S 13 | -------------------------------------------------------------------------------- /plugins/x86/x86_btx.mli: -------------------------------------------------------------------------------- 1 | (* BT, BTC, BTR, BTS instructions lifter *) 2 | -------------------------------------------------------------------------------- /plugins/x86/x86_cdq.mli: -------------------------------------------------------------------------------- 1 | (* CDQ, CDQE, CQO, CWD, CWDE, CBW lifter *) -------------------------------------------------------------------------------- /plugins/x86/x86_cmpxchg.mli: -------------------------------------------------------------------------------- 1 | (** CMPXCHG instruction lifter *) 2 | 3 | -------------------------------------------------------------------------------- /plugins/x86/x86_disasm.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open X86_types 4 | 5 | val parse_instr: mode -> mem -> addr -> int list * prefix * opcode * addr 6 | 7 | val parse_prefixes: mode -> int list -> opcode -> var option * int List.t 8 | -------------------------------------------------------------------------------- /plugins/x86/x86_legacy_bil.ml: -------------------------------------------------------------------------------- 1 | module Ast = X86_legacy_bil_ast 2 | module Type = X86_legacy_bil_type 3 | module Var = X86_legacy_bil_var 4 | -------------------------------------------------------------------------------- /plugins/x86/x86_legacy_bil_lifter.mli: -------------------------------------------------------------------------------- 1 | val init : unit -> unit 2 | -------------------------------------------------------------------------------- /plugins/x86/x86_legacy_bil_semantics.mli: -------------------------------------------------------------------------------- 1 | open Bap_core_theory 2 | 3 | type exp = X86_legacy_bil.Ast.exp 4 | 5 | module Binary : sig 6 | val fextract : 7 | ?bias:exp -> Theory.IEEE754.parameters -> exp -> hi:int -> lo:int -> exp 8 | val unbiased_exponent : Theory.IEEE754.parameters -> exp -> exp 9 | val fraction : Theory.IEEE754.parameters -> exp -> exp 10 | val sign : Theory.IEEE754.parameters -> exp -> exp 11 | val is_nan : Theory.IEEE754.parameters -> exp -> exp 12 | val mk_nan : Theory.IEEE754.parameters -> exp -> exp 13 | end 14 | 15 | val init : unit -> unit 16 | -------------------------------------------------------------------------------- /plugins/x86/x86_legacy_fp_lifter.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | module Bil = X86_legacy_bil 4 | module MC = Disasm_expert.Basic 5 | 6 | 7 | val run : Arch.x86 -> mem -> MC.full_insn -> Bil.Ast.program Or_error.t 8 | -------------------------------------------------------------------------------- /plugins/x86/x86_lifter.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | module IA32 : sig 5 | module CPU : CPU 6 | val lift : lifter 7 | end 8 | 9 | module AMD64 : sig 10 | module CPU : CPU 11 | val lift : lifter 12 | end 13 | -------------------------------------------------------------------------------- /plugins/x86/x86_mov.mli: -------------------------------------------------------------------------------- 1 | (** MOV instruction lifter *) 2 | 3 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_cdq.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type cdq = [ 4 | | `CBW 5 | | `CWD 6 | | `CWDE 7 | | `CDQ 8 | | `CDQE 9 | | `CQO 10 | ] [@@deriving bin_io, sexp, compare, enumerate] 11 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_cmps.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type cmps = [ 4 | | `CMPS8 5 | | `CMPS16 6 | | `CMPS32 7 | | `CMPS64 8 | ] [@@deriving bin_io, sexp, compare, enumerate] 9 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_ins.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type ins = [ 4 | | `IN8 5 | | `IN16 6 | | `IN32 7 | ] [@@deriving bin_io, sexp, compare, enumerate] 8 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_lods.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type lods = [ 4 | | `LODSB 5 | | `LODSW 6 | | `LODSD 7 | | `LODSQ 8 | ] [@@deriving bin_io, sexp, compare, enumerate] 9 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_movs.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type movs = [ 4 | | `MOVSB 5 | | `MOVSW 6 | | `MOVSD 7 | | `MOVSQ 8 | ] [@@deriving bin_io, sexp, compare, enumerate] 9 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_outs.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type outs = [ 4 | | `OUTSB 5 | | `OUTSW 6 | | `OUTSD 7 | ] [@@deriving bin_io, sexp, compare, enumerate] 8 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_scas.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type scas = [ 4 | | `SCAS8 5 | | `SCAS16 6 | | `SCAS32 7 | | `SCAS64 8 | ] [@@deriving bin_io, sexp, compare, enumerate] 9 | -------------------------------------------------------------------------------- /plugins/x86/x86_opcode_stos.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | 3 | type stos = [ 4 | | `STOSB 5 | | `STOSW 6 | | `STOSD 7 | | `STOSQ 8 | ] [@@deriving bin_io, sexp, compare, enumerate] 9 | -------------------------------------------------------------------------------- /plugins/x86/x86_targets.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | (** IA32 target *) 5 | module IA32 : Target 6 | 7 | (** AMD64 target *) 8 | module AMD64 : Target 9 | 10 | 11 | (** IA32 legacy target *) 12 | module IA32L : Target 13 | 14 | (** AMD64 legacy target *) 15 | module AMD64L : Target 16 | 17 | (** IA32 target has been merged with legacy lifter *) 18 | module IA32M : Target 19 | 20 | (** AMD64 target has been merged with legacy lifter *) 21 | module AMD64M : Target 22 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | module type S = X86_tools_types.S 5 | 6 | module IA32 : S 7 | module AMD64 : S 8 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_flags.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open X86_tools_types 4 | 5 | module Make(CPU : X86CPU) : FR 6 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_imm.ml: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | 4 | type t = imm 5 | 6 | let of_imm imm = imm 7 | 8 | let get ~width t = 9 | Imm.to_word t ~width:(Size.in_bits width) |> 10 | fun x -> Bil.int (Option.value_exn x) 11 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_imm.mli: -------------------------------------------------------------------------------- 1 | include X86_tools_types.IM 2 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_mem.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open X86_tools_types 4 | 5 | module Make (CPU : X86CPU) (RR : RR) (IM : IM) : MM 6 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_prefix.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open X86_tools_types 4 | 5 | module Make (RR : RR) (FR : FR) (IV : IV) : PR 6 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_reg.mli: -------------------------------------------------------------------------------- 1 | open Core_kernel[@@warning "-D"] 2 | open Bap.Std 3 | open X86_tools_types 4 | 5 | module Make(CPU : X86CPU) : RR 6 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_vector.ml: -------------------------------------------------------------------------------- 1 | open Bap.Std 2 | 3 | type t = X86_tools_types.interrupt_vector 4 | 5 | let to_int = function 6 | | `DE -> 0 7 | | `DB -> 1 8 | | `NMI -> 2 9 | | `BP -> 3 10 | | `OF -> 4 11 | | `BR -> 5 12 | | `UD -> 6 13 | | `NM -> 7 14 | | `DF -> 8 15 | | `TS -> 10 16 | | `NP -> 11 17 | | `SS -> 12 18 | | `GP -> 13 19 | | `PF -> 14 20 | | `MF -> 16 21 | | `AC -> 17 22 | | `MC -> 18 23 | | `XF -> 19 24 | | `SX -> 30 25 | | `INTR v -> v 26 | | `SOFTWARE v -> v 27 | 28 | -------------------------------------------------------------------------------- /plugins/x86/x86_tools_vector.mli: -------------------------------------------------------------------------------- 1 | include X86_tools_types.IV 2 | -------------------------------------------------------------------------------- /setup.ml.pre.in: -------------------------------------------------------------------------------- 1 | module Pervasives = Stdlib 2 | -------------------------------------------------------------------------------- /src/bap_byteweight_main.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/src/bap_byteweight_main.mli -------------------------------------------------------------------------------- /src/bap_frontend.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/src/bap_frontend.mli -------------------------------------------------------------------------------- /src/bap_mc.ml: -------------------------------------------------------------------------------- 1 | 2 | let () = 3 | let args = Array.of_list @@ match Array.to_list Sys.argv with 4 | | [] | [_] -> ["bap"; "mc"] 5 | | _ :: args -> "bap" :: "mc" :: args in 6 | Unix.execvp "bap" args 7 | -------------------------------------------------------------------------------- /src/bap_mc.mli: -------------------------------------------------------------------------------- 1 | (* bap-mc disassembler *) 2 | -------------------------------------------------------------------------------- /src/baptop.ml: -------------------------------------------------------------------------------- 1 | let main () = 2 | UTop.require ["bap.top"]; 3 | UTop_main.main () 4 | 5 | 6 | let () = 7 | try main () with 8 | Symtable.Error err -> 9 | Format.eprintf "Internal error: %a@." Symtable.report_error err; 10 | exit 1 11 | -------------------------------------------------------------------------------- /tools/bap_config.ab: -------------------------------------------------------------------------------- 1 | PLUGINS_DIR="$plugindir" 2 | DATA_DIR="$datadir/bap" 3 | OS="$system" 4 | -------------------------------------------------------------------------------- /tools/bapbuild.ml: -------------------------------------------------------------------------------- 1 | open Ocamlbuild_plugin 2 | open Bap_build.Std 3 | 4 | 5 | let main () = 6 | Plugin_options.set (); 7 | Ocamlbuild_plugin.dispatch (function 8 | | Before_rules -> Plugin_rules.install () 9 | | _ -> ()); 10 | Ocamlbuild_unix_plugin.setup (); 11 | Ocamlbuild_pack.Main.main () 12 | 13 | let () = main () 14 | -------------------------------------------------------------------------------- /tools/bapbundle.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/14b129c67d307a8fe7de9fd3eebacb3ceeb07837/tools/bapbundle.mli -------------------------------------------------------------------------------- /tools/baptop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec utop-full -ppx ppx-bap -short-paths -require "ppx_jane,bap.top" "$@" 3 | -------------------------------------------------------------------------------- /tools/cat.mli: -------------------------------------------------------------------------------- 1 | (** a fat cat on steroids - utility that concatenates files *) 2 | -------------------------------------------------------------------------------- /tools/collect.ml: -------------------------------------------------------------------------------- 1 | let () = match Array.to_list Sys.argv with 2 | | _ :: ext :: features -> features |> List.iter (fun feature -> 3 | let file = feature ^ "." ^ ext ^ ".in" in 4 | if Sys.file_exists file then print_endline file) 5 | | _ -> failwith "Usage: collect extension features..." 6 | -------------------------------------------------------------------------------- /tools/configure.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | Arg.write_arg "config.status.in" @@ 3 | Array.sub Sys.argv 1 (Array.length Sys.argv - 1) 4 | -------------------------------------------------------------------------------- /tools/ocp-indent-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # a regex for files to indent 4 | files_to_indent='.*\.\(ml\|mli\|mll\|mly\)$' 5 | 6 | VERSION=$(ocp-indent --version) 7 | 8 | if [ -z $VERSION ]; then 9 | echo "Please install ocp-indent" 10 | exit 1 11 | else 12 | echo "Reindenting with ocp-indent $VERSION" 13 | fi 14 | 15 | git ls-files | grep -e $files_to_indent | while read file 16 | do 17 | ocp-indent -i $file 18 | done 19 | -------------------------------------------------------------------------------- /tools/ppx-bap: -------------------------------------------------------------------------------- 1 | ppx-jane -as-ppx -inline-test-lib bap $@ -------------------------------------------------------------------------------- /tools/rewrite.mli: -------------------------------------------------------------------------------- 1 | (* rewrites configuration variables *) 2 | --------------------------------------------------------------------------------