
Herramienta modular de línea de comandos para analizar, crear y manipular tokens JWT para hackers
Una herramienta modular de línea de comandos para analizar, crear y manipular tokens JSON Web Token (JWT) con fines de pruebas de seguridad.
instálelo usted mismo como:
$ gem install jwtear
888888 888 888 88888888888
"88b 888 o 888 888
888 888 d8b 888 888
888 888 d888b 888 888 .d88b. 8888b. 888d888
888 888d88888b888 888 d8P Y8b "88b 888P"
888 88888P Y88888 888 88888888 .d888888 888
888 8888P Y8888 888 Y8b. 888 888 888
888 888P Y888 888 "Y8888 "Y888888 888
.d88P v1.0.0
.d88P"
888P"
NAME
jwtear - Parse, create and manipulate JWT tokens.
SYNOPSIS
jwtear [global options] command [command options] [arguments...]
GLOBAL OPTIONS
-v, --version - Check current and latest version
-h, --help - Show this help message
COMMANDS
help - Shows a list of commands or help for one command
bruteforce, bfs - plugin to offline bruteforce and crack token's signature.
jws, s - Generate signature-based JWT (JWS) token.
jwe, e - Generate encryption-based JWT (JWE) token.
parse - Parse JWT token (accepts JWS and JWE formats).
wiki, w - A JWT wiki for hackers.
-h COMMAND$jwtear -h jws
NAME
jws - Generate signature-based JWT (JWS) token.
SYNOPSIS
jwtear [global options] jws [command options]
DESCRIPTION
Generate JWS and JWE tokens.
COMMAND OPTIONS
-h, --header=JSON - JWT header (JSON format). eg. {"typ":"JWT","alg":"HS256"}. Run 'jwtear gen -l' for supported algorithms. (required, default: none)
-p, --payload=JSON - JWT payload (JSON format). eg. {"login":"admin"} (required, default: none)
-k, --key=PASSWORD|PUB_KEY_FILE - Key as a password string or a file public key. eg. P@ssw0rd | eg. public_key.pem (default: none)
Los complementos se definen como subcomandos. Cada subcomando puede tener uno o más argumentos y/o opciones.
$ jwtear parse -t eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.J8SS8VKlI2yV47C4BtfYukWPx_2welF34Mz7l-MNmkE
$ jwtear jws -h '{"alg":"HS256","typ":"JWT"}' -p '{"user":"admin"}' -k p@ss0rd123
$ jwtear jwe -header '{"enc":"A192GCM","typ":"JWT"}' --payload '{"user":"admin"}' --key public.pem
$ jwtear bruteforce -v -t eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjpudWxsfQ.Tr0VvdP6rVBGBGuI_luxGCOaz6BbhC6IxRTlKOW8UjM -l ~/tmp/pass.list
Para añadir un nuevo complemento, cree un nuevo archivo ruby en el directorio plugins con la siguiente estructura
module JWTear
module CLI
extend GLI::App
extend JWTear::Helpers::Extensions::Print
extend JWTear::Helpers::Utils
desc "Plugin short description"
long_desc "Plugin long description"
command [:template, :pt] do |c|
c.action do |global, options, arguments|
print_h1 "Plugin template"
print_good "Hi, I'm a template."
template = TemplatePlugin.new
end
end
end
module Plugin
class TemplatePlugin
include JWTear::Helpers::Extensions::Print
include JWTear::Helpers::Utils
def initialize
check_dependencies
# ..code...
end
# ..code...
end
end
end
En lugar de incluir todas las dependencias para cada complemento en jwtear, puede añadir estas dependencias como un hash al método check_dependencies, que requerirá la biblioteca y lanzará un error suave al usuario para instalar las gemas faltantes.
La clave del hash es el nombre de la gema a instalar, el valor del hash es la cadena de require
deps = {'async-io' => 'async/ip'}
check_dependencies(deps)
Una vez que el usuario instale las dependencias faltantes, check_dependencies las requerirá una vez que se inicie la clase del complemento.
Los informes de errores y las solicitudes de extracción son bienvenidos en GitHub en https://github.com/[USERNAME]/jwtear.
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)La gema está disponible como código abierto bajo los términos de la Licencia MIT.