* fast hack to fix the ff25 x86-64 opcode analysis

* better handling of choose index in hud
* Add ?ip to take input from ?I and select path to file
This commit is contained in:
pancake 2012-02-01 02:56:35 +01:00
parent 6ee952c388
commit 8886b07375
5 changed files with 32 additions and 8 deletions

View File

@ -788,6 +788,16 @@ static int x86_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len)
op->addr = addr;
op->jump = op->fail = -1;
op->ref = op->value = -1;
#if 1
// HACK FOR SOME OPCODEZ
if (anal->bits==64 && data[0] == 0xff && data[1] == 0x25) { // jmp qword [rip+off]
ut64 off = data[2] | data[3]<<8 | data[4]<<16 | data[5]<<24;
op->type = R_ANAL_OP_TYPE_JMP; // XXX: must be UJMP
op->jump = addr + off; // XXX: this opcode is a ref, not a direct jmp
op->length = 6;
return op->length;
}
#endif
ret = -1;
if (anal->bits==64)

View File

@ -70,8 +70,7 @@ static char *strmatch (char *pos, char *buf) {
}
R_API char *r_cons_hud(RList *list) {
int n, j, i = 0;
int ch, nch;
int ch, nch, first, n, j, i = 0;
int choose = 0;
char *p, buf[128];
RListIter *iter;
@ -80,6 +79,7 @@ R_API char *r_cons_hud(RList *list) {
buf[0] = 0;
r_cons_clear ();
for (;;) {
first = 1;
r_cons_gotoxy (0, 0);
n = 0;
match = NULL;
@ -95,10 +95,11 @@ R_API char *r_cons_hud(RList *list) {
if (strchr (buf, p[j]))
p[j] = toupper (p[j]);
}
r_cons_printf (" - %s\n", p);
r_cons_printf (" %c %s\n", first?'-':' ', p);
free (p);
if (x) *x = '\t';
if (n==0) match = pos;
if (first) match = pos;
first = 0;
}
n++;
}
@ -118,6 +119,7 @@ R_API char *r_cons_hud(RList *list) {
case 9: // \t
if (choose+1 < n)
choose++;
else choose = 0;
break;
case 10: // \n
case 13: // \r
@ -152,9 +154,11 @@ R_API char *r_cons_hud(RList *list) {
}
R_API char *r_cons_hud_path(const char *path, int dir) {
char *ret;
RList *files = r_sys_dir (path);
// TODO
eprintf ("TODO\n");
return NULL;
ret = r_cons_hud (files);
return ret;
}
// TODO: Add fmt support

View File

@ -1411,6 +1411,12 @@ static int cmd_help(void *data, const char *input) {
if (input[1]=='m') {
r_cons_message (input+2);
} else
if (input[1]=='p') {
char *p = r_cons_hud_path (input+2);
core->yank = (ut8*)p;
core->yank_len = p? strlen (p): 0;
core->num->value = (p != NULL);
} else
if (input[1]=='k') {
r_cons_any_key ();
} else
@ -1453,7 +1459,7 @@ static int cmd_help(void *data, const char *input) {
" ?v eip-0x804800 ; show hex value of math expr\n"
" ?= eip-0x804800 ; same as above without user feedback\n"
" ?? [cmd] ; ? == 0 run command when math matches\n"
" ?i[ynmk] prompt ; prompt for number or Yes,No,Msg,Key and store in $$?\n"
" ?i[ynmkp] arg ; prompt for number or Yes,No,Msg,Key,Path and store in $$?\n"
#if DONE
//BUT NOT DOCUMENTED AT ALL
" ?iy prompt ; yesno input prompt\n"

View File

@ -25,3 +25,5 @@ write hexadecimal data in current offset ?i hexpairs;wx `?y`
xor current block with hexpair key ?i hexpair key;wox `?y`
edit eval configuration Veq
calculator ?i enter math expression;? `?y`;?ik
disassemble 1024 bytes and pipe to less(1) b 1024;pd|less -R
todo ?im NOT YET IMPLEMENTED

View File

@ -30,8 +30,10 @@ R_API ut64 r_sys_now(void) {
}
R_API RList *r_sys_dir(const char *path) {
DIR *dir = opendir (path);
struct dirent *entry;
DIR *dir;
if (!path) return NULL;
dir = opendir (path);
if (dir) {
RList *list = r_list_new ();
if (list) {