Implement rax2 -rS and update manpage ##tools

This commit is contained in:
pancake 2023-05-23 19:36:06 +02:00 committed by pancake
parent 99c43664f9
commit c2153e9a2a
3 changed files with 23 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2020 - pancake */
/* radare - LGPL - Copyright 2009-2023 - pancake */
#include <r_main.h>

View File

@ -170,6 +170,7 @@ static int help(void) {
" -r r2 style output ; rax2 -r 0x1234\n"
" -s hexstr -> raw ; rax2 -s 43 4a 50\n"
" -S raw -> hexstr ; rax2 -S < /bin/ls > ls.hex\n"
" -rS raw -> hex.r2 ; rax2 -rS < /bin/ls > ls.r2 # script for r2\n"
" -t tstamp -> str ; rax2 -t 1234567890\n"
" -u units ; rax2 -u 389289238 # 317.0M\n"
" -v version ; rax2 -v\n"
@ -293,10 +294,24 @@ dotherax:
return true;
}
if (flags & (1 << 2)) { // -S
for (i = 0; i < len; i++) {
printf ("%02x", (ut8) str[i]);
if (flags & (1 << 18)) {
int j;
printf ("s+0\n");
for (i = 0; i < len;) {
printf ("wx+");
for (j = 0; j < 80 && i < len; j++, i++) {
printf ("%02x", (ut8) str[i]);
}
printf ("\n");
}
printf ("s-\n");
printf ("\n");
} else {
for (i = 0; i < len; i++) {
printf ("%02x", (ut8) str[i]);
}
printf ("\n");
}
printf ("\n");
return true;
} else if (flags & (1 << 3)) { // -b
int i;

View File

@ -1,4 +1,4 @@
.Dd Dec 28, 2020
.Dd Dec 28, 2023
.Dt RAX2 1
.Sh NAME
.Nm rax2
@ -29,6 +29,9 @@ Convert LONG to/from IP ADDRESS
Append newline to the decoded output for human friendly-ness
.It Fl K
Show randomart key asciiart for values or hexpairs
.It Fl r
Show the same output as the r2's `? 0x804` command.
When combined with -S (-rS) it will print r2 commands to write the actual binary into radare2
.It Fl s
Convert from hex string to character (rax2 \-s 43 4a 50)
.It Fl S