I have a file inside it with values like this:
55 02 00 00 04 29 00 00 69 00 00 00 14 00 00 00 46 31 35 39 42 37 38 44 41 36 34 35 35 34 36 44 5f 23 23 00 00 00 00 00 14 00 00 00 38 43 36 30 31 31 35 33 43 44 33 35 44 32 42 33 5f 23 23 00 07 00 00 00 33 30 31 30 35 30
I want it to change to this:
55 02 00 00 05 29 00 00 69 00 00 00 14 00 00 00 46 31 35 39 42 37 38 44 41 36 34 35 35 34 36 44 5f 23 23 00 01 00 00 00 14 00 00 00 38 43 36 30 31 31 35 33 43 44 33 35 44 32 42 33 5f 23 23 00 07 00 00 00 33 30 31 30 35 30
Here is my file structure: https://drive.google.com/file/d/11XiZejh0OQtzBoOIVuktuMZ7VKBjoj35/view?usp=share_link
Try it and I hope the answer to my problem
What I have tried:
I tried like this but it doesn't seem to work:
import os
ori = input("Enter the hex value to be replaced: ")
mod = input('Enter the hex value you want to replace:')
oriconvert = bytes(ori,'utf-8')
modconvert = bytes(mod,'utf-8')
with open('hero.bytes','rb') as test:
test = test.read()
test = test.replace(oriconvert,modconvert)
with open('hero.bytes', 'wb') as file:
file.write(test)