uniref.platforms
This module holds the uniref top-level classes for all supported platforms
- class uniref.platforms._UniRef
- find_class_in_image(image_name: str, class_path: str) Optional[MonoClass]
Find the class in the image.
Probably the most commonly used method. This method looks up class reflection information through the given image name and class full path ([namespace].[class name]).
This method supports resolving the classpath shown in Cheat Engine. For inner classes, you can concatenate the class names by
+or/.Examples:
>>> ref.find_class_in_image("Assembly-CSharp", "PlayerStats") <uniref.mono.component.MonoClass object at 0x0000022F53050CF8> >>> ref.find_class_in_image("Assembly-CSharp", "Rewired.UI.ControlMapper.Window+Timer") <uniref.mono.component.MonoClass object at 0x0000022F53050C50> >>> ref.find_class_in_image("Assembly-CSharp", "MyClass") is None True
- Returns
MonoClassinstance if class is found, elseNone.
- find_field_in_class(klass: MonoClass, field_name: str) Optional[MonoField]
Find the field by its name.
- Returns
MonoFieldinstance if field is found, elseNone.
- find_image_by_name(image_name: str) Optional[MonoImage]
Find the image by image name.
- Returns
MonoImageinstance if image is found, elseNone.
- find_method_in_class(klass: MonoClass, method_name: str, param_count: int = -1) Optional[MonoMethod]
Find the method in the class.
If there are different overloads of a method in the same class, you can distinguish them by the number of parameters. This is what the
param_countmeans.- Returns
MonoMethodinstance if method is found, elseNone.
- get_assembly_image(assembly: MonoAssembly) MonoImage
Get the image of the specified assembly.
- property injector: WinMonoInjector
target process injector
- list_assemblies() List[MonoAssembly]
List all assemblies in the application.
- list_methods_in_class(klass: MonoClass) List[MonoMethod]
List all methods in the class.
- property mono_module_handle: int
target process mono / il2cpp module handle
- property pid: int
target process id
- property root_domain: int
target process root application domain
- use_il2cpp() bool
Check if target process uses the
IL2CPPscripting backend.- Returns
Falseif target process uses theMonoscripting backend, elseTrue.
- class uniref.platforms.AndroidUniRef(process_name: Optional[str] = None, package_name: Optional[str] = None, device_id: Optional[str] = None, spawn: bool = True)
Bases:
_UniRefThe uniref top-level class for
Android.- Parameters
process_name – the process name of the target application, you can get it by
frida-pspackage_name – the package name of the target application
device_id – specify the device id, you can get it by
adb devicesspawn – decide whether to create or attach a process when
package_nameis given,Trueby default
Examples:
# automatically attach the frontmost application & device ref = AndroidUniRef() # attach the application by its process name (automatically select device) ref = AndroidUniRef(process_name="My App") # spawn the application by its package name (automatically select device) ref = AndroidUniRef(package_name="com.test.my_app") # attach the application by its package name (automatically select device) ref = AndroidUniRef(package_name="com.test.my_app", spawn=False) # attach the application on the specified device ref = AndroidUniRef(device_id="12a34b5") ref = AndroidUniRef(process_name="My App", device_id="12a34b5") ref = AndroidUniRef(package_name="com.test.my_app", device_id="12a34b5")
- execute_js(js_code: str, on_message_callback: Optional[Callable] = None) frida.core.Script
inject javascript through
Frida.- Parameters
js_code – javascript code
on_message_callback – callback in the form of on_message(message, data)
- Returns
frida.core.Scriptinstance
- class uniref.platforms.WinUniRef(exe_filename: str = '', process_id: int = 0)
Bases:
_UniRefThe uniref top-level class for
Windows.- Parameters
exe_filename – target application exe filename
process_id – process id
Examples:
>>> ref = WinUniRef("TheForest.exe") >>> ref = WinUniRef(process_id=1234)
- property process_handle: int
target process handle