Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var test = false;
- Interceptor.attach(Module.findExportByName("libc.so", "open"), {
- onEnter: function() {
- var what = Memory.readUtf8String(this.context.x0);
- if (what.indexOf("libnative.so") >= 0) {
- test = true;
- }
- },
- onLeave: function(ret) {
- if (test) {
- test = false;
- var symb = Module.enumerateSymbolsSync("linker64");
- var prelink_image = null;
- var baseaddr = null;
- for (var sym in symb) {
- if (symb[sym].name.indexOf("phdr_table_get_dynamic_section") >= 0) {
- console.log("SYMBOL NAME = " + symb[sym].name)
- prelink_image = symb[sym].address
- }
- }
- if(prelink_image != null)
- {
- Interceptor.attach(prelink_image, function() {
- //console.log(JSON.stringify(this.context))
- var x2_load_bias = parseInt(this.context.x2.toString(), "16");
- var _init_offset = 0x15a8
- var _init = x2_load_bias + _init_offset;
- Interceptor.attach(ptr(_init), {
- onEnter: function(args){
- console.log("Calling global constructor")
- },
- onLeave: function(retval){
- }
- });
- });
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement