/az uses anal.in instead of search.in to improve scan results ##search

* Improve snes analysis (brk 0 must be a trap)
This commit is contained in:
pancake 2022-10-16 22:11:42 +02:00 committed by pancake
parent 925756ddf2
commit 5102e86f1e
9 changed files with 32 additions and 15 deletions

View File

@ -83,6 +83,8 @@ static int snes_anop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int l
op->type = R_ANAL_OP_TYPE_XCHG;
break;
case 0x00: // brk
op->type = R_ANAL_OP_TYPE_TRAP;
break;
case 0x02: // cop
op->type = R_ANAL_OP_TYPE_SWI;
break;

View File

@ -11730,8 +11730,8 @@ static int cmd_anal_all(RCore *core, const char *input) {
}
if (input[1] == 'a') { // "aaaa"
R_LOG_INFO ("Scanning for strings constructed in code (/azq 5)");
r_core_cmd0 (core, "/azq 5");
R_LOG_INFO ("Scanning for strings constructed in code (/azs)");
r_core_cmd0 (core, "/azs");
if (!didAap) {
didAap = true;
R_LOG_INFO ("Finding function preludes (aap)");

View File

@ -2282,9 +2282,18 @@ static void search_hit_at(RCore *core, struct search_parameters *param, RCoreAsm
static bool do_analstr_search(RCore *core, struct search_parameters *param, bool quiet, const char *input) {
bool silent = false;
if (!input) {
input = "";
input = "5";
silent = true;
}
// const char *where = r_config_get (core->config, "anal.in");
const char *where = "bin.sections.x";
r_list_free (param->boundaries);
param->boundaries = r_core_get_boundaries_prot (core, R_PERM_X, where, "search");
if (r_list_empty (param->boundaries)) {
where = r_config_get (core->config, "anal.in");
param->boundaries = r_core_get_boundaries_prot (core, R_PERM_X, where, "search");
}
ut64 at;
RAnalOp aop;
int hasch = 0;
@ -2408,11 +2417,10 @@ static bool do_analstr_search(RCore *core, struct search_parameters *param, bool
lastch = UT64_MAX;
}
int inc = (core->search->align > 0)? core->search->align - 1: ret - 1;
if (inc < 0) {
inc = 0;
if (inc > 0) {
i += inc;
at += inc;
}
i += inc;
at += inc;
}
r_anal_op_fini (&aop);
}

View File

@ -13,11 +13,12 @@ RUN
NAME=mozi aae functions
FILE=bins/elf/analysis/loongarch64-curl
CMDS=<<EOF
e anal.depth=256
aae
aflc
EOF
EXPECT=<<EOF
403
400
EOF
RUN

View File

@ -7,6 +7,6 @@ afr
aflc
EOF
EXPECT=<<EOF
102
208
EOF
RUN

View File

@ -59,7 +59,7 @@ afi~complex[1]
afb.@main
EOF
EXPECT=<<EOF
165
167
0x0002bca0 0x0002bccc 00:0000 44 j 0x0002c534 f 0x0002bccc
EOF
RUN
@ -160,7 +160,7 @@ af
afl
EOF
EXPECT=<<EOF
0x00018c08 350 7132 main
0x00018c08 357 7340 main
EOF
RUN
@ -262,6 +262,10 @@ EXPECT=<<EOF
0x0002c4c4 0x0002c4c8 00:0000 4 j 0x0002c4c8
0x0002c4c8 0x0002c4d8 00:0000 16 j 0x0002c83c f 0x0002c4d8
0x0002c4d8 0x0002c4e8 00:0000 16 j 0x0002c81c f 0x0002c4e8
0x0002c4e8 0x0002c4f8 00:0000 16 j 0x0002c50c
0x0002c4f8 0x0002c508 00:0000 16 j 0x0002c814 f 0x0002c508
0x0002c508 0x0002c50c 00:0000 4 j 0x0002c50c
0x0002c50c 0x0002c534 00:0000 40 j 0x0002c4f8 f 0x0002c534
0x0002c534 0x0002c53c 00:0000 8
0x0002c53c 0x0002c550 00:0000 20 j 0x0002bfdc f 0x0002c550
0x0002c550 0x0002c560 00:0000 16 j 0x0002bed8 f 0x0002c560
@ -292,6 +296,8 @@ EXPECT=<<EOF
0x0002c7e8 0x0002c7f8 00:0000 16 j 0x0002c028 f 0x0002c7f8
0x0002c7f8 0x0002c80c 00:0000 20 j 0x0002c028
0x0002c80c 0x0002c814 00:0000 8 j 0x0002c200
0x0002c814 0x0002c81c 00:0000 8 j 0x0002c81c
0x0002c81c 0x0002c83c 00:0000 32 j 0x0002c83c
0x0002c83c 0x0002c868 00:0000 44 j 0x0002cbfc f 0x0002c868
0x0002c868 0x0002c898 00:0000 48 j 0x0002c8d4 f 0x0002c898
0x0002c898 0x0002c8a8 00:0000 16 j 0x0002ce58 f 0x0002c8a8

View File

@ -210,7 +210,7 @@ EXPECT=<<EOF
0x0045a8c0 132 flirt.__sigsetjmp
0x0045abc0 6232 flirt._quicksort
0x0045c620 19 flirt.__libc_secure_getenv
0x0045ce30 10673 flirt.group_number
0x0045ce30 10704 flirt.group_number
0x0045f800 13172 flirt._IO_vfprintf_internal
0x00462b80 976 flirt.hack_digit
0x00465a50 11033 flirt.___printf_fp

View File

@ -396,8 +396,8 @@ EXPECT=<<EOF
| 0x00005aed 4883e4f0 and rsp, 0xfffffffffffffff0
| 0x00005af1 50 push rax
| 0x00005af2 54 push rsp
| 0x00005af3 4c8d05660c01. lea r8, [0x00016760]
| 0x00005afa 488d0def0b01. lea rcx, [0x000166f0]
| 0x00005af3 4c8d05660c01. lea r8, [fcn.00016760] ; 0x16760
| 0x00005afa 488d0def0b01. lea rcx, [fcn.000166f0] ; 0x166f0
| 0x00005b01 488d3d68e5ff. lea rdi, main ; 0x4070 ; "AWAVAUATU\x89\xfdSH\x89\xf3H\x83\xecXH\x8b>dH\x8b\x04%("
\ 0x00005b08 ff150ac30100 call qword [reloc.__libc_start_main] ; [0x21e18:8]=0
0x00005b0e f4 hlt

View File

@ -376,7 +376,7 @@ pd 20 @ dbg.palya
EOF
EXPECT=<<EOF
;-- unit p(mozgkigyo palya(smallint,smallint)):
; CALL XREFS from main @ +0x1a87(x), +0x1c7d(x), +0x23f3(x), +0x3679(x)
; CALL XREFS from dbg.$main @ 0x405237(x), 0x40542d(x), 0x405ba3(x), 0x406e29(x)
/ 439: dbg.palya() ();
| ; var SmallInt mag @ rbp-0x8
| ; var SmallInt szel @ rbp-0x10