package bap-std
Input information.
This module abstracts the input data necessary to create a project.
type t = input
val load :
?target:Bap_core_theory.Theory.Target.t ->
?loader:string ->
string ->
t
load filename
loads the file from the specified path. The file must be regular (i.e., not a pipe) and is expected to have the necessary meta information, i.e., not the raw code (use raw_file
to load files that are raw code).
If loader
is not specified then all image loaders are used and the information from the is merged, otherwise only the selected loaded is used. See Image.available_backend
.
The target
could be used to specialize the target information retrieved from the file. If it is less specific, then it will be ignored, if it contradicts the information in the file then the project creation will fail.
val raw_file : ?base:addr -> Bap_core_theory.Theory.Target.t -> string -> t
raw_file ?base target ~filename
creates an input from a binary file that is raw code for the given target
, i.e., without any headers or meta information.
val from_string : ?base:addr -> Bap_core_theory.Theory.Target.t -> string -> t
create ?base target code
creates input from the binary code
for the given target
.
val from_bigstring :
?base:addr ->
Bap_core_theory.Theory.Target.t ->
Core_kernel.Bigstring.t ->
t
create ?base target code
creates input from the binary code
for the given target
.
val custom :
?finish:(project -> project) ->
?filename:string ->
?code:value memmap ->
?data:value memmap ->
Bap_core_theory.Theory.Target.t ->
t
custom target
creates a custom input.
The target
parameter denotes the target system of the input program. The code
and data
parameters are stored in the Project.memory
and code
is disassembled and lifted if the specified target
has a disassembler and lifter.
The filename
is used to communicate with external tools and will be broadcasted via Info.file
stream and stored in the filename property of the project, otherwise it is not used when the project is created.
The finish project
is the post-constructor that takes the nearly finished project (with code and data and potentially disassembled and lifted code) and constructs the final project.
val register_loader : string -> (string -> t) -> unit
register_loader name load
register a loader under provided name
. The load
function will be called the filename, and it must return the input
value.
available_loaders ()
returns a list of names of currently known loaders.
Deprecated Interface
The following functions are deprecated and better alternatives are provided. They might be removed in BAP 3.0.
binary ?base arch ~filename
create an input from a binary file that is a pure code without any headers or meta information.
val file : ?loader:string -> filename:string -> t
file ?target ?loader ~filename
input data from a file, using the specified loader. If loader
is not specified, then some existing loader will be used. If it is specified, then it is first looked up in the available_loaders
and if it is not found, then it will be looked up in the Image.available_backends
.
val create :
?finish:(project -> project) ->
arch ->
string ->
code:value memmap ->
data:value memmap ->
t
create arch filename ~code ~data
creates an input from a file, using two memory maps. The code
memmap spans the code in the file, and data
spans the data. An optional finish
function can be used to propagate to the project any additional information that is available to the loader. It defaults to ident
.