When I started having the need of decoding JSON Web Tokens quite often, I felt the urge of writing a program that allowed me to do it quickly. There are excellent options, such as jwt.io, but as soon as you need to do this operation often it becomes clumsy. And if you need to process multiple tokens, or further process the output, it becomes a necessity.
That's why I wrote a little shell script that allows you to do just that. jwt-decode will accept a list of tokens as arguments and will decode them on standard output. The syntax is the following:
$ jwt-decode token ...
{
"alg": "RS256",
"typ": "JWT",
"kid": "sbS_BWBm0GzfIQRnYWolcWDRnjqwDTY_Aq6Fn_boqKM"
}
{
"jti": "271151a3-db11-4f37-a724-4cf9957774f4",
"exp": 1530979706,
"nbf": 0,
"iat": 1523117306,
"iss": "https://domain.com/auth/realms/realm",
"aud": "app-name",
"sub": "5132c417-d772-420e-b5db-401ea633dca1",
"typ": "Bearer",
"azp": "app",
"auth_time": 0,
"session_state": "84e6a759-e54d-4fd7-9fcf-bb51131aab89",
"acr": "1",
"allowed-origins": [
""
],
"realm_access": {
"roles": [
"role0",
"role1",
"role2"
]
},
"resource_access": {
"account": {
"roles": [
"manage-account",
"manage-account-links",
"view-profile"
]
}
},
"custom-property": "1797"
}
...
You can find jwt-cli on GitHub.
Pages
▼
Saturday, April 14, 2018
Monday, January 1, 2018
tm-cleanup.sh: A Shell Script to Delete Old Time Machine Backups Now Features an Interactive Interface
More than two years ago I wrote tm-cleanup.sh, a shell script to delete Time Machine backups. During this time it has proven very useful to me, and it's been serving its purpose as it is, with barely any modification at all.
However, I've been asked for help and clarifications quite a number of times by non-tech-savvy users who had some issues using the CLI. For this reason I thought that adding an interactive, dialog-based interface to this script may help people "visualise" what's going on when running tm-cleanup.sh.
The new interface has been added in v. 2.0.0, and can be opened by simply issuing the following command with no options:
$ sudo tm-cleanup.sh
The interactive interface opens a menu where the backup deletion operation can be triggered. The user is then presented the list of existing Time Machine backups and they can be individually selected and then deleted. Here's a screenshot of the interface showing the existing backups:
The documentation of the repository describes in detail both interfaces. I hope people will find it useful.
However, I've been asked for help and clarifications quite a number of times by non-tech-savvy users who had some issues using the CLI. For this reason I thought that adding an interactive, dialog-based interface to this script may help people "visualise" what's going on when running tm-cleanup.sh.
The new interface has been added in v. 2.0.0, and can be opened by simply issuing the following command with no options:
$ sudo tm-cleanup.sh
The interactive interface opens a menu where the backup deletion operation can be triggered. The user is then presented the list of existing Time Machine backups and they can be individually selected and then deleted. Here's a screenshot of the interface showing the existing backups:
The documentation of the repository describes in detail both interfaces. I hope people will find it useful.