Add option for output file

This commit is contained in:
binarymaster 2017-09-02 09:26:04 +03:00
parent 64ecc3e8c2
commit 622b086572
3 changed files with 11 additions and 1 deletions

View File

@ -65,6 +65,7 @@ Optional Arguments:
-b, --e-bssid : Enrollee BSSID
-S, --dh-small : Small Diffie-Hellman keys (PKr not needed) [No]
-v, --verbosity : Verbosity level 1-3, 1 is quietest [3]
-o, --output : Write output to file
-h : Display this usage screen
--help : Verbose help and more usage examples

View File

@ -41,7 +41,7 @@ uint32_t ecos_rand_simple(uint32_t *seed);
uint32_t ecos_rand_knuth(uint32_t *seed);
uint_fast8_t crack(struct global *g, unsigned int *pin);
static const char *option_string = "e:r:s:z:a:n:m:b:Sfv:Vh?";
static const char *option_string = "e:r:s:z:a:n:m:b:Sfo:v:Vh?";
static const struct option long_options[] = {
{ "pke", required_argument, 0, 'e' },
{ "pkr", required_argument, 0, 'r' },
@ -53,6 +53,7 @@ static const struct option long_options[] = {
{ "e-bssid", required_argument, 0, 'b' },
{ "dh-small", no_argument, 0, 'S' },
{ "force", no_argument, 0, 'f' },
{ "output", required_argument, 0, 'o' },
{ "verbosity", required_argument, 0, 'v' },
{ "version", no_argument, 0, 'V' },
{ "help", no_argument, 0, 0 },
@ -167,6 +168,13 @@ memory_err:
case 'f':
wps->bruteforce = 1;
break;
case 'o':
if (!freopen(optarg, "w", stdout))
{
snprintf(wps->error, 256, "\n [!] Failed to open file for writing -- %s\n\n", optarg);
goto usage_err;
}
break;
case 'v':
if (get_int(optarg, &wps->verbosity) != 0 || wps->verbosity < 1 || wps->verbosity > 3) {
snprintf(wps->error, 256, "\n [!] Bad verbosity level -- %s\n\n", optarg);

View File

@ -132,6 +132,7 @@ char usage[] =
" -b, --e-bssid : Enrollee BSSID\n"
" -S, --dh-small : Small Diffie-Hellman keys (PKr not needed) [No]\n"
" -v, --verbosity : Verbosity level 1-3, 1 is quietest [3]\n"
" -o, --output : Write output to file\n"
"\n"
" -h : Display this usage screen\n"
" --help : Verbose help and more usage examples\n"