* Fail when binr build fails somewhere

* userconf R2_VERSION
* Implement some more # hashing algorithms
This commit is contained in:
pancake 2010-07-15 13:34:53 +02:00
parent c7acd5e206
commit 2f09509630
13 changed files with 114 additions and 98 deletions

105
TODO
View File

@ -11,15 +11,65 @@
Build system:
-------------
* Design new website...
* Write documentation about how to build r2, r2-swig, valaswig, make symstall and
some basics about the organization of the code (boring++)
* Store version information in libraries ? debian claims for it
* install.sh (to track installed files ..)
TODO edu
--------
* port r_sign and r_diff to RList
TODO nibble
-----------
* implement grep{col,row}
* trace counts after step..thats not correct!
* rabin2 doesnt works for fat mach-o
* #md5 #sha1 #entropy ...
TODO pancake
------------
* we need an api to define function signatures
- CF<addr> void name(int foo, char* var)
- arg/var set name/get value/ ..
* FileDescriptors: dd -- copy from !fd in r1
* implement RAnalCall (analyze function arguments, return values, propagate types..)
- define number of arguments for given function
- warn if signature and analysis differs in number of args or so..
TODO gerardo
------------
* implement GMP in util/big.c
unassigned TODO pointz
----------------------
* Implement a r_list_get_n() to get Nth element in linked list
* Test r_lib^w32/osx support
* Implement r_sys_setenv stuff from r1 in core/file.c:33 (!!?)
* Implement visual selection of bytes
* Implement more get_main() (NOOB)
---8<------------8<------------------8<---------------------8<------------- -- - -
0.6
===
* r_bin->relocs // RList of relocations
* rasign2 : must be done, write manpage
* distribute 'spp' with 'rarc2' ?
* Initial analysis looking for xrefs to strings and so? ax? ./a@@entry0 - Launched at startup
* nibble: diff code analysis
- diff two programs
1st level:
- check all functions EQUAL, DIFFERENT, REMOVED, ADDED
- check all symbols
- check all imports
- check all strings
2nd level:
- basic block level diffing (output in graph mode)
Questions:
----------
* We need a command to retrieve r2 version '?V'
* How to search for an opcode like CALL+REG? or MOV+CONST, ...
- r_anal_match(anal, aop CALL | REG) ?
- Implememnted in a command like /a..
@ -34,57 +84,6 @@ Questions:
- r_anal_aop_arg_set (); r_anal_aop_arg_get (); r_anal_aop_arg_binmask ();
* Cx/CX are not displayed in disasm as they should.. (C! must die)
TODO nibble
-----------
* rabin2 doesnt works for fat mach-o
* #md5 #sha1 #entropy ...
* trace counts after step..thats not correct!
* nibble: diff code analysis
- diff two programs
1st level:
- check all functions EQUAL, DIFFERENT, REMOVED, ADDED
- check all symbols
- check all imports
- check all strings
2nd level:
- basic block level diffing (output in graph mode)
* implement grep{col,row}
TODO pancake
------------
* FileDescriptors: dd -- copy from !fd in r1
* we need an api to define function signatures
- CF<addr> void name(int foo, char* var)
- arg/var set name/get value/ ..
* implement RAnalCall (analyze function arguments, return values, propagate types..)
- define number of arguments for given function
- warn if signature and analysis differs in number of args or so..
TODO gerardo
------------
* implement GMP in util/big.c
unassigned TODO pointz
----------------------
* Implement a r_list_get_n() to get Nth element in linked list
* Test r_lib^w32/osx support
* port r_sign to RList
* Implement r_sys_setenv stuff from r1 in core/file.c:33 (!!?)
* Implement visual selection of bytes
---8<------------8<------------------8<---------------------8<------------- -- - -
0.6
===
* r_bin->relocs // RList of relocations
* rasign2 : must be done, write manpage
* distribute 'spp' with 'rarc2' ?
* Initial analysis looking for xrefs to strings and so? ax? ./a@@entry0 - Launched at startup
Analysis
========
* Implement more get_main() (NOOB)
Bindings
========
* generate accessors automatically from valaswig

View File

@ -7,7 +7,7 @@ PFX=${DESTDIR}${PREFIX}
BINS=rax2 rasm2 rabin2 rahash2 radiff2 radare2 rafind2 rarc2
all:
@for a in ${BINS} ; do (cd $$a && ${MAKE} all); done
@for a in ${BINS} ; do (cd $$a && ${MAKE} all) || exit 1; done
install:
mkdir -p ${PFX}/bin

