* Bump revision to 0.4.5

* Implement 'c' command like in r1 (two missing cD && cc)
* Add missing signature in r_core.h
* r_io_t is now RIO in r_io.h
This commit is contained in:
pancake 2010-03-26 11:59:28 +01:00
parent cc732d3ee7
commit 7dd096fa27
7 changed files with 170 additions and 148 deletions

8
configure vendored
View File

@ -97,12 +97,12 @@ done
: ${INSTALL_PROGRAM:=${INSTALL} -m 755 -s}
: ${INSTALL_MAN:=${INSTALL} -m 444}
: ${INSTALL_LIB:=${INSTALL} -c}
PKGNAME='radare2' ; VERSION='0.4' ; CONTACT_MAIL="pancake@nopcode.org" ; CONTACT_NAME="pancake" ; CONTACT="pancake <pancake@nopcode.org>" ;
PKGNAME='radare2' ; VERSION='0.4.5' ; CONTACT_MAIL="pancake@nopcode.org" ; CONTACT_NAME="pancake" ; CONTACT="pancake <pancake@nopcode.org>" ;
}
show_usage() {
cat <<EOF2
'configure' configures radare2-0.4 to adapt to many kinds of systems.
'configure' configures radare2-0.4.5 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
@ -167,7 +167,7 @@ take_environ() {
}
show_version() {
echo "radare2-0.4 configuration script done with acr v0.8.2.
echo "radare2-0.4.5 configuration script done with acr v0.8.2.
The 'Free Software Foundation' message is only for autodetection.
Originally written by pancake <youterm.com>."
exit 0
@ -185,7 +185,7 @@ case $flag in
show_version ; ;;
"-r"|"--r"|"--report")
echo "PKGNAME: radare2"
echo "VERSION: 0.4"
echo "VERSION: 0.4.5"
echo "LANGS: c"
echo "REQUIRED: libdl"
echo "OPTIONAL: libewf"

View File

@ -1,5 +1,5 @@
PKGNAME radare2
VERSION 0.4
VERSION 0.4.5
CONTACT pancake ; pancake@nopcode.org
LANG_C!

View File

@ -575,69 +575,89 @@ static int cmd_bsize(void *data, const char *input) {
}
return 0;
}
// move it out // r_diff maybe?
static int radare_compare(RCore *core, const ut8 *f, const ut8 *d, int len) {
int i, eq = 0;
for (i=0;i<len;i++) {
if (f[i]==d[i]) {
eq++;
continue;
}
r_cons_printf ("0x%08llx (byte=%.2d) %02x '%c' -> %02x '%c'\n",
core->offset+i, i+1,
f[i], (IS_PRINTABLE(f[i]))?f[i]:' ',
d[i], (IS_PRINTABLE(d[i]))?d[i]:' ');
}
eprintf ("Compare %d/%d equal bytes\n", eq, len);
return len-eq;
}
static int cmd_cmp(void *data, const char *input) {
#if 0
int ret;
FILE *fd;
unsigned int off;
unsigned char *buf;
RCore *core = data;
#endif
FILE *fd;
ut8 *buf;
int ret;
ut32 v32;
ut64 v64;
switch (*input) {
case ' ':
radare_compare (core, core->block, (ut8*)input+1, strlen (input+1)+1);
break;
case 'x':
if (input[1]!=' ') {
eprintf ("Usage: cx 001122'\n");
return 0;
}
buf = (ut8*)malloc (strlen (input+2));
ret = r_hex_str2bin (input+2, buf);
if (ret<1) {
eprintf ("Cannot parse hexpair\n");
} else radare_compare (core, core->block, buf, ret);
free (buf);
break;
case 'X':
buf = malloc (core->blocksize);
ret = r_io_read_at (&core->io, r_num_math (&core->num, input+1), buf, core->blocksize);
radare_compare (core, core->block, buf, ret);
free(buf);
break;
case 'f':
if (input[1]!=' ') {
eprintf ("Please. use 'cf [file]'\n");
return 0;
}
fd = fopen (input+2, "rb");
if (fd == NULL) {
eprintf ("Cannot open file '%s'\n", input+2);
return 0;
}
buf = (ut8 *)malloc (core->blocksize);
fread (buf, 1, core->blocksize, fd);
fclose (fd);
radare_compare (core, core->block, buf, core->blocksize);
free (buf);
break;
case 'q':
v64 = (ut64) r_num_math (&core->num, input+1);
radare_compare (core, core->block, (u8*)&off, sizeof (v64));
break;
case 'd':
v32 = (ut32) r_num_math (&core->num, input+1);
radare_compare (core, core->block, (u8*)&v32, sizeof (v32));
break;
#if 0
case 'c':
radare_compare_code (
r_num_math (&core->num, input+1),
core->block, core->blocksize);
break;
case 'd':
off = (unsigned int) get_offset(input+1);
radare_compare((u8*)&off, config.block, 4);
break;
case 'f':
if (input[1]!=' ') {
eprintf("Please. use 'cf [file]'\n");
return 0;
}
fd = fopen(input+2, "r");
if (fd == NULL) {
eprintf("Cannot open file '%s'\n",input+2);
return 0;
}
buf = (unsigned char *)malloc(config.block_size);
fread(buf, 1, config.block_size, fd);
fclose(fd);
radare_compare(buf, config.block, config.block_size);
free(buf);
break;
case 'x':
if (input[1]!=' ') {
eprintf("Please. use 'wx 00 11 22'\n");
return 0;
}
buf = (unsigned char *)malloc(strlen(input+2));
ret = hexstr2binstr(input+2, buf);
radare_compare(buf, config.block, ret);
free(buf);
break;
case 'X':
{
u8 *buf = malloc(config.block_size);
radare_read_at(get_math(input+1), buf, config.block_size);
radare_compare_hex(config.seek+config.vaddr, buf, config.block, config.block_size);
free(buf);
}
break;
case ' ':
radare_compare((unsigned char*)input+1,config.block, strlen(input+1)+1);
break;
case 'D':
{
{ // XXX ugly hack
char cmd[1024];
sprintf(cmd, "radiff -b %s %s", ".curblock", input+2);
file_dump(".curblock", config.block, config.block_size);
sprintf (cmd, "radiff -b %s %s", ".curblock", input+2);
r_file_dump (".curblock", config.block, config.block_size);
radare_system(cmd);
unlink(".curblock");
}
@ -647,12 +667,13 @@ static int cmd_cmp(void *data, const char *input) {
r_cons_strcat (
"Usage: c[?cdfx] [argument]\n"
" c [string] Compares a plain with escaped chars string\n"
" cc [offset] Code bindiff current block against offset\n"
//" cc [offset] Code bindiff current block against offset\n"
" cd [value] Compare a doubleword from a math expression\n"
//" cD [file] Like above, but using radiff -b\n");
" cq [value] Compare a quadword from a math expression\n"
" cx [hexpair] Compare hexpair string\n"
" cX [addr] Like 'cc' but using hexdiff output\n"
" cf [file] Compare contents of file at current seek\n"
" cD [file] Like above, but using radiff -b\n");
break;
default:
eprintf ("Usage: c[?Ddxf] [argument]\n");

View File

@ -110,6 +110,7 @@ R_API char *r_core_cmd_str(struct r_core_t *core, const char *cmd);
R_API int r_core_cmd_foreach(struct r_core_t *core, const char *cmd, char *each);
/* anal.c */
R_API void r_core_anal_refs(RCore *core, ut64 addr, int gv);
R_API int r_core_anal_bb(struct r_core_t *core, ut64 at, int depth);
R_API int r_core_anal_bb_clean(struct r_core_t *core, ut64 addr);
R_API int r_core_anal_bb_add(struct r_core_t *core, ut64 addr, ut64 size, ut64 jump, ut64 fail);

View File

@ -85,15 +85,15 @@ typedef struct r_io_handle_t {
int (*init)();
struct r_io_undo_t undo;
struct debug_t *debug; // ???
int (*system)(struct r_io_t *io, int fd, const char *);
int (*open)(struct r_io_t *io, const char *, int rw, int mode);
int (*read)(struct r_io_t *io, int fd, ut8 *buf, int count);
ut64 (*lseek)(struct r_io_t *io, int fildes, ut64 offset, int whence);
int (*write)(struct r_io_t *io, int fd, const ut8 *buf, int count);
int (*close)(struct r_io_t *io, int fd);
int (*resize)(struct r_io_t *io, int fd, ut64 size);
int (*handle_open)(struct r_io_t *io, const char *);
//int (*handle_fd)(struct r_io_t *, int);
int (*system)(RIO *io, int fd, const char *);
int (*open)(RIO *io, const char *, int rw, int mode);
int (*read)(RIO *io, int fd, ut8 *buf, int count);
ut64 (*lseek)(RIO *io, int fildes, ut64 offset, int whence);
int (*write)(RIO *io, int fd, const ut8 *buf, int count);
int (*close)(RIO *io, int fd);
int (*resize)(RIO *io, int fd, ut64 size);
int (*handle_open)(RIO *io, const char *);
//int (*handle_fd)(RIO *, int);
int fds[R_IO_NFDS];
} RIOHandle;
@ -110,7 +110,7 @@ typedef int (*RIOWriteAt)(RIO *io, ut64 addr, const ut8 *buf, int size);
/* compile time dependency */
typedef struct r_io_bind_t {
int init;
struct r_io_t *io;
RIO *io;
RIOSetFd set_fd;
RIOReadAt read_at;
RIOWriteAt write_at;
@ -147,98 +147,98 @@ typedef struct r_io_desc_t {
#define r_io_bind_init(x) memset(&x,0,sizeof(x))
/* io/handle.c */
R_API struct r_io_t *r_io_new();
R_API struct r_io_t *r_io_free(struct r_io_t *io);
R_API int r_io_handle_init(struct r_io_t *io);
R_API int r_io_handle_open(struct r_io_t *io, int fd, struct r_io_handle_t *plugin);
R_API int r_io_handle_close(struct r_io_t *io, int fd, struct r_io_handle_t *plugin);
R_API int r_io_handle_generate(struct r_io_t *io);
R_API int r_io_handle_add(struct r_io_t *io, struct r_io_handle_t *plugin);
R_API int r_io_handle_list(struct r_io_t *io);
R_API RIO *r_io_new();
R_API RIO *r_io_free(RIO *io);
R_API int r_io_handle_init(RIO *io);
R_API int r_io_handle_open(RIO *io, int fd, struct r_io_handle_t *plugin);
R_API int r_io_handle_close(RIO *io, int fd, struct r_io_handle_t *plugin);
R_API int r_io_handle_generate(RIO *io);
R_API int r_io_handle_add(RIO *io, struct r_io_handle_t *plugin);
R_API int r_io_handle_list(RIO *io);
// TODO: _del ??
R_API struct r_io_handle_t *r_io_handle_resolve(struct r_io_t *io, const char *filename);
R_API struct r_io_handle_t *r_io_handle_resolve_fd(struct r_io_t *io, int fd);
R_API struct r_io_handle_t *r_io_handle_resolve(RIO *io, const char *filename);
R_API struct r_io_handle_t *r_io_handle_resolve_fd(RIO *io, int fd);
/* io/io.c */
R_API struct r_io_t* r_io_init(struct r_io_t *io);
R_API int r_io_set_write_mask(struct r_io_t *io, const ut8 *buf, int len);
R_API int r_io_open(struct r_io_t *io, const char *file, int flags, int mode);
R_API int r_io_open_as(struct r_io_t *io, const char *urihandler, const char *file, int flags, int mode);
R_API int r_io_redirect(struct r_io_t *io, const char *file);
R_API int r_io_set_fd(struct r_io_t *io, int fd);
R_API RBuffer *r_io_read_buf(struct r_io_t *io, ut64 addr, int len);
R_API int r_io_read(struct r_io_t *io, ut8 *buf, int len);
R_API int r_io_read_at(struct r_io_t *io, ut64 addr, ut8 *buf, int len);
R_API ut64 r_io_read_i(struct r_io_t *io, ut64 addr, int sz, int endian);
R_API int r_io_write(struct r_io_t *io, const ut8 *buf, int len);
R_API int r_io_write_at(struct r_io_t *io, ut64 addr, const ut8 *buf, int len);
R_API ut64 r_io_seek(struct r_io_t *io, ut64 offset, int whence);
R_API int r_io_system(struct r_io_t *io, const char *cmd);
R_API int r_io_close(struct r_io_t *io, int fd);
R_API ut64 r_io_size(struct r_io_t *io, int fd);
R_API RIO* r_io_init(RIO *io);
R_API int r_io_set_write_mask(RIO *io, const ut8 *buf, int len);
R_API int r_io_open(RIO *io, const char *file, int flags, int mode);
R_API int r_io_open_as(RIO *io, const char *urihandler, const char *file, int flags, int mode);
R_API int r_io_redirect(RIO *io, const char *file);
R_API int r_io_set_fd(RIO *io, int fd);
R_API RBuffer *r_io_read_buf(RIO *io, ut64 addr, int len);
R_API int r_io_read(RIO *io, ut8 *buf, int len);
R_API int r_io_read_at(RIO *io, ut64 addr, ut8 *buf, int len);
R_API ut64 r_io_read_i(RIO *io, ut64 addr, int sz, int endian);
R_API int r_io_write(RIO *io, const ut8 *buf, int len);
R_API int r_io_write_at(RIO *io, ut64 addr, const ut8 *buf, int len);
R_API ut64 r_io_seek(RIO *io, ut64 offset, int whence);
R_API int r_io_system(RIO *io, const char *cmd);
R_API int r_io_close(RIO *io, int fd);
R_API ut64 r_io_size(RIO *io, int fd);
/* io/cache.c */
R_API void r_io_cache_enable(struct r_io_t *io, int read, int write);
R_API void r_io_cache_init(struct r_io_t *io);
R_API int r_io_cache_write(struct r_io_t *io, ut64 addr, const ut8 *buf, int len);
R_API int r_io_cache_read(struct r_io_t *io, ut64 addr, ut8 *buf, int len);
R_API void r_io_cache_enable(RIO *io, int read, int write);
R_API void r_io_cache_init(RIO *io);
R_API int r_io_cache_write(RIO *io, ut64 addr, const ut8 *buf, int len);
R_API int r_io_cache_read(RIO *io, ut64 addr, ut8 *buf, int len);
/* io/bind.c */
R_API int r_io_bind(struct r_io_t *io, struct r_io_bind_t *bnd);
R_API int r_io_bind(RIO *io, struct r_io_bind_t *bnd);
/* io/map.c */
R_API void r_io_map_init(struct r_io_t *io);
R_API int r_io_map_add(struct r_io_t *io, int fd, int flags, ut64 delta, ut64 offset, ut64 size);
R_API int r_io_map_del(struct r_io_t *io, int fd);
R_API int r_io_map_list(struct r_io_t *io);
R_API int r_io_map(struct r_io_t *io, const char *file, ut64 offset);
R_API int r_io_map_read_at(struct r_io_t *io, ut64 off, ut8 *buf, int len);
//R_API int r_io_map_read_rest(struct r_io_t *io, ut64 off, ut8 *buf, ut64 len);
R_API int r_io_map_write_at(struct r_io_t *io, ut64 off, const ut8 *buf, int len);
R_API RIOMap *r_io_map_resolve(struct r_io_t *io, int fd);
R_API void r_io_map_init(RIO *io);
R_API int r_io_map_add(RIO *io, int fd, int flags, ut64 delta, ut64 offset, ut64 size);
R_API int r_io_map_del(RIO *io, int fd);
R_API int r_io_map_list(RIO *io);
R_API int r_io_map(RIO *io, const char *file, ut64 offset);
R_API int r_io_map_read_at(RIO *io, ut64 off, ut8 *buf, int len);
//R_API int r_io_map_read_rest(RIO *io, ut64 off, ut8 *buf, ut64 len);
R_API int r_io_map_write_at(RIO *io, ut64 off, const ut8 *buf, int len);
R_API RIOMap *r_io_map_resolve(RIO *io, int fd);
/* io/section.c */
R_API void r_io_section_init(struct r_io_t *io);
R_API void r_io_section_add(struct r_io_t *io, ut64 offset, ut64 vaddr, ut64 size, ut64 vsize, int rwx, const char *name);
R_API struct r_io_section_t *r_io_section_get_i(struct r_io_t *io, int idx);
R_API int r_io_section_rm(struct r_io_t *io, int idx);
R_API void r_io_section_list(struct r_io_t *io, ut64 offset, int rad);
R_API void r_io_section_list_visual(struct r_io_t *io, ut64 seek, ut64 len);
R_API struct r_io_section_t *r_io_section_get(struct r_io_t *io, ut64 offset);
R_API ut64 r_io_section_get_offset(struct r_io_t *io, ut64 offset);
R_API ut64 r_io_section_get_vaddr(struct r_io_t *io, ut64 offset);
R_API int r_io_section_get_rwx(struct r_io_t *io, ut64 offset);
R_API int r_io_section_overlaps(struct r_io_t *io, struct r_io_section_t *s);
R_API ut64 r_io_section_vaddr_to_offset(struct r_io_t *io, ut64 vaddr);
R_API ut64 r_io_section_offset_to_vaddr(struct r_io_t *io, ut64 offset);
R_API void r_io_section_init(RIO *io);
R_API void r_io_section_add(RIO *io, ut64 offset, ut64 vaddr, ut64 size, ut64 vsize, int rwx, const char *name);
R_API struct r_io_section_t *r_io_section_get_i(RIO *io, int idx);
R_API int r_io_section_rm(RIO *io, int idx);
R_API void r_io_section_list(RIO *io, ut64 offset, int rad);
R_API void r_io_section_list_visual(RIO *io, ut64 seek, ut64 len);
R_API struct r_io_section_t *r_io_section_get(RIO *io, ut64 offset);
R_API ut64 r_io_section_get_offset(RIO *io, ut64 offset);
R_API ut64 r_io_section_get_vaddr(RIO *io, ut64 offset);
R_API int r_io_section_get_rwx(RIO *io, ut64 offset);
R_API int r_io_section_overlaps(RIO *io, struct r_io_section_t *s);
R_API ut64 r_io_section_vaddr_to_offset(RIO *io, ut64 vaddr);
R_API ut64 r_io_section_offset_to_vaddr(RIO *io, ut64 offset);
/* undo api */
// track seeks and writes
// TODO: needs cleanup..kinda big?
R_API int r_io_undo_init(struct r_io_t *io);
R_API void r_io_undo_enable(struct r_io_t *io, int seek, int write);
R_API int r_io_undo_init(RIO *io);
R_API void r_io_undo_enable(RIO *io, int seek, int write);
/* seek undo */
R_API void r_io_sundo(struct r_io_t *io);
R_API ut64 r_io_sundo_last(struct r_io_t *io);
R_API void r_io_sundo_redo(struct r_io_t *io);
R_API void r_io_sundo_push(struct r_io_t *io);
R_API void r_io_sundo_reset(struct r_io_t *io);
R_API void r_io_sundo_list(struct r_io_t *io);
R_API void r_io_sundo(RIO *io);
R_API ut64 r_io_sundo_last(RIO *io);
R_API void r_io_sundo_redo(RIO *io);
R_API void r_io_sundo_push(RIO *io);
R_API void r_io_sundo_reset(RIO *io);
R_API void r_io_sundo_list(RIO *io);
/* write undo */
R_API void r_io_wundo_new(struct r_io_t *io, ut64 off, const ut8 *data, int len);
R_API void r_io_wundo_clear(struct r_io_t *io);
R_API int r_io_wundo_size(struct r_io_t *io);
R_API void r_io_wundo_list(struct r_io_t *io);
R_API int r_io_wundo_set_t(struct r_io_t *io, struct r_io_undo_w_t *u, int set) ;
R_API void r_io_wundo_set_all(struct r_io_t *io, int set);
R_API int r_io_wundo_set(struct r_io_t *io, int n, int set);
R_API void r_io_wundo_new(RIO *io, ut64 off, const ut8 *data, int len);
R_API void r_io_wundo_clear(RIO *io);
R_API int r_io_wundo_size(RIO *io);
R_API void r_io_wundo_list(RIO *io);
R_API int r_io_wundo_set_t(RIO *io, struct r_io_undo_w_t *u, int set) ;
R_API void r_io_wundo_set_all(RIO *io, int set);
R_API int r_io_wundo_set(RIO *io, int n, int set);
/* io/desc.c */
R_API int r_io_desc_init(struct r_io_t *io);
R_API int r_io_desc_add(struct r_io_t *io, int fd, const char *file, int flags, struct r_io_handle_t *handle);
R_API int r_io_desc_del(struct r_io_t *io, int fd);
R_API struct r_io_desc_t *r_io_desc_get(struct r_io_t *io, int fd);
R_API int r_io_desc_generate(struct r_io_t *io);
R_API int r_io_desc_init(RIO *io);
R_API int r_io_desc_add(RIO *io, int fd, const char *file, int flags, struct r_io_handle_t *handle);
R_API int r_io_desc_del(RIO *io, int fd);
R_API struct r_io_desc_t *r_io_desc_get(RIO *io, int fd);
R_API int r_io_desc_generate(RIO *io);
/* plugins */
@ -250,10 +250,10 @@ extern struct r_io_handle_t r_io_plugin_shm;
#endif
#if 0
#define CB_READ int (*cb_read)(struct r_io_t *user, int pid, ut64 addr, ut8 *buf, int len)
#define CB_WRITE int (*cb_write)(struct r_io_t *user, int pid, ut64 addr, const ut8 *buf, int len)
#define CB_READ int (*cb_read)(RIO *user, int pid, ut64 addr, ut8 *buf, int len)
#define CB_WRITE int (*cb_write)(RIO *user, int pid, ut64 addr, const ut8 *buf, int len)
#define CB_IO int (*cb_io)(void *user, CB_READ, CB_WRITE)
R_API int r_io_hook(struct r_io_t *io, CB_IO);
R_API int r_io_hook(RIO *io, CB_IO);
#endif
#endif

8
swig/configure vendored
View File

@ -92,12 +92,12 @@ done
: ${INSTALL_PROGRAM:=${INSTALL} -m 755 -s}
: ${INSTALL_MAN:=${INSTALL} -m 444}
: ${INSTALL_LIB:=${INSTALL} -c}
PKGNAME='radare2-swig' ; VERSION='0.4' ; CONTACT_MAIL="pancake@nopcode.org" ; CONTACT_NAME="pancake" ; CONTACT="pancake <pancake@nopcode.org>" ;
PKGNAME='radare2-swig' ; VERSION='0.4.5' ; CONTACT_MAIL="pancake@nopcode.org" ; CONTACT_NAME="pancake" ; CONTACT="pancake <pancake@nopcode.org>" ;
}
show_usage() {
cat <<EOF2
'configure' configures radare2-swig-0.4 to adapt to many kinds of systems.
'configure' configures radare2-swig-0.4.5 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
@ -160,7 +160,7 @@ take_environ() {
}
show_version() {
echo "radare2-swig-0.4 configuration script done with acr v0.8.2.
echo "radare2-swig-0.4.5 configuration script done with acr v0.8.2.
The 'Free Software Foundation' message is only for autodetection.
Originally written by pancake <youterm.com>."
exit 0
@ -178,7 +178,7 @@ case $flag in
show_version ; ;;
"-r"|"--r"|"--report")
echo "PKGNAME: radare2-swig"
echo "VERSION: 0.4"
echo "VERSION: 0.4.5"
echo "LANGS: c c++"
exit 0
;;

View File

@ -1,5 +1,5 @@
PKGNAME radare2-swig
VERSION 0.4
VERSION 0.4.5
CONTACT pancake ; pancake@nopcode.org
LANG_C!