From 1473bfa1efef8b4117bc48e4b0b24c10b8846619 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 4 Nov 2018 10:52:49 +0000 Subject: [PATCH] [Minor] Allow to print timestamp --- lualib/rspamadm/cookie.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lualib/rspamadm/cookie.lua b/lualib/rspamadm/cookie.lua index d6db58a634..b9995cdf9f 100644 --- a/lualib/rspamadm/cookie.lua +++ b/lualib/rspamadm/cookie.lua @@ -36,6 +36,8 @@ parser:option "-d --domain" :argname "" parser:flag "-D --decrypt" :description('Decrypt cookie instead of encrypting one') +parser:flag "-t --timestamp" + :description('Show cookie timestamp (valid for decrypting only)') parser:argument "cookie":args "?" :description('Use specified cookie') @@ -65,10 +67,14 @@ local function gen_cookie(args, key) extracted_cookie = args.cookie end - local dec_cookie = cr.decrypt_cookie(key, extracted_cookie) + local dec_cookie,ts = cr.decrypt_cookie(key, extracted_cookie) if dec_cookie then - print(dec_cookie) + if args.timestamp then + print(string.format('%s %s', dec_cookie, ts)) + else + print(dec_cookie) + end else print('cannot decrypt cookie') os.exit(1) -- 2.47.3