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

Function stage2_

restore/505goldhen/exploit.js:665–1032  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

663 }
664};
665function stage2_() {
666 p = window.prim;
667 p.read2 = function (addr) {
668 return p.read4(addr) & 0xFFFF;
669 };
670 p.read1 = function (addr) {
671 return p.read4(addr) & 0xFF;
672 };
673 p.read_data8 = function (addr, size) {
674 var v = new Uint8Array(size);
675 for (var i = 0; i < size; i++)
676 v[i] = p.read1(addr + i);
677 return v;
678 };
679 p.writestr = function (addr, str) {
680 for (var i = 0; i < str.length; i++) {
681 var byte_ = p.read4(addr.add32(i));
682 byte_ &= 0xFFFF0000;
683 byte_ |= str.charCodeAt(i);
684 p.write4(addr.add32(i), byte_);
685 }
686 };
687 p.readstr = function (addr) {
688 var addr_ = addr.add32(0);
689 var rd = p.read4(addr_);
690 var buf = "";
691 while (rd & 0xFF) {
692 buf += String.fromCharCode(rd & 0xFF);
693 addr_.add32inplace(1);
694 rd = p.read4(addr_);
695 }
696 return buf;
697 };
698 p.array_to_string = function (array) {
699 var str = "";
700 for (var i = 0; i < array.length; i++)
701 str += String.fromCharCode(array[i]);
702 return str;
703 };
704 p.stringify = function (str) {
705 var bufView = new Uint8Array(str.length + 1);
706 for (var i = 0; i < str.length; i++)
707 bufView[i] = str.charCodeAt(i) & 0xFF;
708 window.nogc.push(bufView);
709 return p.read8(p.leakval(bufView).add32(0x10));
710 };
711 p.malloc = function malloc(sz) {
712 var backing = new Uint8Array(0x10000 + sz);
713 window.nogc.push(backing);
714 var ptr = p.read8(p.leakval(backing).add32(0x10));
715 ptr.backing = backing;
716 return ptr;
717 };
718 p.malloc32 = function malloc32(sz) {
719 var backing = new Uint8Array(0x10000 + sz * 4);
720 window.nogc.push(backing);
721 var ptr = p.read8(p.leakval(backing).add32(0x10));
722 ptr.backing = new Uint32Array(backing.buffer);

Callers 1

exploit.jsFile · 0.70

Calls 12

createXHRFunction · 0.70
o2wkFunction · 0.70
o2lkFunction · 0.70
o2lcFunction · 0.70
runBinloaderFunction · 0.70
get_jmptgtFunction · 0.50
read8Method · 0.45
toStringMethod · 0.45
runMethod · 0.45
syscallMethod · 0.45
write8Method · 0.45

Tested by

no test coverage detected