- Frida Javascript api #Frida #Scr
- Frida Javascript api #NativePoin
- Frida Javascript api #NativeFunc
- Frida Javascript api #Intercepto
- Frida Javascript api #ApiResolve
- Frida Javascript api #IOStream #
- Frida Javascript api #Global (中文
- Frida Javascript api #Console 与
- Frida Javascript api #Thread #In
- Frida Javascript api #Java 与 #We
原文链接: https://frida.re/docs/javascript-api/#frida
欢迎加入 Frida 交流群: 1049977261
Frida
-
Frida.version:
一个包含当前 Frida 版本的字符串. -
Frida.heapSize:
一个被所有脚本和 Frida 自己的运行时共享的包含当前 Frida 私有堆大小的动态属性.
这对于监控宿主进程正在使用的内存量很有用.
Script
-
Script.runtime:
一个包含正在被使用的运行时的字符串. 要么是DUK, 要么是V8.
Process
-
Process.id:
包含 PID 的数字. -
Process.arch:
包含ia32,x64,arm或arm64的字符串. -
Process.platform:
包含windows,darwin,linux或qnx的字符串. -
Process.pageSize:
虚拟内存页的尺寸(以byte为单位). 可用于使你的脚本具有更好的可移植性. -
Process.pointerSize:
指针的尺寸(以byte为单位). 可用于使你的脚本具有更好的可移植性. -
Process.codeSigningPolicy:
包含optional或required的字符串,后者意味着 Frida 将禁止修改内存中已有的代码, 并且不会尝试允许未签名的代码.
当前这个属性总是被设为optional除非你正在使用 Gadget 并且将其配置为假设代码签名是必要的.
此属性使您可以确定 Interceptor API是否超出限制, 以及修改代码或运行未签名的代码是否安全。 -
Process.isDebuggerAttached():
返回一个布尔值用来表示当前是否有调试器被附加到进程上. -
Process.getCurrentThreadId():
获得操作系统指定给当前线程的 id. -
Process.enumerateThreads():
列举所有的线程, 返回一个包含以下属性的序列:-
id: 操作系统指定的 id -
state:running,stopped,waiting,uninterruptible或halted的字符串 -
context: 带有键pc和sp的NativePointer对象, 分别为 ia32 / x64 / arm 指定 EIP / RIP / PC 和 ESP / RSP / SP. 也可以使用其他处理器特定的键, 例如eax,rax,r0,x0等.
-
-
Process.findModuleByAddress(address),Process.getModuleByAddress(address),Process.findModuleByName(name),Process.getModuleByName(name):
返回一个 address 或 name 满足要求的 Module.
当找不到相应的模块时, find 前缀的方法返回 null 而 get 前缀的方法抛出异常. -
Process.enumerateModules():
列举当前已加载的模块, 返回一个 Module 序列. -
Process.findRangeByAddress(address),getRangeByAddress(address):
返回一个对象, 其中包含有关包含 address 的范围的详细信息.
当找不到相应的范围是, findRangeByAddress() 返回 null, 而 getRangeByAddress() 抛出异常.
阅读Process.enumerateRanges()以便了解哪些字段被包含在内. -
Process.enumerateRanges(protection|specifier):
列举满足rwx格式的字符串参数protection的内存范围, 其中rw-意为 "必须至少是可读可写".
Alternatively you may provide aspecifierobject with aprotectionkey whose value is as
aforementioned, and acoalescekey set totrueif you'd like neighboring
ranges with the same protection to be coalesced (the default isfalse;
i.e. keeping the ranges separate).
返回一个包含以下属性的序列:-
base: 一个NativePointer类型的基础地址 -
size: 以byte为单位的尺寸 -
protection: 读写权限 (如上所述) -
file: (当可用时) 文件映射详情, 包含以下属性:-
path: 完整的文件系统路径字符串 -
offset: 对应的文件在硬盘上的偏移量, 以byte为单位 -
size: 对应的文件在硬盘上的尺寸, 以byte为单位
-
-
-
Process.enumerateMallocRanges(): just likeenumerateRanges(), but for
individual memory allocations known to the system heap. -
Process.setExceptionHandler(callback):
安装一个进程侧的异常处理回调, 以便在宿主进程之前获得处理原生异常的机会.
被调用时将伴随包含以下属性的details对象:-
type: 下列字符串中的一种:- abort
- access-violation
- guard-page
- illegal-instruction
- stack-overflow
- arithmetic
- breakpoint
- single-step
- system
-
address:NativePointer类型的地址, 标志着异常出现的地方. -
memory: 如果有的话, 包含以下属性:-
operation: 触发该异常的操作类型, 仅限于read,write, 或execute. -
address:NativePointer类型的地址, 标志着异常出现的地方.
-
-
context: 带有键pc和sp的NativePointer对象, 分别为 ia32 / x64 / arm 指定 EIP / RIP / PC 和 ESP / RSP / SP. 也可以使用其他处理器特定的键, 例如eax,rax,r0,x0等.
你也可以通过分配这些键来更新寄存器值. -
nativeContext:
操作系统以及特定架构的 CPU 的上下文结构的NativePointer类型的地址.
This is only exposed as a last resort for edge-cases wherecontextisn't providing enough details. We would however discourage using this and rather submit a pull-request to add the missing bits needed for your use-case.
现在由你的回调来决定要如何应对异常. 它可以记录这个问题, 通过
send()和recv()与你的应用进行交互, 或者它可以修改寄存器和内存以便从异常中恢复.
如果你处理好了异常, 你应对返回true, 这样的话 Frida 将立即恢复线程.
如果你没有返回true, Frida 将会把这个异常转发到宿主进程潜在的异常处理器, 或任由操作系统终止进程. -






网友评论