-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathradiff2.1
182 lines (169 loc) · 3.47 KB
/
radiff2.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
.TH RADIFF2 1 "radiff2 tool" "Feb 9, 2025"
.SH NAME
radiff2 - binary diffing utility
.SH SYNOPSIS
.B radiff2
[abcCdeGhijnropqsSxXuUvVzZ] [-A[A]] [-B #] [-g sym] [-m graph_mode][-t %] file file
.SH DESCRIPTION
radiff2 is a tool from the radare2 suite designed for binary diffing code and data.
.PP
It supports a wide range of formats and features, including architecture and
bits specification, delta diffing, graph diffing, and more.
.SH OPTIONS
.TP
.B -a [arch]
Specify architecture plugin to use (x86, arm, etc.).
.TP
.B -A [-A]
Run aaa or aaaa after loading each binary (see -C).
.TP
.B -b [bits]
Specify register size for architecture (16 (thumb), 32, 64, etc.).
.TP
.B -B [baddr]
Define the base address to add the offsets when listing.
.TP
.B -c [cmd]
Run an r2 command on every RCore instance created.
.TP
.B -C
Graphdiff code (columns: off-A, match-ratio, off-B) (see -A).
.TP
.B -d
Use delta diffing.
.TP
.B -D
Show disasm instead of hexpairs.
.TP
.B -e [k=v]
Set eval config var value for all RCore instances.
.TP
.B -g [arg]
Graph diff of [sym] or functions in [off1,off2].
.TP
.B -i [ifscm]
Diff imports | fields | symbols | classes | methods.
.TP
.B -j
Output in JSON format.
.TP
.B -m [mode]
Choose the graph output mode (aditsjJ).
.TP
.B -n
Count number of changes
.TP
.B -O
Code diffing with opcode bytes only.
.TP
.B -p
Use physical addressing (io.va=false) (only for radiff2 -AC).
.TP
.B -q
Quiet mode (disable colors, reduce output).
.TP
.B -r
Output in radare commands.
.TP
.B -s
Compute edit distance (no substitution, Eugene W. Myers O(ND) diff algorithm).
.TP
.B -ss
Compute Levenshtein edit distance (substitution is allowed, O(N^2)).
.TP
.B -S [name]
Sort code diff (name, namelen, addr, size, type, dist) (only for -C or -g).
.TP
.B -t [0-100]
Set threshold for code diff (default is 70%).
.TP
.B -T
Analyze files in threads (EXPERIMENTAL, 30% faster and crashy).
.TP
.B -u
Unified output (---+++).
.TP
.B -U
Unified output using system 'diff'.
.TP
.B -v
Show version information.
.TP
.B -V
Be verbose (current only for -s).
.TP
.B -x
Show two-column hexdump diffing.
.TP
.B -X
Use xpatch format for the diffing output.
.TP
.SH "GRAPH OUTPUT FORMATS (-m [mode])"
.TP
.B .
default is ASCII art.
.TP
.B s
r2 commands.
.TP
.B d
Graphviz dot.
.TP
.B g
Graph Modelling Language (gml).
.TP
.B j
JSON.
.TP
.B J
JSON with disarm.
.TP
.B k
sdb key-value.
.TP
.B t
Tiny ascii art.
.TP
.B i
Interactive ascii art.
.SH USAGE EXAMPLES
.TP
.B "Comparing two binaries"
radiff2 bin1 bin2
.TP
.B "Using graph diffing to compare functions by name"
radiff2 -g main bin1 bin2
.TP
.B "Counting the number of changes between two binaries"
radiff2 -c bin1 bin2
.TP
.B "Outputting the diff in a unified format"
radiff2 -u bin1 bin2
.TP
.B "Comparing the opcodes of two functions"
radiff2 -O bin1 bin2
.SH 'C' COMMAND IN R2
The 'c' command in r2 is used for various comparison operations within data inside the same file. Here are some examples of its usage:
.TP
.B Compare a plain string with escaped chars
c "string to compare"
.TP
.B Compare byte at a specific address with current offset
c1 0x100
.TP
.B Compare block size bytes from current offset and the 0x100 offset
cc 0x100
.TP
.B Unified diff of disassembly from current seek and given address
cud 0x200 @ 0x100
.TP
.B Compare memory hexdumps in unified diff format
cu 0x100 @ 0x200
For more detailed usage of the 'c' command, refer to the `c[?dfx] [argument]` help section.
.SH SEE ALSO
radare2(1)
.Sh WWW
.Pp
https://www.radare.org/
.SH AUTHOR
pancake <[email protected]>