Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // kdslym_addr_aslr_patch
- // 4.05: 0x002862D6
- // 4.55: 0x001BA559
- // 4.74: 0x001BC769
- // 5.01: 0x00194765
- // 5.03: 0x00194875
- // 5.05: 0x00194875
- // 5.55: 0x0007A123
- // 6.20: 0x0021D745
- // 6.72: 0x003CEC8A
- // 7.02: 0x000C1F9A
- bool Utilities::EnableAslr()
- {
- if (*(uint16_t *)kdlsym(aslr_patch) != 0x9090 && *(uint8_t *)kdlsym(aslr_patch) != 0xEB)
- {
- WriteLog(LL_Warn, "ASLR already enabled");
- return true;
- }
- if ((*(uint16_t *)kdlsym(aslr_patch) == 0x9090 || *(uint8_t *)kdlsym(aslr_patch) == 0xEB) && g_origAslrBytes != 0xFFFF)
- {
- if (!gKernelBase)
- {
- WriteLog(LL_Error, "unable to find kernel base");
- return false;
- }
- uint8_t *kmem;
- kmem = (uint8_t *)&gKernelBase[kdlsym_addr_aslr_patch];
- kmem[0] = ((uint8_t *)(&g_origAslrBytes))[0]; // Will these be swapped?
- kmem[1] = ((uint8_t *)(&g_origAslrBytes))[1]; // Will these be swapped?
- WriteLog(LL_Info, "ASLR Enabled");
- return true;
- }
- WriteLog(LL_Error, "unable to enable ASLR");
- return false;
- }
- bool Utilities::DisableAslr()
- {
- if (g_origAslrBytes == 0xFFFF)
- g_origAslrBytes = *(uint16_t *)kdlsym(aslr_patch);
- if (*(uint16_t *)kdlsym(aslr_patch) != 0x9090 && *(uint8_t *)kdlsym(aslr_patch) != 0xEB)
- {
- if (!gKernelBase)
- {
- WriteLog(LL_Error, "unable to find kernel base");
- return false;
- }
- uint8_t *kmem;
- kmem = (uint8_t *)&gKernelBase[kdlsym_addr_aslr_patch];
- #if MIRA_PLATFORM < MIRA_PLATFORM_ORBIS_BSD_600
- kmem[0] = 0x90;
- kmem[1] = 0x90;
- #else
- kmem[0] = 0xEB;
- #endif
- WriteLog(LL_Info, "ASLR Disabled");
- return true;
- }
- WriteLog(LL_Error, "unable to disable ASLR");
- return false;
- }
- bool Utilities::ActivateWebBrowser()
- {
- auto sceRegMgrGetInt = (uint32_t(*)(uint32_t p_Id, int32_t* p_OutValue))kdlsym(sceRegMgrGetInt);
- auto sceRegMgrSetInt = (uint32_t(*)(uint32_t p_Id, int32_t p_Value))kdlsym(sceRegMgrSetInt);
- int32_t rtv;
- auto s_Ret = sceRegMgrGetInt(0x3C040000, &rtv);
- if (s_Ret != 0)
- {
- WriteLog(LL_Error, "could not get web browser activation status");
- return false;
- } else if (rtv == 0) {
- WriteLog(LL_Info, "web browser already activated");
- return true;
- }
- WriteLog(LL_Warn, "activating web browser");
- s_Ret = sceRegMgrSetInt(0x3C040000, 0);
- if (s_Ret != 0)
- {
- WriteLog(LL_Error, "could not activate web browser");
- return false;
- }
- WriteLog(LL_Info, "activated web browser");
- return true;
- }
- void Utilities::SetTargetId(char targetId_input)
- {
- if (g_origTargetId == (char)0xFF)
- g_origTargetId = *(char *)kdlsym(target_id);
- if (g_origTargetId == targetId_input)
- {
- WriteLog(LL_Error, "Target ID is already %02hhX", targetId_input);
- return;
- }
- WriteLog(LL_Warn, "spoofing target ID to %02hhX", targetId_input);
- if (!gKernelBase)
- {
- WriteLog(LL_Error, "unable to find kernel base");
- return;
- }
- uint8_t *kmem;
- kmem = (uint8_t *)&gKernelBase[kdlsym_addr_target_id];
- kmem[0] = targetId_input;
- WriteLog(LL_Info, "target ID spoofed to %02hhX", targetId_input);
- }
- bool Utilities::SetFanThreshhold(int fanController_input)
- {
- if (fanController_input < 59 || fanController_input > 79)
- {
- WriteLog(LL_Error, "Unsafe fan controller setting: %i°C", fanController_input);
- return false;
- }
- auto s_Thread = curthread;
- if (s_Thread == nullptr)
- {
- WriteLog(LL_Error, "could not get current thread.");
- return false;
- }
- int fd = kopen_t("/dev/icc_fan", 0x0000, 0, s_Thread); // O_RDONLY
- if (fd <= 0)
- {
- WriteLog(LL_Info, "unable to open \"/dev/icc_fan\"");
- return false;
- }
- char data[10] = {0x00, 0x00, 0x00, 0x00, 0x00, (char)fanController_input, 0x00, 0x00, 0x00, 0x00};
- kioctl_t(fd, 0xC01C8F07, data, s_Thread);
- kclose_t(fd, s_Thread);
- WriteLog(LL_Info, "Successfully set fan controller to %i°C", fanController_input);
- return true;
- }
Add Comment
Please, Sign In to add comment