* Fix undo and redo commands

* Fix some manpages typos reported by lintian
* Asm testcase now forces x86 arch and 32 bits
This commit is contained in:
pancake 2011-12-05 08:27:16 +01:00
parent dc1efdcdd8
commit 49b45b64ac
7 changed files with 33 additions and 28 deletions

View File

@ -1119,8 +1119,11 @@ static int cmd_seek(void *data, const char *input) {
delta = (input[1]=='+')? core->blocksize: off;
r_io_sundo_push (core->io, core->offset);
r_core_seek_delta (core, delta);
} else if (r_io_sundo_redo (core->io))
r_core_seek (core, core->io->off, 0);
} else {
off = r_io_sundo_redo (core->io);
if (off != UT64_MAX)
r_core_seek (core, off, 0);
}
break;
case '-':
if (input[1]!='\0') {
@ -1128,7 +1131,7 @@ static int cmd_seek(void *data, const char *input) {
r_io_sundo_push (core->io, core->offset);
r_core_seek_delta (core, delta);
} else {
off = r_io_sundo (core->io);
off = r_io_sundo (core->io, core->offset);
if (off != UT64_MAX) {
r_core_seek (core, off, 0);
} else eprintf ("Cannot undo\n");

View File

@ -552,15 +552,18 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
break;
case 'u':
{
ut64 off = r_io_sundo (core->io);
ut64 off = r_io_sundo (core->io, core->offset);
if (off != UT64_MAX)
r_core_seek (core, off, 1);
else eprintf ("Cannot undo\n");
}
break;
case 'U':
if (r_io_sundo_redo (core->io))
r_core_seek (core, core->io->off, 1);
{
ut64 off = r_io_sundo_redo (core->io);
if (off != UT64_MAX)
r_core_seek (core, off, 1);
}
break;
case 'z':
if (zoom && cursor) {

View File

@ -279,9 +279,9 @@ R_API ut64 r_io_section_next(RIO *io, ut64 o);
R_API int r_io_undo_init(RIO *io);
R_API void r_io_undo_enable(RIO *io, int seek, int write);
/* seek undo */
R_API ut64 r_io_sundo(RIO *io);
R_API ut64 r_io_sundo(RIO *io, ut64 offset);
R_API ut64 r_io_sundo_last(RIO *io);
R_API int r_io_sundo_redo(RIO *io);
R_API ut64 r_io_sundo_redo(RIO *io);
R_API void r_io_sundo_push(RIO *io, ut64 off);
R_API void r_io_sundo_reset(RIO *io);
R_API void r_io_sundo_list(RIO *io);

View File

@ -30,45 +30,46 @@ R_API ut64 r_io_sundo_last(RIO *io) {
io->undo.seek[io->undo.idx-2] : io->off;
}
R_API ut64 r_io_sundo(RIO *io) {
R_API ut64 r_io_sundo(RIO *io, ut64 offset) {
ut64 off;
if (io->undo.idx == io->undo.limit)
r_io_sundo_push (io, 0);
if (io->undo.idx == io->undo.limit) {
r_io_sundo_push (io, offset);
io->undo.idx--;
}
io->undo.idx--;
if (io->undo.idx<0) {
io->undo.idx = 0;
return UT64_MAX;
}
off = io->undo.seek[io->undo.idx-1];
off = io->undo.seek[io->undo.idx];
io->off = r_io_section_vaddr_to_offset (io, off);
return off;
}
R_API int r_io_sundo_redo(RIO *io) {
R_API ut64 r_io_sundo_redo(RIO *io) {
ut64 off;
if (io->undo.idx<io->undo.limit) {
io->undo.idx += 1;
if (io->undo.idx<R_IO_UNDOS) {
io->off = io->undo.seek[io->undo.idx-1];
return R_TRUE;
r_io_sundo (io);
off = io->off = io->undo.seek[io->undo.idx];
io->off = r_io_section_vaddr_to_offset (io, off);
return off;
}
io->undo.idx -= 1;
}
return R_FALSE;
return UT64_MAX;
}
R_API void r_io_sundo_push(RIO *io, ut64 off) {
if (!io->undo.s_enable)
return;
//if (io->undo.seek[io->undo.idx-1] == off) return;
io->undo.seek[io->undo.idx] = off;
io->undo.idx++;
if (io->undo.idx==R_IO_UNDOS-1) {
io->undo.idx--;
//eprintf ("undo limit reached\n");
}
//if (io->undo.limit<io->undo.idx)
io->undo.limit = io->undo.idx;
io->undo.limit = io->undo.idx;
}
R_API void r_io_sundo_reset(RIO *io) {

View File

@ -19,8 +19,6 @@ The compiler used is the one configured by the CC environment. This has been tes
Uses sflib (shellforge4) includes to get the syscall definitions.
.Pp
Only linux/darwin x86-32/64 is supported at the moment. Planned support for more architectures.
.Pp
.Sh OPTIONS
.Pp
.Bl -tag -width Fl
@ -57,20 +55,20 @@ show hexpair bytes
hi.c.bin
.Pp
# Linked into a tiny binary. This is 294 bytes
$ wc -c < hi.c.bin
$ wc \-c < hi.c.bin
294
.Pp
$ ./hi.c.bin
Hello World
.Pp
# The compiled shellcode has zeroes
$ ragg2-cc -x hi.c
$ ragg2-cc \-x hi.c
e90000000083ec0ce800000000588d882a000000b804000000606a0651
6a0150cd8083c41061b8010000006a0050cd8083c40883c40cc368656c
6c6f0a00
.Pp
# Use a xor encoder with key 32 to bypass
$ ragg2 -e xor -c key=32 -B `ragg2-cc -x hi.c`
$ ragg2 \-e xor \-c key=32 \-B `ragg2-cc \-x hi.c`
6a3e596a205be8ffffffffc15e4883c60d301e48ffc6e2f9c920202020
a3cc2cc82020202078ada80a2020209824202020404a26714a2170eda0
a3e4304198212020204a2070eda0a3e428a3e42ce348454c4c4f2a20

View File

@ -35,7 +35,7 @@ Set architecture bits
.It Fl s Ar syntax
Select syntax output (intel, att)
.It Fl B
Binary input/output (-l is mandatory for binary input)
Binary input/output (\-l is mandatory for binary input)
.It Fl l Ar int
Input/Output length
.It Fl C

View File

@ -1,6 +1,6 @@
DEBUG=no
FILE=malloc://1024
ARGS=""
ARGS="-a x86 -b 32"
CMDS='
"wa nop;mov eax,33"
e asm.profile=simple