Skip to content

Fix crash for large JWT timestamp values#136

Open
PartyManCZ wants to merge 1 commit intoticarpi:masterfrom
PartyManCZ:fix-large-timestamps
Open

Fix crash for large JWT timestamp values#136
PartyManCZ wants to merge 1 commit intoticarpi:masterfrom
PartyManCZ:fix-large-timestamps

Conversation

@PartyManCZ
Copy link

If the JWT Token had an absurdly large timestamp the program would crash with:

Traceback (most recent call last): File "/home/kali/jwt_tool/jwt_tool.py", line 2152, in <module> rejigToken(headDict, paylDict, sig) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kali/jwt_tool/jwt_tool.py", line 1318, in rejigToken comparestamps, expiredtoken = dissectPayl(paylDict) ~~~~~~~~~~~^^^^^^^^^^ File "/home/kali/jwt_tool/jwt_tool.py", line 1212, in dissectPayl timestamp = datetime.fromtimestamp(int(paylDict[claim])) ValueError: year 57734 is out of range

This PR fixes that by not processing it and instead printing an out of range string like this:
[+] exp = 1759759297963 ==> TIMESTAMP = (timestamp 1759759297963 out of range)

  • Added a timezone parameter when translating into a human-readable time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant