Publishes the project

This commit is contained in:
Putta Khunchalee 2023-10-28 03:14:56 +07:00
commit 92c7aca2e9
5 changed files with 139 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build/

17
COPYING Normal file
View File

@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

37
Makefile Normal file
View File

@ -0,0 +1,37 @@
LIBPS4 := $(PS4SDK)/libPS4
CC := gcc
OBJCOPY := objcopy
ODIR := build
SDIR := source
IDIRS := -I$(LIBPS4)/include -Iinclude
LDIRS := -L$(LIBPS4)
MAPFILE := $(shell basename "$(CURDIR)").map
CFLAGS := $(IDIRS) -Os -std=c11 -ffunction-sections -fdata-sections -fno-builtin -nostartfiles -nostdlib -Wall -Wextra -masm=intel -march=btver2 -mtune=btver2 -m64 -mabi=sysv -mcmodel=small -fpie -fPIC
LFLAGS := $(LDIRS) -Xlinker -T $(LIBPS4)/linker.x -Xlinker -Map="$(MAPFILE)" -Wl,--build-id=none -Wl,--gc-sections
CFILES := $(wildcard $(SDIR)/*.c)
SFILES := $(wildcard $(SDIR)/*.s)
OBJS := $(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(CFILES)) $(patsubst $(SDIR)/%.s, $(ODIR)/%.o, $(SFILES))
LIBS := -lPS4
TARGET = $(shell basename "$(CURDIR)").bin
$(TARGET): $(ODIR) $(OBJS)
$(CC) $(LIBPS4)/crt0.s $(ODIR)/*.o -o temp.t $(CFLAGS) $(LFLAGS) $(LIBS)
$(OBJCOPY) -O binary temp.t "$(TARGET)"
rm -f temp.t
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/%.o: $(SDIR)/%.s
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR):
@mkdir $@
.PHONY: clean
clean:
rm -rf "$(TARGET)" "$(MAPFILE)" $(ODIR)

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# Auth Info Dumper
This is a PS4 payload to dump [auth info](https://www.psdevwiki.com/ps4/Auth_Info) from a SELF file. Right now it is hard-coded file name to dump and it is only work on 9.0.
## Building
### Prerequisites
- Linux
- [PS4 Payload SDK](https://github.com/Scene-Collective/ps4-payload-sdk)
## License
MIT

70
source/main.c Normal file
View File

@ -0,0 +1,70 @@
#include <ps4.h>
struct get_auth_req {
const char *file;
unsigned char buf[136];
};
struct get_auth_args {
void *handler;
struct get_auth_req *req;
};
typedef int (*kern_get_self_auth_info_t) (struct thread *, const char *, int, unsigned char *);
typedef int (*copyout_t) (const void *, void *, unsigned);
static int get_auth(struct thread *td, struct get_auth_args *args) {
void *kernel_base;
kern_get_self_auth_info_t kern_get_self_auth_info;
copyout_t copyout;
unsigned char info[136];
int error;
// get kernel functions
kernel_base = &((uint8_t *)__readmsr(0xC0000082))[-K900_XFAST_SYSCALL];
kern_get_self_auth_info = (kern_get_self_auth_info_t)(kernel_base + 0x1697B0);
copyout = (copyout_t)(kernel_base + K900_COPYOUT);
// get auth
error = kern_get_self_auth_info(td, args->req->file, 0, info);
if (error == 0) {
error = copyout(info, args->req->buf, 136);
}
return error;
}
int _main(struct thread *td) {
struct get_auth_req req;
int fd;
initKernel();
initLibc();
jailbreak();
mmap_patch();
initSysUtil();
// get auth info
req.file = "/system/sys/SceSysCore.elf";
if (kexec(get_auth, &req) < 0) {
printf_notification("Failed to dump auth info.");
return 0;
}
// write to usb drive
fd = open("/mnt/usb0/auth-info.bin", O_WRONLY | O_CREAT | O_TRUNC, 0777);
if (fd < 0) {
printf_notification("Cannot create auth-info.bin on the USB drive.");
return 0;
}
write(fd, req.buf, 136);
close(fd);
printf_notification("Auth info dumped!");
return 0;
}