View File

@ -3,7 +3,6 @@ include ../../libr/config.mk
.PHONY: all clean
CFLAGS+=-I../../libr/include
CFLAGS+=-DVERSION=\"${VERSION}\"
CFLAGS+=-DLIBDIR=\"${PREFIX}/lib\"
#LIBS=$(subst r_,-lr_,$(DEPS))

View File

@ -608,7 +608,7 @@ int main(int argc, char **argv)
at = r_num_math (NULL, optarg);
break;
case 'V':
printf ("rabin2 v"VERSION"\n");
printf ("rabin2 v"R2_VERSION"\n");
return 0;
case 'h':
default:

View File

@ -31,7 +31,7 @@ static int main_help(int line) {
}
static int main_version() {
printf ("radare2 "VERSION" @ "R_SYS_OS"-"R_SYS_ENDIAN"-"R_SYS_ARCH"\n");
printf ("radare2 "R2_VERSION" @ "R_SYS_OS"-"R_SYS_ENDIAN"-"R_SYS_ARCH"\n");
return 0;
}

View File

@ -86,7 +86,7 @@ int main(int argc, char **argv) {
// mode = MODE_LOCS;
// break;
case 'V':
printf ("radiff2 v"VERSION"\n");
printf ("radiff2 v"R2_VERSION"\n");
return 0;
default:
return show_help (R_TRUE);

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
#include <stdio.h>
#include <stdlib.h>
@ -149,23 +149,23 @@ int main(int argc, char **argv) {
mode = R_SEARCH_KEYWORD;
hexstr = 1;
kw->str = optarg;
list_add(&(kw->list), &(kws_head));
list_add (&(kw->list), &(kws_head));
break;
case 'm':
// XXX should be from hexbin
mask = optarg;
break;
case 'f':
from = r_num_math(NULL, optarg);
from = r_num_math (NULL, optarg);
break;
case 't':
to = r_num_math(NULL, optarg);
to = r_num_math (NULL, optarg);
break;
case 'X':
pr = r_print_new();
pr = r_print_new ();
break;
case 'V':
printf("rafind2 v"VERSION"\n");
printf ("rafind2 v"R2_VERSION"\n");
return 0;
case 'h':
return show_help(argv[0], 0);

View File

@ -18,21 +18,21 @@ static int do_hash(const char *algo, const ut8 *buf, int len, int bsize, int rad
bsize = len;
ctx = r_hash_new (R_TRUE, algobit);
/* iterate over all algorithm bits */
for (i=1;i<0x800000;i<<=1) {
for (i=1; i<0x800000; i<<=1) {
if (algobit & i) {
dlen = r_hash_calculate(ctx, algobit&i, buf, len);
dlen = r_hash_calculate (ctx, algobit&i, buf, len);
if (dlen) {
c = ctx->digest;
if (rad) {
printf("e file.%s=", r_hash_name(i));
for(j=0;j<dlen;j++)
printf("%02x", c[j]);
printf("\n");
printf ("e file.%s=", r_hash_name(i));
for (j=0;j<dlen;j++)
printf ("%02x", c[j]);
printf ("\n");
} else {
printf("%s: ", r_hash_name(i));
printf ("%s: ", r_hash_name (i));
for(j=0;j<dlen;j++)
printf("%02x", c[j]);
printf("\n");
printf ("%02x", c[j]);
printf ("\n");
}
}
}
@ -72,25 +72,23 @@ int main(int argc, char **argv) {
algo = optarg;
break;
case 'b':
bsize = (int)r_num_math(NULL, optarg);
bsize = (int)r_num_math (NULL, optarg);
break;
case 's':
buf = (ut8*) optarg;
buf_len = strlen(optarg);
buf = (const ut8*) optarg;
buf_len = strlen (optarg);
break;
case 'V':
printf("rahash2 v"VERSION"\n");
printf ("rahash2 v"R2_VERSION"\n");
return 0;
case 'h':
return do_help(0);
return do_help (0);
}
}
if (optind<argc)
buf = (const ut8*)r_file_slurp(argv[optind], &buf_len);
buf = (const ut8*)r_file_slurp (argv[optind], &buf_len);
if (buf == NULL)
do_help(1);
else ret = do_hash(algo, buf, buf_len, bsize, rad);
else ret = do_hash (algo, buf, buf_len, bsize, rad);
return ret;
}

View File

@ -187,7 +187,7 @@ int main(int argc, char *argv[])
r_asm_set_big_endian (a, R_TRUE);
break;
case 'V':
printf ("rasm2 v"VERSION"\n");
printf ("rasm2 v"R2_VERSION"\n");
return 0;
case 'h':
return rasm_show_help ();

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2007-2009 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2007-2010 pancake<nopcode.org> */
#include <r_util.h>
@ -13,31 +13,30 @@ static int rax(const char *str) {
return 1;
}
int main(int argc, char **argv)
{
int main(int argc, char **argv) {
int i;
char buf[1024];
if (argc == 1) {
while(!feof(stdin)) {
fgets(buf, 1023, stdin);
if (feof(stdin)) break;
buf[strlen(buf)-1] = '\0';
if (!rax(buf)) break;
while (!feof (stdin)) {
fgets (buf, 1023, stdin);
if (feof (stdin)) break;
buf[strlen (buf)-1] = '\0';
if (!rax (buf)) break;
}
return 0;
}
if (argv[1][0]=='-') {
switch(argv[1][1]) {
switch (argv[1][1]) {
case 'h':
printf("Usage: rax2 [-hV] [expression]\n");
printf ("Usage: rax2 [-hV] [expression]\n");
return 0;
case 'V':
printf("rax2 v"VERSION"\n");
printf ("rax2 v"R2_VERSION"\n");
return 0;
}
}
for(i=1; i<argc; i++)
rax( argv[i] );
for (i=1; i<argc; i++)
rax (argv[i]);
return 0;
}

View File

@ -1057,6 +1057,9 @@ static int cmd_help(void *data, const char *input) {
break;
case '$':
return cmd_help (data, " $?");
case 'V':
r_cons_printf (R2_VERSION"\n");
break;
case 'z':
for (input=input+1; input[0]==' '; input=input+1);
core->num->value = strlen (input);
@ -2331,18 +2334,34 @@ static int cmd_hash(void *data, const char *input) {
if (ptr != NULL)
len = r_num_math (core->num, ptr+1);
/* TODO: support all hash algorithms and so */
if (!r_str_ccmp(input, "entropy", ' ')) {
r_cons_printf ("%lf\n", r_hash_entropy (core->block, len));
} else
if (!r_str_ccmp(input, "hamdist", ' ')) {
r_cons_printf ("%d\n", r_hash_hamdist (core->block, len));
} else
if (!r_str_ccmp(input, "pcprint", ' ')) {
r_cons_printf ("%d\n", r_hash_pcprint (core->block, len));
} else
if (!r_str_ccmp(input, "crc32", ' ')) {
r_cons_printf ("%04x\n", r_hash_crc32 (core->block, len));
} else
if (!r_str_ccmp(input, "xor", ' ')) {
r_cons_printf ("%02x\n", r_hash_xor (core->block, len));
} else
if (!r_str_ccmp(input, "crc16", ' ')) {
r_cons_printf ("%02x\n", r_hash_crc16 (0, core->block, len));
} else
if (input[0]=='?') {
r_cons_printf (
"Usage: #algo <size> @ addr\n"
" #xor ; calculate xor of all bytes in current block\n"
" #crc32 ; calculate crc32 of current block\n"
" #crc32 < /etc/fstab ; calculate crc32 of this file\n"
" #md5 128K @ edi ; calculate md5 of 128K from 'edi'\n"
" #pcprint ; count printable chars in current block\n"
" #hamdist ; calculate hamming distance in current block\n"
" #entropy ; calculate entropy of current block\n"
" #md5 128K @ edi ; calculate md5 of 128K from 'edi' (TODO)\n"
"Usage #!interpreter [<args>] [<file] [<<eof]\n"
" #! ; list all available interpreters\n"
" #!python ; run python commandline\n"

View File

@ -43,7 +43,7 @@ R_API int r_debug_desc_write(RDebug *dbg, int fd, ut64 addr, int len) {
R_API int r_debug_desc_list(RDebug *dbg, int rad) {
int count;
// callback or rlist? i would prefer rlist here..
RList *list = dbg->h->desc.list ();
//RList *list = dbg->h->desc.list ();
// TODO: loop here
return count;
}

View File

@ -11,6 +11,8 @@
#endif
#define PREFIX "@PREFIX@"
#define R2_VERSION "@VERSION@"
#define CPU_ENDIAN @BIG_ENDIAN@
#endif