mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Add radiff2 -a and -b flags
This commit is contained in:
parent
44a0774069
commit
a727663f98
@ -70,9 +70,11 @@ static RCore* opencore(const char *f) {
|
||||
}
|
||||
|
||||
static int show_help(int v) {
|
||||
printf ("Usage: radiff2 [-cCdrspOv] [-g sym] [-t %%] [file] [file]\n");
|
||||
printf ("Usage: radiff2 [-abcCdrspOv] [-g sym] [-t %%] [file] [file]\n");
|
||||
if (v) printf (
|
||||
// " -l diff lines of text\n"
|
||||
" -a [arch] specify architecture plugin to use (x86, arm, ..)\n"
|
||||
" -b [bits] specify register size for arch (16 (thumb), 32, 64, ..)\n"
|
||||
" -c count of changes\n"
|
||||
" -C graphdiff code (columns: off-A, match-ratio, off-B)\n"
|
||||
" -d use delta diffing\n"
|
||||
@ -114,6 +116,8 @@ int main(int argc, char **argv) {
|
||||
const char *addr = NULL;
|
||||
RCore *c, *c2;
|
||||
RDiff *d;
|
||||
const char *arch = NULL;
|
||||
int bits = 0;
|
||||
char *file, *file2;
|
||||
ut8 *bufa, *bufb;
|
||||
int o, sza, szb, rad = 0, delta = 0;
|
||||
@ -122,8 +126,14 @@ int main(int argc, char **argv) {
|
||||
int threshold = -1;
|
||||
double sim;
|
||||
|
||||
while ((o = getopt (argc, argv, "Cpg:Orhcdsvxt:")) != -1) {
|
||||
while ((o = getopt (argc, argv, "a:b:Cpg:Orhcdsvxt:")) != -1) {
|
||||
switch (o) {
|
||||
case 'a':
|
||||
arch = optarg;
|
||||
break;
|
||||
case 'b':
|
||||
bits = atoi (optarg);
|
||||
break;
|
||||
case 'p':
|
||||
useva = R_FALSE;
|
||||
break;
|
||||
@ -184,6 +194,14 @@ int main(int argc, char **argv) {
|
||||
eprintf ("Cannot open '%s'\n", file2);
|
||||
return 1;
|
||||
}
|
||||
if (arch) {
|
||||
r_config_set (c->config, "asm.arch", arch);
|
||||
r_config_set (c2->config, "asm.arch", arch);
|
||||
}
|
||||
if (bits) {
|
||||
r_config_set_i (c->config, "asm.bits", bits);
|
||||
r_config_set_i (c2->config, "asm.bits", bits);
|
||||
}
|
||||
r_anal_diff_setup_i (c->anal, diffops, threshold, threshold);
|
||||
r_anal_diff_setup_i (c2->anal, diffops, threshold, threshold);
|
||||
r_core_gdiff (c, c2);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2013 - pancake */
|
||||
/* radare - LGPL - Copyright 2013-2014 - pancake */
|
||||
|
||||
#include <r_types.h>
|
||||
#include <r_util.h>
|
||||
@ -95,7 +95,7 @@ static RList* entries(RBinFile *arch) {
|
||||
|
||||
struct r_bin_plugin_t r_bin_plugin_bios = {
|
||||
.name = "bios",
|
||||
.desc = "filesystem bin plugin",
|
||||
.desc = "BIOS bin plugin",
|
||||
.license = "LGPL",
|
||||
.init = NULL,
|
||||
.fini = NULL,
|
||||
|
@ -5,7 +5,7 @@ radiff2 \- unified binary diffing utility
|
||||
.Pp
|
||||
.Sh SYNOPSIS
|
||||
.Nm radiff2
|
||||
.Op Fl cCOdrspvh
|
||||
.Op Fl abcCOdrspvh
|
||||
.Op Fl t Ar 0-100
|
||||
.Op Fl g Ar sym
|
||||
.Ar file1
|
||||
@ -14,6 +14,10 @@ radiff2 \- unified binary diffing utility
|
||||
radiff2 implements many binary diffing algorithms for data and code.
|
||||
.Pp
|
||||
.Bl -tag -width Fl
|
||||
.It Fl a
|
||||
Specify architecture (x86, arm, ..)
|
||||
.It Fl b
|
||||
Select register size bits for given arch
|
||||
.It Fl c
|
||||
Count number of differences.
|
||||
.It Fl C
|
||||
|
Loading…
Reference in New Issue
Block a user