diff --git a/binr/rasc2/rasc2.c b/binr/rasc2/rasc2.c index 020502f79d..b4a20245eb 100644 --- a/binr/rasc2/rasc2.c +++ b/binr/rasc2/rasc2.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2007-2010 pancake <@nopcode.org> */ +/* radare - LGPL - Copyright 2007-2011 pancake <@nopcode.org> */ #include "rasc.h" #include "r_types.h" @@ -40,8 +40,8 @@ static int show_helpline() { } static int show_help() { - show_helpline(); - printf( + show_helpline (); + printf ( " -l [port] starts a syscall proxy server\n" " -A [n] prefix shellcode with N A's (0x41)\n" " -N [n] prefix shellcode with N nops (0x90)\n" @@ -78,18 +78,18 @@ char *filetostr(char *file) { if (fd == NULL) return NULL; - buf = (char *)malloc(size); + buf = (char *)malloc (size); buf[0]='\0'; - for(i=0;!feof(fd);i++) { + for (i=0;!feof(fd);i++) { if (i==size) { size = size + BLOCK; buf = realloc(buf, size); } - fread(buf+i, 1, 1, fd); + fread (buf+i, 1, 1, fd); } - fclose(fd); + fclose (fd); if (buf[0]=='\0') { - free(buf); + free (buf); return NULL; } return buf; @@ -100,7 +100,7 @@ int otf_patch() { /* on the fly patching */ if (scidx != -1) { if (shellcodes[scidx].cmd) { - ptr = getenv("CMD"); + ptr = getenv ("CMD"); if (ptr) { strcpy((char*) (shellcode+shellcodes[scidx].cmd), ptr); shellcode[shellcodes[scidx].cmd+strlen(ptr)]='\0'; @@ -109,7 +109,7 @@ int otf_patch() { } } if (shellcodes[scidx].host) { - ptr = getenv("HOST"); + ptr = getenv ("HOST"); if (ptr) { int x,y,z,w; sscanf(ptr,"%d.%d.%d.%d", &x,&y,&z,&w); @@ -120,10 +120,10 @@ int otf_patch() { } } if (shellcodes[scidx].port) { - ptr = getenv("PORT"); + ptr = getenv ("PORT"); if (ptr) { unsigned short port = atoi(ptr); - memcpy(shellcode+shellcodes[scidx].port,&port,2); + memcpy (shellcode+shellcodes[scidx].port,&port,2); } } } @@ -138,25 +138,24 @@ int otf_patch() { output[off+2] = foo[2]; output[off+3] = foo[3]; } - return 0; } int print_shellcode() { - int j=0,i=0; + int j=0, i=0; if (!(SCSIZE)) { - printf("No shellcode defined\n"); + printf ("No shellcode defined\n"); return 1; } if (SCSIZE>=BLOCK) { - printf("Dont overflow me\n"); + printf ("Dont overflow me\n"); return 1; } /* prepare output buffer */ - for(i=0;i 10 || -1 (on error) -{ +int hexpair2bin(const char *arg) { // (0A) => 10 || -1 (on error) unsigned char *ptr; unsigned char c = '\0'; unsigned char d = '\0'; @@ -260,9 +258,9 @@ int hexpair2bin(const char *arg) // (0A) => 10 || -1 (on error) int load_shellcode_from_me(char *str) { int i; - for(i=0;shellcodes[i].name;i++) { - if (!strcmp(shellcodes[i].name, str)) { - memcpy(shellcode, shellcodes[i].data, shellcodes[i].len); + for (i=0;shellcodes[i].name;i++) { + if (!strcmp (shellcodes[i].name, str)) { + memcpy (shellcode, shellcodes[i].data, shellcodes[i].len); scsize = shellcodes[i].len; scidx = i; //printf("Using %d bytes shellcode (%s) %02x %02x\n", shellcodes[i].len, shellcodes[i].desc, @@ -273,34 +271,29 @@ int load_shellcode_from_me(char *str) { return 0; } +// XXX: return value is always 0?? int load_shellcode_from_string(char *str) { - int i,j=1,ch,len; - char input2[1024]; - - // hexpairs to bin - strcpy(input2, str); - len = strlen(input2); + int i, j=1, ch, len; + char input2[BLOCK]; + strncpy (input2, str, BLOCK-1); + len = strlen (input2); input2[0] = '\0'; - for(i=0;i get_strings(); public RList get_symbols(); public RList get_relocs(); + public RList get_libs(); public RBin.Info get_info(); public int is_big_endian(); public int is_stripped(); diff --git a/swig/vapi/r_core.vapi b/swig/vapi/r_core.vapi index e02d5f448b..17b7d9c323 100644 --- a/swig/vapi/r_core.vapi +++ b/swig/vapi/r_core.vapi @@ -108,7 +108,7 @@ public class RCore { public uint64 offset; public uint64 size; public int rwx; - public int fd; + public RIO.Desc fd; } [CCode (cname="RCoreAsmHit", free_function="", ref_function="", unref_function="")]