Add r_bin.rar plugin, per-section arch/bits, fix in S=

Add Sa to set/get per-section arch and bits configuration
Cache io->section and core->io->section to speed up the Sa
Update r_sys_arch*
Add dummy plugin in asm/rar
Fix lines of S=
This commit is contained in:
pancake 2012-11-30 01:06:30 +01:00
parent a4b6835bcf
commit 7a0da18725
23 changed files with 407 additions and 53 deletions

37
libr/asm/p/asm_rar.c Normal file
View File

@ -0,0 +1,37 @@
/* radare - LGPL - Copyright 2012 - pancake */
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <r_types.h>
#include <r_util.h>
#include <r_lib.h>
#include <r_asm.h>
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, ut64 len) {
// TODO: support bitsize opcodes
return 0;
}
// XXX: This is wrong, some opcodes are 32bit in thumb mode
static int assemble(RAsm *a, RAsmOp *op, const char *buf) {
return 0;
}
RAsmPlugin r_asm_plugin_rar = {
.name = "rar",
.arch = "rar",
.bits = (int[]){ 32, 0 },
.desc = "RAR VM disassembly plugin",
.init = NULL,
.fini = NULL,
.disassemble = &disassemble,
.assemble = &assemble
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_ASM,
.data = &r_asm_plugin_rar
};
#endif

10
libr/asm/p/rar.mk Normal file
View File

@ -0,0 +1,10 @@
OBJ_RAR=asm_rar.o
# XXX
STATIC_OBJ+=${OBJ_RAR}
TARGET_RAR=asm_rar.${EXT_SO}
ALL_TARGETS+=${TARGET_RAR}
${TARGET_RAR}: ${OBJ_RAR}
${CC} $(call libname,asm_rar) ${LDFLAGS} ${CFLAGS} -o asm_rar.${EXT_SO} ${OBJ_RAR}

View File

