New command pDi, Fix Vf- to remove flags, fix hamdist

This commit is contained in:
pancake 2013-03-04 00:33:14 +01:00
parent 007faa5f61
commit 53cf98c8df
6 changed files with 26 additions and 9 deletions

View File

@ -13,6 +13,8 @@ Broken stuff to fixe before release
0.9.4
=====
* ah -> add hint to define calls that do not return
* pdr doesnt works well with antidisasm tricks, wtf
* continue execution until condition happen (reg, mem, ..)
* rabin2 -x should not work on non-fatmach0 files
* foldable stuff .. was in r1..redo?

View File

@ -324,10 +324,11 @@ static int cmd_print(void *data, const char *input) {
int show_bytes = r_config_get_i (core->config, "asm.bytes");
int decode = r_config_get_i (core->config, "asm.decode");
const ut8 *buf = core->block;
int j, ret, err = 0;
int ilen, j, ret, err = 0;
RAsmOp asmop;
if (l==0) l = len;
for (i=j=0; j<len && j<l; i+=ret,j++) {
ilen = (*input=='D')? core->blocksize: 0xfffffff;
for (i=j=0; j<len && j<l && i<ilen; i+=ret, j++) {
r_asm_set_pc (core->assembler, core->offset+i);
ret = r_asm_disassemble (core->assembler, &asmop, buf+i, core->blocksize-i);
if (show_offset)
@ -371,7 +372,7 @@ static int cmd_print(void *data, const char *input) {
return R_TRUE;
}
break;
case 'r':
case 'r': // pdr
{
RAnalFunction *f = r_anal_fcn_find (core->anal, core->offset,
R_ANAL_FCN_TYPE_FCN|R_ANAL_FCN_TYPE_SYM);

View File

@ -250,15 +250,20 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
break;
case 'f':
{
int range;
char name[256], *n;
r_line_set_prompt ("flag name: ");
if (r_cons_fgets (name, sizeof (name), 0, NULL) >=0 && *name) {
int range = curset? (R_ABS (cursor-ocursor)+1): 1;
if (range<1) range=1;
n = r_str_chop (name);
if (*n) r_flag_set (core->flags, n, core->offset + cursor, range, 1);
}
}
if (*name=='-') {
if (*n) r_flag_unset (core->flags, n+1, NULL);
} else {
range = curset? (R_ABS (cursor-ocursor)+1): 1;
if (range<1) range = 1;
if (*n) r_flag_set (core->flags, n,
core->offset + cursor, range, 1);
}
} }
break;
case 'F':
r_flag_unset_i (core->flags, core->offset + cursor, NULL);

View File

@ -111,6 +111,10 @@ R_API int r_flag_set(RFlag *f, const char *name, ut64 off, ut32 size, int dup) {
RList *list2, *list;
dup = 0; // XXX: force nondup
if (!name || !*name) {
/* contract fail */
return R_FALSE;
}
if (dup) {
RFlagItem *item = R_NEW0 (RFlagItem);
item->space = f->space_idx;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2011 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2013 pancake */
#include "r_hash.h"
@ -53,6 +53,10 @@ R_API int r_hash_calculate(RHash *ctx, int algobit, const ut8 *buf, ut32 len) {
memcpy (ctx->digest, &res, R_HASH_SIZE_XXHASH);
return R_HASH_SIZE_XXHASH;
}
if (algobit & R_HASH_HAMDIST) {
*ctx->digest = r_hash_hamdist (buf, len);
return 1;
}
if (algobit & R_HASH_PCPRINT) {
*ctx->digest = r_hash_pcprint (buf, len);
return 1;

View File

@ -87,6 +87,7 @@ R_API int r_hash_size(int bit) {
if (bit & R_HASH_XXHASH) return R_HASH_SIZE_XXHASH;
if (bit & R_HASH_PARITY) return 1;
if (bit & R_HASH_ENTROPY) return 4; // special case
if (bit & R_HASH_HAMDIST) return 1;
if (bit & R_HASH_XOR) return 1;
if (bit & R_HASH_XORPAIR) return 1;
if (bit & R_HASH_MOD255) return 1;