diff --git a/libr/include/r_io.h b/libr/include/r_io.h index 94a5fb9c22..20478b9acf 100644 --- a/libr/include/r_io.h +++ b/libr/include/r_io.h @@ -457,7 +457,6 @@ extern RIOPlugin r_io_plugin_shm; extern RIOPlugin r_io_plugin_gdb; extern RIOPlugin r_io_plugin_rap; extern RIOPlugin r_io_plugin_http; -extern RIOPlugin r_io_plugin_haret; extern RIOPlugin r_io_plugin_bfdbg; extern RIOPlugin r_io_plugin_w32; extern RIOPlugin r_io_plugin_zip; diff --git a/libr/io/Jamroot b/libr/io/Jamroot index dfff30ffb7..3629131625 100644 --- a/libr/io/Jamroot +++ b/libr/io/Jamroot @@ -8,7 +8,6 @@ IO_OBJS += p/io_debug.c p/io_ewf.c p/io_gdb.c - p/io_haret.c p/io_http.c p/io_ihex.c p/io_mach.c diff --git a/libr/io/p/Makefile b/libr/io/p/Makefile index af7ec2a41e..a063f7015e 100644 --- a/libr/io/p/Makefile +++ b/libr/io/p/Makefile @@ -15,7 +15,7 @@ endif foo: all ALL_TARGETS= -PLUGINS=ptrace.mk debug.mk gdb.mk malloc.mk shm.mk mach.mk w32dbg.mk procpid.mk haret.mk windbg.mk +PLUGINS=ptrace.mk debug.mk gdb.mk malloc.mk shm.mk mach.mk w32dbg.mk procpid.mk windbg.mk #zip.mk #PLUGINS=ptrace.mk debug.mk gdb.mk malloc.mk mach.mk w32dbg.mk procpid.mk include ${PLUGINS} diff --git a/libr/io/p/haret.mk b/libr/io/p/haret.mk deleted file mode 100644 index 8d1a6aa4c1..0000000000 --- a/libr/io/p/haret.mk +++ /dev/null @@ -1,22 +0,0 @@ -OBJ_HARET=io_haret.o - -STATIC_OBJ+=${OBJ_HARET} -TARGET_HARET=io_haret.${EXT_SO} -ALL_TARGETS+=${TARGET_HARET} - -ifeq (${WITHPIC},0) -LINKFLAGS+=../../socket/libr_socket.a -LINKFLAGS+=../../util/libr_util.a -LINKFLAGS+=../../io/libr_io.a -else -LINKFLAGS+=-L../../socket -lr_socket -LINKFLAGS+=-L../../util -lr_util -LINKFLAGS+=-L.. -lr_io -endif -ifeq (${HAVE_LIB_SSL},1) -CFLAGS+=${SSL_CFLAGS} -LINKFLAGS+=${SSL_LDFLAGS} -endif - -${TARGET_HARET}: ${OBJ_HARET} - ${CC} $(call libname,io_haret) ${CFLAGS} $(LDFLAGS) ${OBJ_HARET} ${LINKFLAGS} diff --git a/libr/io/p/io_haret.c b/libr/io/p/io_haret.c deleted file mode 100644 index 5a0816a93a..0000000000 --- a/libr/io/p/io_haret.c +++ /dev/null @@ -1,146 +0,0 @@ -/* radare - LGPL - Copyright 2008-2011 pancake */ - -#include "r_io.h" -#include "r_lib.h" -#include "r_socket.h" -#include - -#define HARET_FD(x) ((RSocket*)(x->data)) - -//#if (sizeof(int)) > (sizeof(void*)) -//#error WTF int>ptr? wrong compiler or architecture? -//#endif - -//int haret_fd = -1; - -static int haret__write(struct r_io_t *io, RIODesc *fd, const ut8 *buf, int count) { - /* TODO */ - return 0; -} - -static void haret_wait_until_prompt(RSocket *s) { - unsigned char buf; - int off = 0; - for (;;) { - if (r_socket_read (s, &buf, 1) != 1) { - eprintf ("haret_wait_until_prompt: Unexpected eof in socket\n"); - return; - } - switch (off) { - case 0: if (buf == ')') off = 1; break; - case 1: if (buf == '#') return; off = 0; break; - } - } -} - -static int haret__read(RIO *io, RIODesc *fd, ut8 *buf, int count) { - char tmp[1024]; - int i = 0; - ut64 off; - st64 j; - RSocket *s = HARET_FD (fd); - - off = io->off & -4; - sprintf (tmp, "pdump 0x%"PFMT64x" %i\r\n", off, count+4); - r_socket_write (s, tmp, strlen (tmp)); - r_socket_read_block (s, (unsigned char *) tmp, strlen (tmp)+1); - j = (io->off - off)*2; - while (i= 0) { - r_socket_read_block (s, (ut8*) tmp, 11); - r_socket_read_block (s, (ut8*) tmp, 35); - if (i+16 < count || (io->off-off) == 0) { - tmp[35] = 0; - i += r_hex_str2bin (tmp+j, buf+i); - r_socket_read_block (s, (unsigned char *) tmp, 21); - } else { - tmp[(io->off - off)*2] = 0; - i += r_hex_str2bin (tmp+j, buf+i); - } - j = 0; - } - haret_wait_until_prompt (s); - return i; -} - -static int haret__close(RIODesc *fd) { - if (!fd || HARET_FD (fd)->fd==-1) - return -1; - return r_socket_close (HARET_FD (fd)); -} - -static int haret__plugin_open(struct r_io_t *io, const char *pathname, ut8 many) { - return (!strncmp (pathname, "haret://", 8)); -} - -static RIODesc *haret__open(struct r_io_t *io, const char *pathname, int rw, int mode) { - char *port, *ptr, buf[1024]; - RSocket *s; - - strncpy (buf, pathname, sizeof (buf)-1); - if (haret__plugin_open (io, pathname, 0)) { - ptr = buf + 8; - if (!(port = strchr (ptr, ':'))) { - eprintf ("haret: wrong url\n"); - return NULL; - } - if (!r_sandbox_enable (0)) { - eprintf ("sandbox: cannot use network\n"); - return NULL; - } - *port++ = 0; - if ((s = r_socket_new (R_FALSE)) == NULL) { - eprintf ("Cannot create new socket\n"); - return NULL; - } - if (!r_socket_connect_tcp (s, ptr, port, 30)) { - eprintf ("Cannot connect to '%s' (%s)\n", ptr, port); - return NULL; - } else eprintf ("Connected to: %s at port %s\n", ptr, port); - haret_wait_until_prompt (s); - //return r_io_desc_new (&r_io_plugin_haret, s->fd, pathname, rw, mode, (void*)s); - RETURN_IO_DESC_NEW (&r_io_plugin_haret, s->fd, pathname, rw, mode, (void*)s); - } - return NULL; -} - -static int haret__system(RIO *io, RIODesc *fd, const char *command) { - char buf; - int off = 0; - - r_socket_write (HARET_FD (fd), (char *)command, strlen(command)); - r_socket_write (HARET_FD (fd), "\r\n", 2); - for (;;) { - r_socket_read_block (HARET_FD (fd), (unsigned char *)&buf, 1); - eprintf ("%c", buf); - switch(off) { - case 0: if (buf == ')') off =1; break; - case 1: if (buf == '#') return 0; else off = 0; break; - } - } - - return 0; -} - -static ut64 haret__lseek(RIO *io, RIODesc *fd, ut64 off, int whence) { - return off; -} - -RIOPlugin r_io_plugin_haret = { - .name = "haret", - .desc = "Attach to Haret WCE application (haret://host:port)", - .license = "LGPL3", - .system = haret__system, - .open = haret__open, - .read = haret__read, - .lseek = haret__lseek, - .write = haret__write, - .close = haret__close, - .plugin_open = haret__plugin_open -}; - -#ifndef CORELIB -struct r_lib_struct_t radare_plugin = { - .type = R_LIB_TYPE_IO, - .data = &r_io_plugin_haret -}; -#endif diff --git a/plugins.def.cfg b/plugins.def.cfg index 151a85d383..1e1ad076f5 100644 --- a/plugins.def.cfg +++ b/plugins.def.cfg @@ -150,7 +150,6 @@ io.gzip io.http io.bfdbg io.gdb -io.haret io.mmap io.default io.self