Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a PATCH file for the binary difference output file

Tags:

diff

patch

binary

I want to know how to create a PATCH for the difference file I got by comparing two binary files. $cmp -l > output file name

I checked for text files 'diff" can be used to compare and generate a PATCH file $ diff -u oldFile newFile > mods.diff # -u tells diff to output unified diff format

I want to apply the PATCH on the old binary image file to get my new binary image file.

like image 448
sujitnist Avatar asked Mar 10 '10 07:03

sujitnist


People also ask

What is binary file patching?

The process of making changes to a binary and modify its instruction flow is called “patching a binary”. Hackers do this to bypass built-in protections, or to make the program behave in a different way to make the exploit development process go more smoothly.

How do you apply a diff patch?

Description. patch reads a patchfile that contains output from diff describing changes from an old text file to a new text file. patch then applies those changes to another text file. Typically, you use patch if you are keeping parallel versions of a file.


3 Answers

Diff and Patch are designed to work with text files, not arbitrary binary data. You should use something like bsdiff instead.

like image 133
Zoë Peterson Avatar answered Nov 07 '22 07:11

Zoë Peterson


If your repository, or package is using git you can make binary diff with git diff --patch --binary old_dir patched_dir Of course you can also use it with commits git diff --patch --binary commit1 commit2

like image 24
Alex Baranowski Avatar answered Nov 07 '22 07:11

Alex Baranowski


JDIFF is a program that outputs the differences between two (binary) files.
Also you can use therdiff command.

like image 34
totti Avatar answered Nov 07 '22 06:11

totti