Created
November 11, 2020 07:56
-
-
Save Halo-Michael/331c6352fcacb2bb6a6e5f80f41c4f53 to your computer and use it in GitHub Desktop.
LiveSafari Fix
This file contains hidden or 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 python3 | |
import struct | |
import os,sys | |
extfun=lambda x: x | |
def read_file_hex(file_path): | |
file_object = open(file_path,'rb') | |
file_object.seek(0,0) | |
hex_str ='' | |
byte = file_object.read() | |
if byte: | |
for b in byte: | |
hex_str += ('%02X' % extfun(b)) | |
file_object.close() | |
return hex_str | |
def wirte_to_file(hex,file_path): | |
fout = open(file_path,'wb') | |
for i in range(len(hex)//2): | |
x = int(hex[2*i:2*(i+1)], 16) | |
fout.write(struct.pack('B', extfun(x))) | |
fout.close() | |
def hex_replace(hex,find_str,replace_str): | |
return hex.replace(find_str,replace_str) | |
if __name__=='__main__': | |
file_str = read_file_hex('/Library/MobileSubstrate/DynamicLibraries/LiveSafari.dylib') | |
new_file_str = hex_replace(file_str,"02000080","02000000") | |
wirte_to_file(new_file_str,'/Library/MobileSubstrate/DynamicLibraries/LiveSafari.dylib') | |
os.system("ldid -S /Library/MobileSubstrate/DynamicLibraries/LiveSafari.dylib") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment