Module Modify

module Modify: sig .. end
This module provides utility functions for modifying a DEX binary.


Utilities


val seed_addr : int -> unit
set the start address for fresh ones

Modification


val new_str : Dex.dex -> string -> Dex.link
add a new string
val replace_str : Dex.dex -> string -> string -> bool
replace old string with new one; true if replaced, false if newly added
val report_str_repl_cnt : unit -> unit
report string replacement counts
val new_ty : Dex.dex -> string -> Dex.link
add a new type
val new_class : Dex.dex -> ?super:string -> string -> Dex.access_flag list -> Dex.link
add a new class definition; pass superclass name, its name, and Dex.access_flags
val make_class_overridable : Dex.dex -> Dex.link -> unit
rip off the final qualifier on Dex.class_def_item
val add_interface : Dex.dex -> Dex.link -> string -> unit
add an interface to a class.
val new_field : Dex.dex -> Dex.link -> string -> Dex.access_flag list -> string -> Dex.link
add a new field definition; pass class id, its name, Dex.access_flags, and type
val new_method : Dex.dex ->
Dex.link ->
string -> Dex.access_flag list -> string -> string list -> Dex.link
add a new method definition; pass class id, its name, Dex.access_flags, return type, and arguments
val make_method_overridable : Dex.dex -> Dex.link -> Dex.link -> unit
rip off the final qualifer on Dex.encoded_method
type cursor 
instruction inserting point
val prev : cursor -> cursor
previous instruction
val next : cursor -> cursor
next instruction
val get_fst_ins : Dex.dex -> Dex.code_item -> Instr.instr
get the first Instr.instr
val insrt_ins : Dex.dex -> Dex.code_item -> cursor -> Instr.instr -> cursor
insert an instruction at Modify.cursor point; Modify.cursor would be advanced
val rm_ins : Dex.dex -> Dex.code_item -> cursor -> cursor
remove an instruction at Modify.cursor point; Modify.cursor would remain as same
val insrt_insns : Dex.dex ->
Dex.code_item -> cursor -> Instr.instr list -> cursor
insert instructions at Modify.cursor point: Modify.cursor will be advanced
val insrt_insns_before_start : Dex.dex -> Dex.code_item -> Instr.instr list -> cursor
insert instructions before the start of some Dex.code_item
val insrt_insns_after_start : Dex.dex -> Dex.code_item -> Instr.instr list -> cursor
insert instructions after the start of some Dex.code_item
val insrt_insns_before_end : Dex.dex -> Dex.code_item -> Instr.instr list -> cursor
insert instructions before the end of some Dex.code_item
val insrt_insns_after_end : Dex.dex -> Dex.code_item -> Instr.instr list -> cursor
insert instructions after the end of some Dex.code_item
val insrt_return_void : Dex.dex -> Dex.link -> string -> unit
insert Instr.rv at the end of the method
val update_reg_usage : Dex.dex -> Dex.code_item -> unit
update register usage: registers_size and outs_size
val implements : Dex.dex -> Dex.link -> Dex.link -> string -> bool
true, adding an abstract method if given class doesn't implement it
val override : Dex.dex -> Dex.link -> string -> bool
true, adding an overriding method if given class doesn't override it

Application


val subst_cls : Dex.dex -> string list -> string list -> unit
substitute the given class usage into the new one
val discard_cls : Dex.dex -> string list -> unit
discard anythings related to specific classes
val call_trace : Dex.dex -> string list -> unit
trace call stack by modifying methods of specific classes in the dex
val hello : unit -> Dex.dex
API test

Web Accessibility