forked from lmammino/jwt-cracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargsParser.js
More file actions
42 lines (38 loc) · 976 Bytes
/
Copy pathargsParser.js
File metadata and controls
42 lines (38 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
import Constants from './constants.js'
export default class ArgsParser {
constructor () {
this.args = yargs(hideBin(process.argv))
.usage(
'Usage: jwt-cracker -t <token> [-a <alphabet>] [--max <maxLength>]'
)
.option('t', {
alias: 'token',
type: 'string',
describe: 'HS256 JWT token to crack',
demandOption: true
})
.option('a', {
alias: 'alphabet',
type: 'string',
describe: 'Alphabet to use for the brute force',
default: Constants.DEFAULT_ALPHABET
})
.option('max', {
describe: 'Maximum length of the secret',
default: Constants.DEFAULT_MAX_SECRET_LENGTH
})
.help()
.alias('h', 'help').argv
}
get token () {
return this.args.token
}
get alphabet () {
return this.args.alphabet
}
get maxLength () {
return this.args.max
}
}