mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-26 14:40:31 +00:00
* bin_load() is no longer mandatory in RCore
* Added dummy 7bit<->8bit char encoding * Random fixes in node-ffi and lib/t build
This commit is contained in:
parent
a94c9e4780
commit
f752759258
19
TODO
19
TODO
@ -9,17 +9,32 @@
|
||||
|
||||
MAXPRIO
|
||||
-------
|
||||
* More userfriendly visual mode
|
||||
- add <tab> for hex
|
||||
- W will write a string
|
||||
- _ -> write string does not obeys the cursor
|
||||
* rep+ret instruction (f3c3) should be identified as RET
|
||||
* p7 : 7bit encoding (sms)
|
||||
- variant for stego print? LSB, MSB, ...
|
||||
* Make r_io happy with RList
|
||||
* Kill kernel's list.h
|
||||
r_anal.h
|
||||
r_asm.h
|
||||
r_crypto.h
|
||||
r_parse.h
|
||||
r_reg.h
|
||||
r_syscall.h
|
||||
r_util.h
|
||||
* crackme mach0 happy with rbin
|
||||
* bin_load should not be necessary!
|
||||
* add support for sockets in rarun2
|
||||
* if no debugger supported, say so... r_io must ?
|
||||
* valabind must support luvit and nodejs (-ffi)
|
||||
* check search multiple keywords and signatures
|
||||
* Fix iterators for r_macro (test only?)
|
||||
- search for antidebug/disasm tricks opcodes
|
||||
- allows to find interesting points to analyze
|
||||
* get cparse ftw
|
||||
|
||||
* use slices for r_list_iter primitives
|
||||
|
||||
BUGS:
|
||||
* If [0-9] keybindings in visual point to same address use same reference
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2009-2011 nibble<.ds@gmail.com> */
|
||||
/* radare - LGPL - Copyright 2009-2012 nibble<.ds@gmail.com> */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -8,8 +8,7 @@
|
||||
#include <list.h>
|
||||
#include "../config.h"
|
||||
|
||||
static RAsmPlugin *asm_static_plugins[] =
|
||||
{ R_ASM_STATIC_PLUGINS };
|
||||
static RAsmPlugin *asm_static_plugins[] = { R_ASM_STATIC_PLUGINS };
|
||||
|
||||
static int r_asm_pseudo_align(struct r_asm_op_t *op, char *input) {
|
||||
eprintf ("TODO: .align\n"); // Must add padding for labels and others.. but this is from RAsm, not RAsmOp
|
||||
|
@ -150,8 +150,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
r_cons_printf ("???\n");
|
||||
} else r_cons_printf ("%s\n", asmop.buf_asm);
|
||||
}
|
||||
if (tbs)
|
||||
r_core_block_size (core, tbs);
|
||||
if (tbs) r_core_block_size (core, tbs);
|
||||
return err;
|
||||
}
|
||||
case 'D':
|
||||
|
@ -129,7 +129,7 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
int va = r->io->va || r->io->debug;
|
||||
|
||||
if (file == NULL) {
|
||||
if (r->file == NULL)
|
||||
if (!r->file || !r->file->filename)
|
||||
return R_FALSE;
|
||||
file = r->file->filename;
|
||||
}
|
||||
@ -141,15 +141,13 @@ R_API int r_core_bin_load(RCore *r, const char *file) {
|
||||
eprintf ("NOTE: Use -a and -b to select sub binary in fat binary\n");
|
||||
for (i=0; i<r->bin->narch; i++) {
|
||||
r_bin_select_idx (r->bin, i);
|
||||
if (r->bin->curarch.info == NULL) {
|
||||
eprintf ("No extract info found.\n");
|
||||
} else {
|
||||
if (r->bin->curarch.info) {
|
||||
eprintf (" $ r2 -a %s -b %d %s # 0x%08"PFMT64x"\n",
|
||||
r->bin->curarch.info->arch,
|
||||
r->bin->curarch.info->bits,
|
||||
r->bin->curarch.file,
|
||||
r->bin->curarch.offset);
|
||||
}
|
||||
} else eprintf ("No extract info found.\n");
|
||||
}
|
||||
}
|
||||
r_bin_select (r->bin, r->assembler->cur->arch, r->assembler->bits, NULL);//"x86_32");
|
||||
@ -203,13 +201,17 @@ R_API RCoreFile *r_core_file_open(RCore *r, const char *file, int mode, ut64 loa
|
||||
r_list_append (r->files, fh);
|
||||
|
||||
// r_core_bin_load (r, fh->filename);
|
||||
r_core_block_read (r, 0);
|
||||
cp = r_config_get (r->config, "cmd.open");
|
||||
if (cp && *cp)
|
||||
r_core_cmd (r, cp, 0);
|
||||
r_config_set (r->config, "file.path", file);
|
||||
r_config_set_i (r->config, "zoom.to", loadaddr+fh->size);
|
||||
fh->map = r_io_map_add (r->io, fh->fd->fd, mode, 0, loadaddr, fh->size);
|
||||
|
||||
//r_config_set_i (r->config, "io.va", 0);
|
||||
r_core_block_read (r, 0);
|
||||
//r_core_bin_load (r, NULL); // XXX: unnecessary call?
|
||||
//r_core_block_read (r, 0);
|
||||
return fh;
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,10 @@ R_API int r_print_date_w32(struct r_print_t *p, const ut8 *buf, int len);
|
||||
R_API int r_print_date_unix(struct r_print_t *p, const ut8 *buf, int len);
|
||||
R_API void r_print_zoom(RPrint *p, void *user, RPrintZoomCallback cb, ut64 from, ut64 to, int len, int maxlen);
|
||||
R_API void r_print_progressbar(RPrint *pr, int pc, int _cols);
|
||||
|
||||
// WIP
|
||||
R_API int r_print_unpack7bit (const char *src, char *dest);
|
||||
R_API int r_print_pack7bit (const char *src, char *dest);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
BINDEPS=r_lib r_util
|
||||
|
||||
include ../../config.mk
|
||||
|
||||
all: plugin.${EXT_SO} test-plugin${EXT_EXE}
|
||||
|
||||
plugin.${EXT_SO}:
|
||||
|
@ -1,5 +1,5 @@
|
||||
NAME=r_print
|
||||
DEPS=r_cons r_util r_asm r_anal
|
||||
OBJ=print.o format.o date.o disasm.o
|
||||
OBJ=print.o format.o date.o disasm.o seven.o
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2007-2011 pancake<nopcode.org> */
|
||||
/* radare - LGPL - Copyright 2007-2012 pancake<nopcode.org> */
|
||||
|
||||
#include "r_cons.h"
|
||||
#include "r_util.h"
|
||||
|
62
libr/print/seven.c
Normal file
62
libr/print/seven.c
Normal file
@ -0,0 +1,62 @@
|
||||
/* radare - LGPL - Copyright 2012 pancake<nopcode.org> */
|
||||
#include <r_print.h>
|
||||
|
||||
// TODO: work in progress
|
||||
|
||||
#if 0
|
||||
for(i=0; i<len; i++) {
|
||||
packing_7bit_character(config.block+i, buffer);
|
||||
cons_printf("%c", buffer[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
R_API int r_print_pack7bit (const char *src, char *dest) {
|
||||
int len, i, j = 0, shift = 0;
|
||||
ut8 ch1, ch2;
|
||||
char tmp[2];
|
||||
|
||||
*dest = '\0';
|
||||
len = strlen (src);
|
||||
|
||||
for (i=0; i<len; i++ ) {
|
||||
ch1 = src[i] & 0x7F;
|
||||
ch1 = ch1 >> shift;
|
||||
ch2 = src[(i+1)] & 0x7F;
|
||||
ch2 = ch2 << (7-shift);
|
||||
|
||||
ch1 = ch1 | ch2;
|
||||
|
||||
j = strlen(dest);
|
||||
sprintf (tmp, "%x", (ch1 >> 4));
|
||||
dest[j++] = tmp[0];
|
||||
sprintf (tmp, "%x", (ch1 & 0x0F));
|
||||
dest[j++] = tmp[0];
|
||||
dest[j++] = '\0';
|
||||
if (7 == ++shift) {
|
||||
shift = 0;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
R_API int r_print_unpack7bit (const char *src, char *dest) {
|
||||
int i, j, shift = 0, len = strlen (src);
|
||||
ut8 ch1, ch2 = '\0';
|
||||
char buf[8];
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
for (i=0; i<len; i+=2) {
|
||||
sprintf (buf, "%c%c", src[i], src[i+1]);
|
||||
ch1 = strtol (buf, NULL, 16);
|
||||
|
||||
j = strlen(dest);
|
||||
dest[j++] = ((ch1 & (0x7F >> shift)) << shift) | ch2;
|
||||
dest[j++] = '\0';
|
||||
ch2 = ch1 >> (7-shift);
|
||||
|
||||
shift++;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -5,3 +5,13 @@ FORCE_SOEXT=1
|
||||
SAVED=test.js test2.js
|
||||
|
||||
include ../rules.mk
|
||||
|
||||
npm:
|
||||
rm -rf node_modules/r2
|
||||
mkdir -p node_modules/r2
|
||||
${MAKE}
|
||||
cp package.json node_modules/r2/
|
||||
cp r_core.js node_modules/r2/index.js
|
||||
sed -e 's,./r_asm,r2,' test.js > node_modules/r2/test.js
|
||||
sed -e 's,./r_asm,r2,' test2.js > node_modules/r2/test2.js
|
||||
npm publish
|
||||
|
@ -1,7 +1,7 @@
|
||||
{ "name": "radare2.js",
|
||||
"version": "0.0.1",
|
||||
"url": "http://www.radare.org",
|
||||
"description": "automatic radare2 bindings for nodejs",
|
||||
"description": "radare2 valabind-ffi bindings for nodejs",
|
||||
"dependencies": {
|
||||
"node-ffi": "0.5"
|
||||
},
|
||||
|
@ -2,14 +2,22 @@ var r2 = require ("./r_core")
|
||||
|
||||
var c = new r2.RCore ()
|
||||
var cons = new r2.RCons (c.cons)
|
||||
var config = new r2.RConfig (c.config)
|
||||
|
||||
var ret = c.file_open ("test2.js", false, 0);
|
||||
if (ret.pointer.address != 0) {
|
||||
//console.log ("ret = ", ret);
|
||||
c.bin_load ("test2.js"); // if not called it will not work XXX must fix
|
||||
c.seek (0, true);
|
||||
c.block_read (0);
|
||||
//c.bin_load ("test.js");
|
||||
// c.seek (0, true); c.block_read (0);
|
||||
//c.cmd0 ("S 0x00000000 0x00000000 0x00013b30 0x00013b30 ehdr rwx");
|
||||
c.cmd0 ("o");
|
||||
c.cmd0 ("e io.va");
|
||||
cons.flush ();
|
||||
console.log ("sections {");
|
||||
c.cmd0 ("om");
|
||||
c.cmd0 ("S");
|
||||
cons.flush ();
|
||||
console.log ("}");
|
||||
c.block_read (0);
|
||||
c.cmd0 ("pD 8");
|
||||
c.cmd0 ("? 33+4");
|
||||
c.cmd0 ("x@0");
|
||||
|
@ -3,6 +3,7 @@ namespace Radare {
|
||||
[Compact]
|
||||
[CCode (cprefix="r_config_", cname="RConfig", free_function="r_config_free")]
|
||||
public class RConfig {
|
||||
public RConfig ();
|
||||
//TODO: public void setup_file(string file);
|
||||
public bool lock;
|
||||
public int last_notfound;
|
||||
|
Loading…
Reference in New Issue
Block a user