Add jwt_show script
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 2 Oct 2019 21:22:44 +0000 (17:22 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 2 Oct 2019 21:22:44 +0000 (17:22 -0400)
home/bin/jwt_show [new file with mode: 0755]

diff --git a/home/bin/jwt_show b/home/bin/jwt_show
new file mode 100755 (executable)
index 0000000..e145c6d
--- /dev/null
@@ -0,0 +1,27 @@
+#! /usr/bin/awk -f
+
+function print_title(title,    _i) {
+    print title
+    for (_i = 1; _i <= length(title); _i++)
+        printf "="
+    printf "\n"
+}
+
+function print_decoded_field(field,    _i, _decode) {
+    _decode = "base64 -d | json_pp"
+    print $field | _decode
+    close(_decode)
+}
+
+BEGIN {
+    FS = "."
+}
+
+{
+    print_title("Header")
+    print_decoded_field(1)
+    print_title("Payload")
+    print_decoded_field(2)
+    print_title("Signature")
+    print $3
+}
This page took 0.027855 seconds and 4 git commands to generate.