mirror of
https://github.com/wiiu-env/PayloadFromRPX.git
synced 2025-01-13 20:39:07 +01:00
Use raw2c instead of xxd
This commit is contained in:
parent
f01b13f1d6
commit
690398432f
@ -1,9 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <coreinit/dynload.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/ios.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/ios.h>
|
||||
#include "ios_exploit.h"
|
||||
|
||||
#define ALIGN4(x) (((x) + 3) & ~3)
|
||||
@ -238,7 +237,7 @@ static const int final_chain[] = {
|
||||
0x0, // 0x1F0
|
||||
0x101063db, // 0x1F4 POP {R1,R2,R5,PC}
|
||||
0x0, // 0x1F8
|
||||
sizeof(ios_kernel_bin), // 0x1FC our code size
|
||||
sizeof(ios_kernel), // 0x1FC our code size
|
||||
0x0, // 0x200
|
||||
0x10123983, // 0x204 POP {R1,R3,R4,R6,PC}
|
||||
0x00140000, // 0x208 our code source location
|
||||
@ -310,11 +309,11 @@ static void uhs_exploit_init(int dev_uhs_0_handle) {
|
||||
|
||||
memcpy((char *) (0xF4120000), second_chain, sizeof(second_chain));
|
||||
memcpy((char *) (0xF4130000), final_chain, sizeof(final_chain));
|
||||
memcpy((char *) (0xF4140000), ios_kernel_bin, sizeof(ios_kernel_bin));
|
||||
memcpy((char *) (0xF4140000), ios_kernel, sizeof(ios_kernel));
|
||||
|
||||
payload_info_t *payloads = (payload_info_t *) 0xF4148000;
|
||||
payloads->size = sizeof(ios_usb_bin);
|
||||
memcpy(payloads->data, ios_usb_bin, payloads->size);
|
||||
payloads->size = sizeof(ios_usb);
|
||||
memcpy(payloads->data, ios_usb, payloads->size);
|
||||
|
||||
pretend_root_hub[33] = 0x500000;
|
||||
pretend_root_hub[78] = 0;
|
||||
@ -322,7 +321,7 @@ static void uhs_exploit_init(int dev_uhs_0_handle) {
|
||||
DCStoreRange(pretend_root_hub + 33, 200);
|
||||
DCStoreRange((void *) 0xF4120000, sizeof(second_chain));
|
||||
DCStoreRange((void *) 0xF4130000, sizeof(final_chain));
|
||||
DCStoreRange((void *) 0xF4140000, sizeof(ios_kernel_bin));
|
||||
DCStoreRange((void *) 0xF4140000, sizeof(ios_kernel));
|
||||
DCStoreRange((void *) 0xF4148000, ((uint32_t) 0xF4180000) - 0xF4148000);
|
||||
}
|
||||
|
||||
@ -340,12 +339,13 @@ int ExecuteIOSExploit() {
|
||||
if (iosuhaxFd >= 0) {
|
||||
int dummy = 0;
|
||||
|
||||
IOS_Ioctl(iosuhaxFd, 0x03, &dummy, sizeof(dummy), &dummy, sizeof(dummy));
|
||||
//IOS_Ioctl(iosuhaxFd, 0x03, &dummy, sizeof(dummy), &dummy, sizeof(dummy));
|
||||
|
||||
//! do not run patches again as that will most likely crash
|
||||
//! because the wupserver and the iosuhax dev node are still running
|
||||
//! just relaunch IOS with new configuration
|
||||
IOS_Close(iosuhaxFd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! execute exploit
|
||||
|
2
source/ios_kernel/.gitignore
vendored
2
source/ios_kernel/.gitignore
vendored
@ -2,3 +2,5 @@ build/
|
||||
*.bin
|
||||
*.bin.h
|
||||
*.elf
|
||||
ios_kernel.c
|
||||
ios_kernel.h
|
@ -26,6 +26,13 @@ OFILES += $(SFILES:source/%.s=build/%.o)
|
||||
PROJECTNAME = ${shell basename "$(CURDIR)"}
|
||||
CWD = "$(CURDIR)""
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools
|
||||
#---------------------------------------------------------------------------------
|
||||
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
|
||||
export PATH := $(DEVKITPATH)/tools/bin:$(DEVKITPATH)/devkitPPC/bin:$(PATH)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data, taken from devkitARM
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -49,7 +56,8 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf
|
||||
@$(OBJCOPY) -j .text -j .rodata -j .data -O binary $(PROJECTNAME).elf $@
|
||||
|
||||
$(PROJECTNAME).bin.h: $(PROJECTNAME).bin
|
||||
@xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@
|
||||
@raw2c $<
|
||||
@cp $(PROJECTNAME).c $@
|
||||
|
||||
$(PROJECTNAME)_syms.h:
|
||||
@echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@
|
||||
@ -60,7 +68,7 @@ $(PROJECTNAME)_syms.h:
|
||||
|
||||
clean:
|
||||
@rm -f build/*.o build/*.d
|
||||
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h
|
||||
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h $(PROJECTNAME).h $(PROJECTNAME).c
|
||||
@echo "all cleaned up !"
|
||||
|
||||
-include $(DFILES)
|
||||
|
2
source/ios_usb/.gitignore
vendored
2
source/ios_usb/.gitignore
vendored
@ -2,3 +2,5 @@ build/
|
||||
*.bin
|
||||
*.bin.h
|
||||
*.elf
|
||||
ios_usb.c
|
||||
ios_usb.h
|
@ -26,6 +26,13 @@ OFILES += $(SFILES:source/%.s=build/%.o)
|
||||
PROJECTNAME = ${shell basename "$(CURDIR)"}
|
||||
CWD = "$(CURDIR)""
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools
|
||||
#---------------------------------------------------------------------------------
|
||||
DEVKITPATH=$(shell echo "$(DEVKITPRO)" | sed -e 's/^\([a-zA-Z]\):/\/\1/')
|
||||
export PATH := $(DEVKITPATH)/tools/bin:$(DEVKITPATH)/devkitPPC/bin:$(PATH)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data, taken from devkitARM
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -50,6 +57,8 @@ $(PROJECTNAME).bin: $(PROJECTNAME).elf
|
||||
|
||||
$(PROJECTNAME).bin.h: $(PROJECTNAME).bin
|
||||
@xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@
|
||||
@raw2c $<
|
||||
@cp $(PROJECTNAME).c $@
|
||||
|
||||
$(PROJECTNAME)_syms.h:
|
||||
@echo "#ifndef $(PROJECTNAME)_SYMS_H" > $@
|
||||
@ -60,7 +69,7 @@ $(PROJECTNAME)_syms.h:
|
||||
|
||||
clean:
|
||||
@rm -f build/*.o build/*.d
|
||||
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h
|
||||
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_syms.h $(PROJECTNAME).bin $(PROJECTNAME).bin.h $(PROJECTNAME).h $(PROJECTNAME).c
|
||||
@echo "all cleaned up !"
|
||||
|
||||
-include $(DFILES)
|
||||
|
Loading…
x
Reference in New Issue
Block a user