enhance autotokens standalone

This commit is contained in:
vanhauser-thc
2024-08-29 14:12:32 +02:00
parent fe66a95d96
commit ab5f95e17a

View File

@ -5,7 +5,7 @@
#include <getopt.h> #include <getopt.h>
static int max_havoc = 16, verbose; static int max_havoc = 16, verbose;
static unsigned char *dict; static unsigned char *dict, *mh = "16";
extern int module_disabled; extern int module_disabled;
@ -29,6 +29,9 @@ int main(int argc, char *argv[]) {
printf(" -v verbose debug output to stderr.\n"); printf(" -v verbose debug output to stderr.\n");
printf(" -m val max mutations (1-val, val default is 16)\n"); printf(" -m val max mutations (1-val, val default is 16)\n");
printf(" -x file dictionary file (AFL++ format)\n"); printf(" -x file dictionary file (AFL++ format)\n");
printf("You can set the following environment variable parameters:\n");
printf("AUTOTOKENS_COMMENT` - what character or string starts a comment which will be\n");
printf(" removed. Default: \"/* ... */\"\n");
return 0; return 0;
} }
@ -43,6 +46,7 @@ int main(int argc, char *argv[]) {
case 'm': case 'm':
max_havoc = atoi(optarg); max_havoc = atoi(optarg);
mh = optarg;
break; break;
case 'v': case 'v':
verbose = 1; verbose = 1;
@ -127,6 +131,7 @@ int main(int argc, char *argv[]) {
/* configure autotokens */ /* configure autotokens */
setenv("AUTOTOKENS_LEARN_DICT", "1", 0); setenv("AUTOTOKENS_LEARN_DICT", "1", 0);
setenv("AUTOTOKENS_CREATE_FROM_THIN_AIR", "1", 0); setenv("AUTOTOKENS_CREATE_FROM_THIN_AIR", "1", 0);
setenv("AUTOTOKENS_CHANGE_MAX", mh, 0);
/* fake AFL++ state */ /* fake AFL++ state */
afl_state_t *afl = (afl_state_t *)calloc(1, sizeof(afl_state_t)); afl_state_t *afl = (afl_state_t *)calloc(1, sizeof(afl_state_t));