added debruijn offset to ragg2
This commit is contained in:
parent
c5a03b3fea
commit
1d949d4fae
|
@ -31,7 +31,8 @@ static int usage (int v) {
|
|||
" -p [padding] add padding after compilation (padding=n10s32)\n"
|
||||
" ntas : begin nop, trap, 'a', sequence\n"
|
||||
" NTAS : same as above, but at the end\n"
|
||||
" -P [size] prepend debrujn pattern\n"
|
||||
" -P [size] prepend debruijn pattern\n"
|
||||
" -q [fragment] debruijn pattern offset\n"
|
||||
" -r show raw bytes instead of hexpairs\n"
|
||||
" -s show assembler\n"
|
||||
" -v show version\n"
|
||||
|
@ -105,8 +106,10 @@ int main(int argc, char **argv) {
|
|||
int show_raw = 0;
|
||||
int append = 0;
|
||||
int show_str = 0;
|
||||
ut64 get_offset = 0;
|
||||
char *shellcode = NULL;
|
||||
char *encoder = NULL;
|
||||
char *sequence = NULL;
|
||||
int bits = (R_SYS_BITS & R_SYS_BITS_64)? 64: 32;
|
||||
int fmt = 0;
|
||||
const char *ofile = NULL;
|
||||
|
@ -117,7 +120,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
//egg->bin = r_buf_new ();
|
||||
|
||||
while ((c = getopt (argc, argv, "n:N:he:a:b:f:o:sxrk:FOI:Li:c:p:P:B:C:vd:D:w:z")) != -1) {
|
||||
while ((c = getopt (argc, argv, "n:N:he:a:b:f:o:sxrk:FOI:Li:c:p:P:B:C:vd:D:w:zq:")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
arch = optarg;
|
||||
|
@ -257,12 +260,16 @@ int main(int argc, char **argv) {
|
|||
case 'z':
|
||||
show_str = 1;
|
||||
break;
|
||||
case 'q':
|
||||
get_offset = 1;
|
||||
sequence = strdup (optarg);
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (optind == argc && !shellcode && !bytes && !contents && !encoder && !padding && !pattern && !append) {
|
||||
if (optind == argc && !shellcode && !bytes && !contents && !encoder && !padding && !pattern && !append && !get_offset) {
|
||||
return usage (0);
|
||||
} else file = argv[optind];
|
||||
|
||||
|
@ -273,6 +280,17 @@ int main(int argc, char **argv) {
|
|||
format = "elf64";
|
||||
}
|
||||
|
||||
// catch this first
|
||||
if (get_offset) {
|
||||
get_offset = r_num_math (0, sequence);
|
||||
printf ("Little endian: %d\n",
|
||||
r_debruijn_offset (get_offset, 1));
|
||||
printf ("Big endian: %d\n",
|
||||
r_debruijn_offset (get_offset, 0));
|
||||
free (sequence);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// initialize egg
|
||||
r_egg_setup (egg, arch, bits, 0, os);
|
||||
if (file) {
|
||||
|
|
|
@ -72,6 +72,8 @@ Append a 64bit number in little endian
|
|||
Specify generic paddings with a format string.
|
||||
.It Fl P Ar size
|
||||
Prepend debruijn sequence of given length.
|
||||
.It Fl q Ar fragment
|
||||
Output offset of debruijn sequence fragment.
|
||||
.It Fl F
|
||||
autodetect native file format (osx=mach0, linux=elf, ..)
|
||||
.It Fl O
|
||||
|
|
Loading…
Reference in New Issue