MCPcopy Create free account
hub / github.com/axhlzy/FridaDebugger / callFunction

Function callFunction

agent/function-call.ts:13–26  ·  view source on GitHub ↗
(addressInput: FunctionCallInput, ...args: FunctionCallInput[])

Source from the content-addressed store, hash-verified

11export type FunctionCallInput = PointerInput | CallableNativeFunction;
12
13export function callFunction(addressInput: FunctionCallInput, ...args: FunctionCallInput[]): NativePointer | null {
14 try {
15 const address = toCallPointer(addressInput);
16 const nativeArgs = args.map(arg => toCallPointer(arg));
17 const fn = new NativeFunction(address, "pointer", nativeArgs.map(() => "pointer")) as unknown as (...callArgs: NativePointer[]) => NativePointer;
18 const result = fn(...nativeArgs);
19 const resolved = resolveAddress(result);
20 log(`[call] ${address}(${nativeArgs.join(", ")}) => ${result}${resolved.length > 0 ? ` ${resolved}` : ""}`, "green");
21 return result;
22 } catch (error) {
23 log(`[call] failed: ${String(error)}`, "red");
24 return null;
25 }
26}
27
28export function createCallableFunction(address: NativePointer): CallableNativeFunction {
29 const callable = ((...args: FunctionCallInput[]) => callFunction(address, ...args)) as CallableNativeFunction;

Callers 2

index.tsFile · 0.85
createCallableFunctionFunction · 0.85

Calls 3

toCallPointerFunction · 0.85
resolveAddressFunction · 0.85
logFunction · 0.85

Tested by

no test coverage detected