UNPKG

frida-il2cpp-bridge-my

Version:

(my:Support IOS)Frida module to dump, manipulate and hijack any IL2CPP application at runtime with a high level of abstraction.

63 lines (62 loc) 2.76 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports._Il2CppObject = void 0; const decorator_cache_getter_1 = require("decorator-cache-getter"); const accessor_1 = require("../../utils/accessor"); const console_1 = require("../../utils/console"); const api_1 = require("../api"); const native_struct_1 = require("../native-struct"); const class_1 = require("./class"); const value_type_1 = require("./value-type"); class _Il2CppObject extends native_struct_1.NativeStruct { static get headerSize() { return api_1.Api._objectGetHeaderSize(); } get base() { if (this.class.parent == null) { console_1.raise(`Class "${this.class.type.name}" has no parent.`); } const object = new _Il2CppObject(this.handle); Reflect.defineProperty(object, "class", { get: () => this.class.parent }); return object; } get class() { return new class_1._Il2CppClass(api_1.Api._objectGetClass(this.handle)); } get fields() { return this.class.fields[accessor_1.filterAndMap](field => field.isInstance, field => field.asHeld(this.handle.add(field.offset))); } get methods() { return this.class.methods[accessor_1.filterAndMap](method => method.isInstance, method => method.asHeld(this.handle)); } static from(klass) { return new _Il2CppObject(api_1.Api._objectNew(klass.handle)); } unbox() { if (!this.class.isStruct) console_1.raise(`Cannot unbox a non value type object of class "${this.class.type.name}"`); return new value_type_1._Il2CppValueType(api_1.Api._objectUnbox(this.handle), this.class); } } __decorate([ decorator_cache_getter_1.cache ], _Il2CppObject.prototype, "base", null); __decorate([ decorator_cache_getter_1.cache ], _Il2CppObject.prototype, "class", null); __decorate([ decorator_cache_getter_1.cache ], _Il2CppObject.prototype, "fields", null); __decorate([ decorator_cache_getter_1.cache ], _Il2CppObject.prototype, "methods", null); __decorate([ decorator_cache_getter_1.cache ], _Il2CppObject, "headerSize", null); exports._Il2CppObject = _Il2CppObject;