ragg2
Radare2 Frontend for r_egg; Compiles Programs into Tiny Binaries for x86 and ARM Architectures
- Provided by: radare2 (Version: 6.0.7+ds-1)
- Report a bug
Radare2 Frontend for r_egg; Compiles Programs into Tiny Binaries for x86 and ARM Architectures
ragg2 |
[-FOLsrxhvz] [-a
arch] [-b
bits] [-k
os] [-o
file] [-i
sc] [-I
path] [-E
enc] [-B
hex] [-c
k=v] [-C
file] [-p
pad] [-q
off] [-S
string] [-f
fmt] [-nN
dword] [-dDw
off:hex] [-e
expr] |
Frontend for r_egg, compiling assembly programs into minimal binaries for x86-32, x86-64, and ARM architectures.
Built on top of r_asm and r_bin, it provides a library for generating small standalone binaries across supported platforms.
Programs generated by r_egg are relocatable and can be injected in a running process or on-disk binary file.
ragg2 can generate shellcodes from C code. The final code can be linked with rabin2 and it is relocatable, so it can be used to inject it on any remote process.
-a
arch-b
bits-B
hexpairs-c
k=v-C
file-d
off:dword-D
off:qword-e
egg-expr-E
encoder-f
format-F-h-H
var-i
shellcode-I
path-k
os-L-n
dword-N
dword-o
file-O-p
padding-P
size-q
fragment-r-s-S
string-v-w
off:hex-x-X
hexpairs-zR2_NOPLUGINSUsing r_egg language:
$ cat hi.r
/* hello world in r_egg */
write@syscall(4); //x64 write@syscall(1);
exit@syscall(1); //x64 exit@syscall(60);
main@global(128) {
.var0 = "hi!\n";
write(1,.var0, 4);
exit(0);
}
$ ragg2 -O -F hi.r
$ ./hi
hi!
Using C language:
$ cat hi.c
main() {
write(1, "Hello\n", 6);
exit(0);
}
$ ragg2 -O -F hi.c
$ ./hi
Hello
Tiny binary output:
$ wc -c < hi
165
Compiled shellcode with zeroes:
$ ragg2 hi.c | tail -1
eb0748656c6c6f0a00bf01000000488d35edffffffba06000000b8010
000000f0531ffb83c0000000f0531c0c3
Using XOR encoder with key 64:
$ ragg2 -e xor -c key=64 -B $(ragg2 hi.c | tail -1)
6a2d596a405be8ffffffffc15e4883c60d301e48ffc6e2f9ab4708252
c2c2f4a40ff4140404008cd75adbfbfbffa46404040f8414040404f45
71bff87c4040404f45718083
Written by pancake <pancake@nopcode.org>.