Hi,
The title says it all. Is there an API call to save the patched bytes into the inputfile.
There is a menu entry but is the actual call exposed?
Avi.
Hi,
The title says it all. Is there an API call to save the patched bytes into the inputfile.
There is a menu entry but is the actual call exposed?
Avi.
I haven’t found any way to do it directly but you can call idc.gen_file() to generate a DIF
file that is the difference and then use a thirdparty program to actually make the modifications. I have written a replacement for idc.gen_file on Github: community_base.py
Perhaps patching/plugins/patching/util/ida.py at f7902033f9c2be9ea71017ce9eb13691906cc858 · gaasedelen/patching · GitHub could help you.
Not directly, but you have half the problem solved with this API:
idaman int ida_export visit_patched_bytes(
ea_t ea1,
ea_t ea2,
int (idaapi *cb)(ea_t ea, qoff64_t fpos, uint64 o, uint64 v, void *ud),
void *ud = nullptr);
All you have to do is just open a file prior to calling this API, then in the callback, patch the values in; ofc, finally close the file.
I sat down and wrote such function.
See file_write_patches_to_file
at: community_base/community_base.py at 26137c80ddf20449a09ab7246f8c72c98d42d9e3 · Harding-Stardust/community_base · GitHub
That looks good! thanks for sharing!