From f7a8fc2ac5010cc48b55b8e6d723fbc6a13731e8 Mon Sep 17 00:00:00 2001 From: matthieu Bouamama Date: Wed, 6 Jan 2021 14:47:55 +0100 Subject: [PATCH] fix #40: print Error when value is not str type --- myjwt/__init__.py | 2 +- myjwt/variables.py | 3 ++- myjwt/vulnerabilities.py | 8 ++++---- requirements.txt | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/myjwt/__init__.py b/myjwt/__init__.py index 8897ae3..8b2a997 100644 --- a/myjwt/__init__.py +++ b/myjwt/__init__.py @@ -1,3 +1,3 @@ """autogenerated""" __version__ = "1.3.0" -__commit__ = "8123c371ec5cc36a83511d343a6d42dba484785a" +__commit__ = "f07aed632c8138e554bd6f1f6f60ac62346dab24" diff --git a/myjwt/variables.py b/myjwt/variables.py index dcdbf3e..edfe854 100644 --- a/myjwt/variables.py +++ b/myjwt/variables.py @@ -1,6 +1,7 @@ """ All Environment variables """ +import click from questionary import Separator NOT_VALID_JWT = "Enter a valid JWT!!!" @@ -12,7 +13,7 @@ VALID_DATA = "Enter a Valid data, Format: username=admin" VALID_HEADER = "Enter a Valid header, Format: username=admin" VALID_PAYLOAD_JSON = "Not a valid format for payload, send a json." -NEW_JWT = "new JWT: " +NEW_JWT = click.style("new JWT: ", fg='green') VALID_SIGNATURE = "Valid Signature!!" INVALID_SIGNATURE = "Incorrect signature!!" # User interface diff --git a/myjwt/vulnerabilities.py b/myjwt/vulnerabilities.py index 5188a18..adf3d67 100644 --- a/myjwt/vulnerabilities.py +++ b/myjwt/vulnerabilities.py @@ -200,10 +200,10 @@ def print_decoded(jwt: str): click.echo("Header: ") for key in jwt_json[HEADER].keys(): click.echo( - key + str(key) + " = " + ( - jwt_json[HEADER][key] + str(jwt_json[HEADER][key]) if jwt_json[HEADER][key] is not None else "null" ), @@ -213,10 +213,10 @@ def print_decoded(jwt: str): click.echo("Payload: ") for key in jwt_json[PAYLOAD].keys(): click.echo( - key + str(key) + " = " + ( - jwt_json[PAYLOAD][key] + str(jwt_json[PAYLOAD][key]) if jwt_json[PAYLOAD][key] is not None else "null" ), diff --git a/requirements.txt b/requirements.txt index e23a1c6..6c4a5dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ exrex==0.10.5 pyOpenSSL==20.0.1 questionary==1.9.0 requests==2.25.1 +colorama==0.4.4 \ No newline at end of file