diff --git a/__pycache__/patches.cpython-310.pyc b/__pycache__/patches.cpython-310.pyc index e538663..1a8ebbb 100644 Binary files a/__pycache__/patches.cpython-310.pyc and b/__pycache__/patches.cpython-310.pyc differ diff --git a/__pycache__/utils.cpython-310.pyc b/__pycache__/utils.cpython-310.pyc index 4c09f1b..ecc5e25 100644 Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ diff --git a/exploit.py b/exploit.py index e4c98aa..808a026 100644 --- a/exploit.py +++ b/exploit.py @@ -18,6 +18,10 @@ USBDEVFS_SUBMITURB = 0x8038550a USBDEVFS_REAPURB = 0x4008550c USBDEVFS_DISCARDURB = 0x0000550b +IMEM_START = 0x40000000 +IMEM_SIZE = 0xfc00 +BOOTROM_START = 0x100000 + debug_exchanges = 0 class DEVICE(): def usb_connect(self): @@ -115,6 +119,8 @@ class TegraRCM(): if not IS_OSX: fds_before = get_fds() self.dev = DEVICE() + self.read = self.dev.read + self.write = self.dev.write if not IS_OSX: self.fds = get_fds() - fds_before self.fd = sorted(list(self.fds))[-1] @@ -161,7 +167,10 @@ class TegraRCM(): def build_rcm_cmd(self, payload_file_fd, rcm_cmd_buf, rcm_cmd_buf_len, payload_thumb_mode ): ret = -1 rcm_cmd_len = struct.pack(" 0: - remaining = 0x200 - if(len(data) < 0x200): + remaining = blk_sz + if(len(data) < blk_sz): remaining = len(data) send = data[:remaining] data = data[remaining:] - self.dev.write(send) - message = self.dev.read(0x200) + self.write(send) + message = self.read(blk_sz) if(message != b"OK"): error("Error on writing data to device!") return - self.dev.write(b"ACK\x00") - self.handle_done() - #Read back data - if(check): - after = self.memdump_region(address, size) - if(after == before and send != before): - error(f"Memory written succesfully, but no changes detected! | {hex(address)}") + self.write(b"ACK\x00") def search_bootrom(self): dumped = BytesIO() @@ -297,7 +300,7 @@ class TegraRCM(): self.search_bootrom() #dump memory self.dump_bootrom() - + if __name__ == "__main__": parser = argparse.ArgumentParser() @@ -318,5 +321,9 @@ if __name__ == "__main__": # d2 = rcm.dev.read(0x200) if d == b"GiAs": ok("Device in GA debugger") + data = rcm.memdump_region(IMEM_START, 0x1000) + data = rcm.memdump_region(IMEM_START, 0x1000) + rcm.memwrite_region(IMEM_START, b"\xaf" * 0x100) + data2 = rcm.memdump_region(IMEM_START, 0x1000) else: rcm.cmd_handler() \ No newline at end of file