@ -162,7 +162,7 @@ static RBinInfo* info(RBinArch *arch) {
return ret;
}
int size(RBinArch *arch) {
static int size(RBinArch *arch) {
ut64 text, data, syms, spsz;
int big_endian;
if (!arch->o->info)

160
libr/bin/p/bin_rar.c Normal file
View File

@ -0,0 +1,160 @@
/* radare - LGPL - Copyright 2012 - pancake */
#include <r_types.h>
#include <r_util.h>
#include <r_lib.h>
#include <r_bin.h>
#define RARVMHDR "\x52\x61\x72\x21\x1a\x07\x00\xf9\x4e\x73\x00\x00\x0e\x00\x00\x00"
static int check(RBinArch *arch) {
if (arch && arch->buf && arch->buf->buf)
if (!memcmp (arch->buf->buf, RARVMHDR, 16))
return R_TRUE;
return R_FALSE;
}
static int load(RBinArch *arch) {
return check (arch);
}
static int destroy (RBinArch *arch) {
return R_TRUE;
}
static ut64 baddr(RBinArch *arch) {
return 0;
}
static RList* entries(RBinArch *arch) {
RList* ret = r_list_new ();;
RBinAddr *ptr = NULL;
if (!ret) return NULL;
ret->free = free;
if (!memcmp (arch->buf+0x30, "\x00\x00\x00\x00\x20\x73\x74\x64\x6f\x75\x74\x20\x21\x55\x0c\xcd", 16)) {
if ((ptr = R_NEW (RBinAddr))) {
ptr->rva = ptr->offset = 0x9a;
r_list_append (ret, ptr);
}
}
return ret;
}
static RList* sections(RBinArch *arch) {
RList *ret = NULL;
RBinSection *ptr = NULL;
if (!(ret = r_list_new ()))
return NULL;
ret->free = free;
// TODO: return NULL here?
if (memcmp (arch->buf+0x30, "\x00\x00\x00\x00\x20\x73\x74\x64\x6f\x75\x74\x20\x21\x55\x0c\xcd", 16))
return ret;
// add text segment
if (!(ptr = R_NEW (RBinSection)))
return ret;
strncpy (ptr->name, "header", R_BIN_SIZEOF_STRINGS);
ptr->size =
ptr->vsize = 0x9a;
ptr->offset = 0;
ptr->rva = ptr->offset;
ptr->srwx = 4; // r--
r_list_append (ret, ptr);
/* rarvm code */
if (!(ptr = R_NEW (RBinSection)))
return ret;
strncpy (ptr->name, "rarvm", R_BIN_SIZEOF_STRINGS);
ptr->vsize = ptr->size = arch->buf->length - 0x9a;
ptr->rva = ptr->offset = 0x9a;
ptr->srwx = 5; // rw-
r_list_append (ret, ptr);
return ret;
}
static RList* symbols(RBinArch *arch) {
return NULL;
}
static RList* imports(RBinArch *arch) {
return NULL;
}
static RList* libs(RBinArch *arch) {
return NULL;
}
static RBinInfo* info(RBinArch *arch) {
const char *archstr;
RBinInfo *ret = R_NEW0 (RBinInfo);
int bits = 32;
if (!ret) return NULL;
strncpy (ret->file, arch->file, R_BIN_SIZEOF_STRINGS);
strncpy (ret->rpath, "NONE", R_BIN_SIZEOF_STRINGS);
strncpy (ret->rclass, "rar", R_BIN_SIZEOF_STRINGS);
strncpy (ret->os, "rar", R_BIN_SIZEOF_STRINGS);
archstr = "rar";
strncpy (ret->arch, archstr, R_BIN_SIZEOF_STRINGS);
strncpy (ret->machine, archstr, R_BIN_SIZEOF_STRINGS);
if (!memcmp (arch->buf+0x30, "\x00\x00\x00\x00\x20\x73\x74\x64\x6f\x75\x74\x20\x21\x55\x0c\xcd", 16)) {
strncpy (ret->subsystem, "rarvm", R_BIN_SIZEOF_STRINGS);
strncpy (ret->bclass, "program", R_BIN_SIZEOF_STRINGS);
strncpy (ret->type, "EXEC (Compressed executable)", R_BIN_SIZEOF_STRINGS);
} else {
strncpy (ret->subsystem, "archive", R_BIN_SIZEOF_STRINGS);
strncpy (ret->bclass, "archive", R_BIN_SIZEOF_STRINGS);
strncpy (ret->type, "ARCHIVE (Compressed archive)", R_BIN_SIZEOF_STRINGS);
}
// TODO: specify if its compressed or executable
ret->bits = bits;
ret->has_va = R_TRUE;
ret->big_endian = R_TRUE;
ret->dbg_info = 0;
ret->dbg_info = 0;
return ret;
}
static int size(RBinArch *arch) {
// TODO: walk rar structures and guess size here...
return 0x9a+128; // XXX
}
/* inspired in http://www.phreedom.org/solar/code/tinype/tiny.97/tiny.asm */
static RBuffer* create(RBin* bin, const ut8 *code, int codelen, const ut8 *data, int datalen) {
RBuffer *buf = r_buf_new ();
return buf;
}
struct r_bin_plugin_t r_bin_plugin_rar = {
.name = "rar",
.desc = "rarvm bin plugin",
.init = NULL,
.fini = NULL,
.load = &load,
.size = &size,
.destroy = &destroy,
.check = &check,
.baddr = &baddr,
.entries = &entries,
.sections = &sections,
.symbols = &symbols,
.imports = &imports,
.strings = NULL,
.info = &info,
.fields = NULL,
.libs = &libs,
.relocs = NULL,
.meta = NULL,
.write = NULL,
.create = &create,
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_BIN,
.data = &r_bin_plugin_pe
};
#endif

9
libr/bin/p/rar.mk Normal file
View File

@ -0,0 +1,9 @@
OBJ_RAR=bin_rar.o
STATIC_OBJ+=${OBJ_RAR}
TARGET_RAR=bin_rar.${EXT_SO}
ALL_TARGETS+=${TARGET_RAR}
${TARGET_RAR}: ${OBJ_RAR}
${CC} $(call libname,bin_rar) ${CFLAGS} ${OBJ_RAR}

View File

@ -837,12 +837,12 @@ R_API int r_core_anal_data (RCore *core, ut64 addr, int count, int depth) {
int len = core->blocksize;
int word = core->assembler->bits /8;
int endi = core->anal->big_endian;
int i, j, type;
int i, j;
if (addr != core->offset) {
buf = malloc (len);
memset (buf, 0xff, len);
int r = r_io_read_at (core->io, addr, buf, len);
//int r = r_io_read_at (core->io, addr, buf, len);
//int r = r_core_read_at (core, addr, buf, len);
// TODO: handle error here
}

View File

@ -1,29 +1,62 @@
/* radare - LGPL - Copyright 2009-2012 - pancake<nopcode.org> */
/* radare - LGPL - Copyright 2009-2012 - pancake */
static int cmd_section(void *data, const char *input) {
RCore *core = (RCore *)data;
switch (*input) {
case '?':
r_cons_printf (
" S ; list sections\n"
" S. ; show current section name\n"
" S? ; show this help message\n"
" S* ; list sections (in radare commands)\n"
" S= ; list sections (in nice ascii-art bars)\n"
" Sd [file] ; dump current section to a file (see dmd)\n"
" Sl [file] ; load contents of file into current section (see dml)\n"
" Sr [name] ; rename section on current seek\n"
" S ; list sections\n"
" S. ; show current section name\n"
" S? ; show this help message\n"
" S* ; list sections (in radare commands)\n"
" S= ; list sections (in nice ascii-art bars)\n"
" Sa[-] [arch] [bits] ; Specify arch and bits for given section\n"
" Sd [file] ; dump current section to a file (see dmd)\n"
" Sl [file] ; load contents of file into current section (see dml)\n"
" Sr [name] ; rename section on current seek\n"
" S [off] [vaddr] [sz] [vsz] [name] [rwx] ; add new section\n"
" S-[id|0xoff|*] ; remove this section definition\n");
" S-[id|0xoff|*] ; remove this section definition\n");
break;
case 'a':
switch (input[1]) {
case '\0':
{
int b = 0;
const char *n = r_io_section_get_archbits (core->io,
core->offset, &b);
if (n) r_cons_printf ("%s %d\n", n, b);
}
break;
case '-':
r_io_section_set_archbits (core->io, core->offset, NULL, 0);
break;
case '?':
default:
eprintf ("Usage: Sa[-][arch] [bits] [[off]]\n");
break;
case ' ':
{
char *p, *str = strdup (input+2); // SKIPSPACES HERE
p = strchr (str, ' ');
if (p) {
*p++ = 0;
if (r_io_section_set_archbits (core->io,
core->offset, str, atoi (p)))
r_core_seek (core, core->offset, 0);
else eprintf ("Cannot set arch/bits at 0x%08"PFMT64x"\n",
core->offset);
} else eprintf ("Missing argument\n");
free (str);
}
break;
}
break;
case 'r':
if (input[1]==' ') {
RIOSection *s;
int len = 0;
ut64 addr;
char *p;
p = strchr (input+2, ' ');
char *p = strchr (input+2, ' ');
if (p) {
addr = r_num_math (core->num, p+1);
len = (int)(size_t)(p-input+2);

View File

@ -419,6 +419,7 @@ R_API int r_core_init(RCore *core) {
core->rtr_n = 0;
core->blocksize_max = R_CORE_BLOCKSIZE_MAX;
core->vmode = R_FALSE;
core->section = NULL;
core->ffio = 0;
core->oobi = NULL;
core->oobi_len = 0;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2011-2012 // pancake<nopcode.org> */
/* radare - LGPL - Copyright 2011-2012 - pancake */
#include <r_core.h>
R_API void r_core_hack_help(RCore *core) {

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2012 - pancake */
/* radare2 - LGPL - Copyright 2009-2012 - pancake */
#include "r_core.h"
@ -90,12 +90,15 @@ beach:
}
R_API boolt r_core_seek(RCore *core, ut64 addr, boolt rb) {
RIOSection *newsection;
ut64 old = core->offset;
ut64 ret;
/* XXX unnecesary call */
//r_io_set_fd (core->io, core->file->fd);
core->io->section = core->section; // HACK
ret = r_io_seek (core->io, addr, R_IO_SEEK_SET);
newsection = core->io->section;
if (ret == UT64_MAX) {
//eprintf ("RET =%d %llx\n", ret, addr);
/*
@ -124,6 +127,15 @@ R_API boolt r_core_seek(RCore *core, ut64 addr, boolt rb) {
}
}
}
if (core->section != newsection) {//&& core->io->section->arch) {
int bits;// = core->io->section->bits;
const char *arch = r_io_section_get_archbits (core->io, core->offset, &bits);
if (arch && bits ) {
r_config_set (core->config, "asm.arch", arch);
r_config_set_i (core->config, "asm.bits", bits);
}
core->section = core->io->section;
}
return (ret==-1)? R_FALSE: R_TRUE;
}

View File

@ -168,6 +168,7 @@ extern RAsmPlugin r_asm_plugin_z80;
extern RAsmPlugin r_asm_plugin_i8080;
extern RAsmPlugin r_asm_plugin_m68k;
extern RAsmPlugin r_asm_plugin_arc;
extern RAsmPlugin r_asm_plugin_rar;
extern RAsmPlugin r_asm_plugin_dcpu16;
#endif

View File

@ -317,6 +317,7 @@ extern RBinPlugin r_bin_plugin_mach064;
extern RBinPlugin r_bin_plugin_java;
extern RBinPlugin r_bin_plugin_dex;
extern RBinPlugin r_bin_plugin_dummy;
extern RBinPlugin r_bin_plugin_rar;
extern RBinXtrPlugin r_bin_xtr_plugin_zip;
extern RBinXtrPlugin r_bin_xtr_plugin_fatmach0;
extern RBinXtrPlugin r_bin_xtr_plugin_dyldcache;

View File

@ -107,6 +107,7 @@ typedef struct r_core_t {
RDebug *dbg;
RFlag *flags;
RSearch *search;
RIOSection *section;
RSign *sign;
RFS *fs;
REgg *egg;

View File

@ -40,6 +40,19 @@ typedef struct r_io_map_t {
ut64 to;
} RIOMap;
typedef struct r_io_section_t {
char name[64]; // use strpool
ut64 offset;
ut64 vaddr;
ut64 size;
ut64 vsize;
int rwx;
int id;
/* */
int arch;
int bits;
} RIOSection;
typedef struct r_io_desc_t {
int fd;
int flags;
@ -106,6 +119,7 @@ typedef struct r_io_t {
struct list_head io_list;
RList *sections;
int next_section_id;
RIOSection *section; /* current section (cache) */
/* maps */
RList *maps; /*<RIOMap>*/
RList *desc;
@ -160,17 +174,6 @@ typedef struct r_io_bind_t {
RIOWriteAt write_at;
} RIOBind;
/* sections */
typedef struct r_io_section_t {
char name[64];
ut64 offset;
ut64 vaddr;
ut64 size;
ut64 vsize;
int rwx;
int id;
} RIOSection;
typedef struct r_io_cache_t {
ut64 from;
ut64 to;
@ -268,6 +271,9 @@ 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 RIOSection *r_io_section_get_name(RIO *io, const char *name);
R_API RIOSection *r_io_section_get_i(RIO *io, int idx);
R_API RIOSection *r_io_section_vget(RIO *io, ut64 addr);
R_API int r_io_section_set_archbits(RIO *io, ut64 addr, const char *arch, int bits);
R_API const char *r_io_section_get_archbits(RIO* io, ut64 addr, int *bits);
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);
@ -331,11 +337,4 @@ extern RIOPlugin r_io_plugin_ewf;
extern RIOPlugin r_io_plugin_zip;
#endif
#if 0
#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(RIO *io, CB_IO);
#endif
#endif

View File

@ -212,6 +212,7 @@ enum {
R_SYS_ARCH_Z80 = 0x4000,
R_SYS_ARCH_ARC = 0x8000,
R_SYS_ARCH_I8080 = 0x10000,
R_SYS_ARCH_RAR = 0x20000,
};
/* os */

View File

@ -11,7 +11,7 @@ include ../socket/deps.mk
.PHONY: pre
pre: libr_io.${EXT_SO} libr_io.${EXT_AR}
${MAKE} -C p
@${MAKE} -C p
include ${STATIC_IO_PLUGINS}
include $(TOP)/libr/rules.mk

View File

@ -340,9 +340,7 @@ R_API ut64 r_io_seek(struct r_io_t *io, ut64 offset, int whence) {
// if resolution fails... just return as invalid address
if (offset==UT64_MAX)
return UT64_MAX;
// TODO: implement io->enforce_seek here!
if (io->fd != NULL) {
// lseek_internal
if (io->plugin && io->plugin->lseek)
ret = io->plugin->lseek (io, io->fd, offset, whence);
// XXX can be problematic on w32..so no 64 bit offset?

View File

@ -45,16 +45,12 @@ R_API void r_io_section_add(RIO *io, ut64 offset, ut64 vaddr, ut64 size, ut64 vs
s->size = size;
s->vsize = vsize;
s->rwx = rwx;
s->arch = s->bits = 0;
if (!update) {
if (name) strncpy (s->name, name, sizeof (s->name)-4);
else *s->name = '\0';
r_list_append (io->sections, s);
//r_list_prepend (io->sections, s);
//r_list_add_sorted (io->sections, s, cmpaddr);
} //else {
// This is a bottleneck.. the sorting must be done at append time
// r_list_sort (io->sections, cmpaddr);
//}
}
}
R_API RIOSection *r_io_section_get_i(RIO *io, int idx) {
@ -86,9 +82,15 @@ R_API void r_io_section_list(RIO *io, ut64 offset, int rad) {
io->printf ("f section.%s %"PFMT64d" 0x%"PFMT64x"\n", n, s->size, s->vaddr);
io->printf ("S 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" %s %s\n",
s->offset, s->vaddr, s->size, s->vsize, n, r_str_rwx_i (s->rwx));
} else io->printf ("[%.2d] %c 0x%08"PFMT64x" %s va=0x%08"PFMT64x" sz=0x%08"PFMT64x" vsz=%08"PFMT64x" %s\n",
} else {
io->printf ("[%.2d] %c 0x%08"PFMT64x" %s va=0x%08"PFMT64x" sz=0x%08"PFMT64x" vsz=%08"PFMT64x" %s",
s->id, (offset>=s->offset && offset<s->offset+s->size)?'*':'.',
s->offset, r_str_rwx_i (s->rwx), s->vaddr, s->size, s->vsize, s->name);
if (s->arch && s->bits)
io->printf (" ; %s %d\n", r_sys_arch_str (s->arch), s->bits);
else io->printf ("\n");
}
i++;
}
}
@ -117,7 +119,9 @@ R_API void r_io_section_list_visual(RIO *io, ut64 seek, ut64 len) {
io->printf ("%02d%c 0x%08"PFMT64x" |",
i, (seek>=s->offset && seek<s->offset+s->size)?'*':' ', s->offset);
for (j=0; j<width; j++) {
if ((j*mul)+min >= s->offset && (j*mul)+min <=s->offset+s->size)
ut64 pos = min + (j*mul);
ut64 npos = min + ((j+1)*mul);
if (s->offset <npos && (s->offset+s->size)>pos)
io->printf ("#");
else io->printf ("-");
}
@ -142,15 +146,23 @@ R_API void r_io_section_list_visual(RIO *io, ut64 seek, ut64 len) {
}
}
R_API RIOSection *r_io_section_vget(RIO *io, ut64 addr) {
RListIter *iter;
RIOSection *s;
r_list_foreach (io->sections, iter, s) {
if (addr >= s->vaddr && addr < s->vaddr + s->size)
return s;
}
return NULL;
}
R_API RIOSection *r_io_section_get(RIO *io, ut64 addr) {
RListIter *iter;
RIOSection *s;
//addr = r_io_section_vaddr_to_offset(io, addr);
r_list_foreach (io->sections, iter, s) {
//eprintf ("CACA %llx\n", s->offset);
if (addr >= s->offset && addr <= s->offset + s->size) {
eprintf ("SG: %llx %s\n", addr, s->name);
if (addr >= s->offset && addr < s->offset + s->size) {
return s;
}
}
@ -170,7 +182,6 @@ R_API ut64 r_io_section_get_vaddr(RIO *io, ut64 offset) {
// TODO: deprecate
R_API int r_io_section_get_rwx(RIO *io, ut64 offset) {
RIOSection *s = r_io_section_get (io, offset);
eprintf ("r_io_section_get_rwx: must be deprecated\n");
return s?s->rwx:R_IO_READ|R_IO_WRITE|R_IO_EXEC;
}
@ -206,7 +217,7 @@ R_API ut64 r_io_section_vaddr_to_offset(RIO *io, ut64 vaddr) {
return (vaddr - s->vaddr + s->offset);
}
}
return -1;
return vaddr;
}
R_API ut64 r_io_section_offset_to_vaddr(RIO *io, ut64 offset) {
@ -216,6 +227,7 @@ R_API ut64 r_io_section_offset_to_vaddr(RIO *io, ut64 offset) {
if (offset >= s->offset && offset < s->offset + s->size) {
if (s->vaddr == 0) // hack
return offset;
io->section = s;
return (s->vaddr + offset - s->offset);
}
}
@ -242,3 +254,24 @@ goto restart;
}
return o;
}
R_API int r_io_section_set_archbits(RIO *io, ut64 addr, const char *arch, int bits) {
//RIOSection *s = r_io_section_vget (io, addr);
RIOSection *s = r_io_section_get (io, r_io_section_vaddr_to_offset (io, addr));
if (!s) return R_FALSE;
if (arch) {
s->arch = r_sys_arch_id (arch);
s->bits = bits;
} else {
s->arch = 0;
s->bits = 0;
}
return R_TRUE;
}
R_API const char *r_io_section_get_archbits(RIO* io, ut64 addr, int *bits) {
RIOSection *s = r_io_section_get (io, r_io_section_vaddr_to_offset (io, addr));
if (!s || !s->bits || !s->arch) return NULL;
if (bits) *bits = s->bits;
return r_sys_arch_str (s->arch);
}

View File

@ -162,7 +162,14 @@ R_API void r_print_code(RPrint *p, ut64 addr, ut8 *buf, int len, char lang) {
int i, w = p->cols*0.7;
switch (lang) {
case '?':
eprintf ("Valid print code formats are: JSON, C and Python (pcj, pc, pcp) \n");
eprintf ("Valid print code formats are: JSON, C, Python, Cstring (pcj, pc, pcp, pcs) \n");
break;
case 's':
p->printf ("\"");
for (i=0; !p->interrupt && i<len; i++) {
p->printf ("\\x%02x", buf[i]);
}
p->printf ("\"\n");
break;
case 'j':
p->printf ("[");

View File

@ -429,6 +429,7 @@ R_API void r_sys_perror(const char *fun) {
#endif
}
// TODO: use array :P
R_API int r_sys_arch_id(const char *arch) {
if (!strcmp (arch, "x86")) return R_SYS_ARCH_X86;
if (!strcmp (arch, "arm")) return R_SYS_ARCH_ARM;
@ -443,6 +444,11 @@ R_API int r_sys_arch_id(const char *arch) {
if (!strcmp (arch, "bf")) return R_SYS_ARCH_BF;
if (!strcmp (arch, "sh")) return R_SYS_ARCH_SH;
if (!strcmp (arch, "avr")) return R_SYS_ARCH_AVR;
if (!strcmp (arch, "dalvik")) return R_SYS_ARCH_DALVIK;
if (!strcmp (arch, "z80")) return R_SYS_ARCH_Z80;
if (!strcmp (arch, "arc")) return R_SYS_ARCH_ARC;
if (!strcmp (arch, "i8080")) return R_SYS_ARCH_I8080;
if (!strcmp (arch, "rar")) return R_SYS_ARCH_RAR;
return 0;
}
@ -460,6 +466,11 @@ R_API const char *r_sys_arch_str(int arch) {
if (arch & R_SYS_ARCH_BF) return "bf";
if (arch & R_SYS_ARCH_SH) return "sh";
if (arch & R_SYS_ARCH_AVR) return "avr";
if (arch & R_SYS_ARCH_DALVIK) return "dalvik";
if (arch & R_SYS_ARCH_Z80) return "z80";
if (arch & R_SYS_ARCH_ARC) return "arc";
if (arch & R_SYS_ARCH_I8080) return "i8080";
if (arch & R_SYS_ARCH_RAR) return "rar";
return "none";
}

View File

@ -20,6 +20,7 @@ asm.ppc
asm.dcpu16
asm.m68k
asm.mips
asm.rar
asm.x86
asm.x86_olly
asm.x86_nz
@ -50,6 +51,7 @@ bin.elf64
bin.java
bin.dex
bin.p9
bin.rar
bin.pe
bin.mz
bin.pe64

View File

@ -125,6 +125,7 @@ function goirc() {
default:
if (!msg.startsWith ("!")) return;
var o = "";
msg = msg.substring(1);
//msg = msg.replace (/>/g, "");
//msg = msg.replace (/|/g, "");
//msg = msg.replace (/!/g, "");

View File

@ -1,3 +1,40 @@
#if 0
entry0 = 0x9a
header:
526172211a0700f94e7300000e0000000000000000a197740000260003010000000000000210415221000000001d000600000000207374646f75742021550ccd10cd981181c8301d6be017692bf82af42bd4afe87a32f4e665e65e6c30e6d124f2003d93c9e689ec9ec9eb30b8e47a731ebd6b61ddeb3430bb76a83030f0304b30003000303e0ff77f30f9dc9da110700adc00000003000000a4
-- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 5261 7221 1a07 00f9 4e73 0000 0e00 0000 Rar!....Ns......
0x00000010 0000 0000 008b 0074 0000 2600 0901 0000 .......t..&.....
0x00000020 0000 0000 0210 4152 2100 0000 001d 0006 ......AR!.......
0x00000030 0000 0000 2073 7464 6f75 7420 2155 0ccd .... stdout !U..
0x00000040 10cd 9811 81c8 301d 6be0 1769 2bf8 2af4 ......0.k..i+.*.
0x00000050 2bd4 afe8 7a32 f4e6 65e6 5e6c 30e6 d124 +...z2..e.^l0..$
0x00000060 f200 3d93 c9e6 89ec 9ec9 eb30 b8e4 7a73 ..=........0..zs
0x00000070 1ebd 6b61 ddeb 3430 bb76 a830 30f0 304b ..ka..40.v.00.0K
0x00000080 3000 3000 303e 0ff7 7f30 f9dc 9da1 1070 0.0.0>...0.....p
0x00000090 0b3c 0000 0003 0000 00aa .<........
-- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 5261 7221 1a07 00f9 4e73 0000 0e00 0000 Rar!....Ns......
0x00000010 0000 0000 00a1 9774 0000 2600 0301 0000 .......t..&..... <--------
0x00000020 0000 0000 0210 4152 2100 0000 001d 0006 ......AR!.......
0x00000030 0000 0000 2073 7464 6f75 7420 2155 0ccd .... stdout !U..
0x00000040 10cd 9811 81c8 301d 6be0 1769 2bf8 2af4 ......0.k..i+.*.
0x00000050 2bd4 afe8 7a32 f4e6 65e6 5e6c 30e6 d124 +...z2..e.^l0..$
0x00000060 f200 3d93 c9e6 89ec 9ec9 eb30 b8e4 7a73 ..=........0..zs
0x00000070 1ebd 6b61 ddeb 3430 bb76 a830 30f0 304b ..ka..40.v.00.0K
0x00000080 3000 3000 303e 0ff7 7f30 f9dc 9da1 1070 0.0.0>...0.....p
0x00000090 0adc 0000 0003 0000 00a4 .......... <--------
0x15 : 0x8b00 -> 0xa197
0x1c : 0x09 -> 0x03
0x90 : 0x0b3c -> 0x0adc
0x99 : 0xaa -> 0xa4
#endif
#include <stdio.h>
#include <stdlib.h>
// crc32