package binsec

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

DBA hunks, aka dhunk

DBA blocks
type t

A DBA block represents a set of DBA instructions with explicit links to the next one. The first instruction of the block always has id 0. Typically, DBA a block is the translation of one binary/assembly instruction.

module Node : sig ... end
val empty : t

The one and only empty DBA hunk. Get it here!

val stop : t

A simple dhunk of one instruction stopping with an OK Dba.state

val is_empty : t -> bool
val init : int -> (int -> Dba.Instr.t) -> t
val singleton : Dba.Instr.t -> t
val goto : Virtual_address.t -> t

A simple dhunk of one instruction jumping to the virtual address.

val length : t -> int
val node : t -> int -> Node.t option
val inst : t -> int -> Dba.Instr.t option
val start : t -> Node.t

start b is the first index of block b

val copy : t -> t
val iter : f:(Dba.Instr.t -> unit) -> t -> unit
val iteri : f:(int -> Dba.Instr.t -> unit) -> t -> unit
val of_list : Dba.Instr.t list -> t

of_list l assumes the list is sorted in increasing order inside the block

val of_labelled_list : (int * Dba.Instr.t) list -> t

of_list l assumes the list is sorted in increasing order inside the block, i.e. the labels are contiguous starting from 0.

val mapi : f:(int -> Dba.Instr.t -> Dba.Instr.t) -> t -> t
val flatten : t -> (int * Dba.Instr.t) list
val to_list : t -> Dba.Instr.t list
val fold : ('a -> Dba.Instr.t -> 'a) -> 'a -> t -> 'a
val for_all : (Dba.Instr.t -> bool) -> t -> bool
val export_and_view : ?cmd:string -> t -> unit

view dh Visualize dot-rendered DBA hunk dh using cmd.

Default value for cmd is firefox.

val pred : t -> Node.t -> Node.t list
val succ : t -> Node.t -> Node.t list
include Sigs.PRINTABLE with type t := t
val pp : Stdlib.Format.formatter -> t -> unit
Dhunk properties
module Check : sig ... end
module Simplify : sig ... end
val to_stmts : t -> Virtual_address.t -> Dba_types.Statement.t list
val outer_jumps : t -> Virtual_address.Set.t

outer_jumps b computes the set of jumps to external addresses in hunk b. Due to dynamic jumps, this represents a syntactic under-approximation of the possible jumps from this block.

val callees : t -> Virtual_address.Set.t

callees b computes the set of addresses this block may call

val is_return : t -> bool

is_return d check if dhunk d encodes a return

val has_indirect_jump : t -> bool

has_indirect_jump d returns true if the hunk contains an indirect jump instruction

type conditional = {
  1. condition : Dba.Expr.t;
  2. consequent : Virtual_address.t;
  3. alternative : Virtual_address.t;
}
val conditional : t -> conditional option
OCaml

Innovation. Community. Security.