Skip to content

Commit 2d70578

Browse files
author
@
committed
add v8
1 parent 41d81c2 commit 2d70578

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

frida-agent-example/agent/ios/lua.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

2-
export function create_luaL_loadbuffer(loadL_bufferPtr:NativePointer):NativeFunction{
2+
export function createFunc_luaL_loadbuffer(loadL_bufferPtr:NativePointer):NativeFunction{
33
var luaL_loadbuffer=new NativeFunction(loadL_bufferPtr,"int",["pointer","pointer","size_t","pointer"])
44
return luaL_loadbuffer
55
}
6-
export function create_luaL_lua_pcall(lua_pcallPtr:NativePointer):NativeFunction{
6+
export function createFunc_luaL_lua_pcall(lua_pcallPtr:NativePointer):NativeFunction{
77
var lua_pcall=new NativeFunction(lua_pcallPtr,"int",["pointer","int","int","int"])
88
return lua_pcall
99
}
10-
export function dumpLuaScript(loadL_bufferPtr:NativePointer){
10+
export function dump_luaL_loadbuffer(loadL_bufferPtr:NativePointer){
1111
Interceptor.attach(loadL_bufferPtr,{
1212
onEnter:function (args) {
1313
// console.log(args[2].readCString(args[3].toInt32()))
@@ -26,7 +26,7 @@ export function dumpLuaScript(loadL_bufferPtr:NativePointer){
2626
}
2727
})
2828
}
29-
export function hookLuaScript(loadL_bufferPtr:NativePointer,callback:(scriptName:String,scriptStrBuffer:String,scriptBuffer:ArrayBuffer)=>void){
29+
export function hook_luaL_loadbuffer(loadL_bufferPtr:NativePointer,callback:(scriptName:String,scriptStrBuffer:String,scriptBuffer:ArrayBuffer)=>void){
3030
Interceptor.attach(loadL_bufferPtr,{
3131
onEnter:function (args) {
3232
// console.log(args[2].readCString(args[3].toInt32()))
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
export function dump_ScriptEngine_evalString(ScriptEngineEvalStringPtr:NativePointer){
2+
Interceptor.attach(ScriptEngineEvalStringPtr,{
3+
onEnter:function (args) {
4+
// console.log(args[2].readCString(args[3].toInt32()))
5+
var script=args[1].readCString(args[2].toInt32())
6+
if(args[4].toInt32()!=0x00){
7+
var scriptFileName=args[4].readCString()
8+
console.log(scriptFileName)
9+
send({"type":"download","path":scriptFileName,"append":false},args[1].readByteArray(args[2].toInt32()))
10+
}else{
11+
console.log(script)
12+
}
13+
14+
},
15+
onLeave:function (r) {
16+
17+
}
18+
})
19+
}
20+
export function hook_ScriptEngine_evalString(ScriptEngineEvalStringPtr:NativePointer,callback:(scriptName:String,scriptStrBuffer:String,scriptBuffer:ArrayBuffer)=>void){
21+
Interceptor.attach(ScriptEngineEvalStringPtr,{
22+
onEnter:function (args) {
23+
// console.log(args[2].readCString(args[3].toInt32()))
24+
var script=args[1].readCString(args[2].toInt32())
25+
if(args[4].toInt32()!=0x00){
26+
var scriptFileName=args[4].readCString()
27+
if(scriptFileName==null){
28+
scriptFileName=""
29+
}
30+
callback(scriptFileName,script!,args[1].readByteArray(args[2].toInt32())!)
31+
}else{
32+
callback("",script!,args[1].readByteArray(args[2].toInt32())!)
33+
}
34+
35+
},
36+
onLeave:function (r) {
37+
38+
}
39+
})
40+
}

0 commit comments

Comments
 (0)