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.
75 lines (74 loc) • 2.88 kB
JavaScript
;
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;
};
var _Il2CppArray_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports._Il2CppArray = void 0;
const decorator_cache_getter_1 = require("decorator-cache-getter");
const api_1 = require("../api");
const decorators_1 = require("../decorators");
const native_struct_1 = require("../native-struct");
const utils_1 = require("../utils");
const object_1 = require("./object");
let _Il2CppArray = _Il2CppArray_1 = class _Il2CppArray extends native_struct_1.NativeStruct {
get elementSize() {
return this.object.class.type.dataType.class.arrayElementSize;
}
get elementType() {
return this.object.class.type.dataType;
}
get elements() {
return api_1.Api._arrayGetElements(this.handle);
}
get length() {
return api_1.Api._arrayGetLength(this.handle);
}
get object() {
return new object_1._Il2CppObject(this.handle);
}
static from(klass, elements) {
const handle = api_1.Api._arrayNew(klass.handle, elements.length);
const array = new _Il2CppArray_1(handle);
elements.forEach((e, i) => array.set(i, e));
return array;
}
get(index) {
return utils_1.readFieldValue(this.elements.add(index * this.elementSize), this.elementType);
}
set(index, value) {
utils_1.writeFieldValue(this.elements.add(index * this.elementSize), value, this.elementType);
}
*[Symbol.iterator]() {
for (let i = 0; i < this.length; i++)
yield this.get(i);
}
};
__decorate([
decorator_cache_getter_1.cache
], _Il2CppArray.prototype, "elementSize", null);
__decorate([
decorator_cache_getter_1.cache
], _Il2CppArray.prototype, "elementType", null);
__decorate([
decorator_cache_getter_1.cache
], _Il2CppArray.prototype, "elements", null);
__decorate([
decorator_cache_getter_1.cache
], _Il2CppArray.prototype, "length", null);
__decorate([
decorator_cache_getter_1.cache
], _Il2CppArray.prototype, "object", null);
__decorate([
decorators_1.checkOutOfBounds
], _Il2CppArray.prototype, "get", null);
__decorate([
decorators_1.checkOutOfBounds
], _Il2CppArray.prototype, "set", null);
_Il2CppArray = _Il2CppArray_1 = __decorate([
decorators_1.nonNullHandle
], _Il2CppArray);
exports._Il2CppArray = _Il2CppArray;