Last active
May 6, 2021 13:54
-
-
Save SocraticBliss/cc60c4daef4ac788915ad956019cbe6e to your computer and use it in GitHub Desktop.
PS4 Kernel Defines Maker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
SocraticBliss (R) | |
PS4 Kernel Defines Maker - Creates a non-rebased kernel offsets header file | |
Inspired by CelesteBlue | |
* Instructions | |
IDA -> Load Kernel Database -> File -> Script File -> Pick dis plz | |
''' | |
import ida_funcs | |
import ida_nalt | |
import idautils | |
base = ida_nalt.get_imagebase() | |
print('Kernel Base: %#x' % base) | |
''' | |
HEN_INSTALLER_FUNCTIONS = ['xfast_syscall', 'printf', 'memcpy', 'kmem_alloc'] | |
HEN_INSTALLER_VARIABLES = ['PRISON_0', 'ROOTVNODE', 'KERN_MAP'] | |
HEN_INSTALLER_HOOKS = ['sceSblAuthMgrIsLoadable2', 'sceSblAuthMgrVerifySelfHeader'] | |
''' | |
with open ('%s_defines.h' % ida_nalt.get_root_filename(), 'w') as defines: | |
for function in idautils.Functions(): | |
name = ida_funcs.get_func_name(function) | |
if 'sub_' not in name: | |
#print('Function EA: %#x' % function) | |
#print('Offset: %#x' % (function - base)) | |
defines.write('#define %s %#x\n' % (name.replace('.', '_'), function - base)) | |
print('Completed!') | |
print('Saved to %s_defines.h' % (ida_nalt.get_input_file_path())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment