Fix rax2 -S and ragg2-cc -x, better radiff2 error msg

rax2 -S is now obeying 0 input length for stdin streams
ragg2-cc -x is now working properly (needed rax2 -S)
Fix stupid parsing bug introduced in previous commit in armass
This commit is contained in:
pancake 2013-02-19 21:21:39 +01:00
parent 018b383344
commit 8186395ebd
4 changed files with 21 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2012 - pancake */
/* radare - LGPL - Copyright 2009-2013 - pancake */
#include <r_diff.h>
#include <r_core.h>
@ -197,7 +197,8 @@ int main(int argc, char **argv) {
bufa = (ut8*)r_file_slurp (file, &sza);
bufb = (ut8*)r_file_slurp (file2, &szb);
if (bufa == NULL || bufb == NULL) {
eprintf ("Error slurping source files\n");
eprintf ("radiff2: Cannot open: %s\n",
bufa? file2: file);
return 1;
}

View File

@ -1,6 +1,13 @@
#!/bin/sh
# ragg2-cc : a shellcode compiler -- pancake<nopcode.org> 2011
# - for bsd, linux and osx
# ragg2-cc : a shellcode compiler -- pancake - 2011-2013
#
# Supported operating systems:
# - GNU/Linux
# - OSX
# - BSD
# Supported compilers
# - gcc
# - clang
# TODO
# remove temporary files
# add support for arm
@ -226,7 +233,7 @@ if [ "$C" = 1 ]; then
exit 0
fi
[ "$X" = 1 ] && exec rax2 -S - < $F.text
[ "$X" = 1 ] && exec rax2 -S < $F.text
if [ "$D" ]; then
# hexdump -C $F.text

View File

@ -11,10 +11,9 @@ static int rax (char *str, int len, int last);
static int use_stdin ();
static int format_output (char mode, const char *s) {
ut64 n;
char *str = (char*) &n;
ut64 n = r_num_math (num, s);
const char *str = (char*) &n;
char strbits[65];
n = r_num_math (num, s);
if (flags & 2)
r_mem_copyendian ((ut8*) str, (ut8*) str, 4, 0);
@ -55,7 +54,7 @@ static int help () {
" -f floating point ; rax2 -f 6.3+2.1\n"
" -b binstr -> bin ; rax2 -b 01000101 01110110\n"
" -s hexstr -> raw ; rax2 -s 43 4a 50\n"
" -S raw -> hexstr ; rax2 -S C J P\n"
" -S raw -> hexstr ; rax2 -S < /bin/ls > ls.hex\n"
" -v version ; rax2 -V\n"
" -x hash string ; rax2 -x linux osx\n"
" -k randomart ; rax2 -k 0x34 1020304050\n"
@ -67,9 +66,9 @@ static int help () {
static int rax (char *str, int len, int last) {
float f;
ut8 *buf;
char *p, out_mode = (flags&128)?'I':'0';
char *p, out_mode = (flags&128)? 'I': '0';
int i;
if (!len)
if (!(flags&4) || !len)
len = strlen (str);
if ((flags & 4))

View File

@ -575,13 +575,13 @@ static AssembleFunction assemble[2] = { &arm_assemble, &thumb_assemble };
int armass_assemble(const char *str, unsigned long off, int thumb) {
int i, j;
char buf[128];
ArmOpcode aop = {0};
arm_opcode_parse (&aop, str);
aop.off = off;
ArmOpcode aop = {.off = off};
for (i=j=0; str[i] && i<sizeof (buf)-1; i++, j++) {
if (str[j]=='#') { i--; continue; }
buf[i] = tolower (str[j]);
}
buf[i] = 0;
arm_opcode_parse (&aop, buf);
if (!assemble[thumb] (&aop, buf)) {
printf ("armass: Unknown opcode (%s)\n", buf);
return -1;