summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-08-25 19:31:23 -0400
committerjoe <joe@jerkface.net>2016-08-25 19:31:23 -0400
commita956054ce82e2b0ca9f46b6d34288c73c25df0c9 (patch)
tree4f6b378c09ae8a66ca09ef9fd21794e49d657dab
parent8925f9cdf05f27a905da20687c3141c90dc09c8d (diff)
Debug --dump option.
-rw-r--r--kiki.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/kiki.hs b/kiki.hs
index 854bf23..0dedc03 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -288,6 +288,14 @@ show_wk secring_file grip db = do
288 Message sec = flattenKeys False sec_db 288 Message sec = flattenKeys False sec_db
289 putStrLn $ listKeysFiltered (maybeToList grip) sec 289 putStrLn $ listKeysFiltered (maybeToList grip) sec
290 290
291debug_dump secring_file grip db = do
292 let sec_db = Map.filter gripmatch db
293 gripmatch (KeyData p _ _ _) =
294 Map.member secring_file (locations p)
295 || Map.member "&secret" (locations p)
296 Message sec = flattenKeys False sec_db
297 mapM_ print sec
298
291show_all db = do 299show_all db = do
292 let Message packets = flattenKeys True db 300 let Message packets = flattenKeys True db
293 putStrLn $ listKeys packets 301 putStrLn $ listKeys packets
@@ -531,6 +539,8 @@ kiki_usage bExport bImport bSecret cmd = putStr $
531 ," Outputs tor address and base32 hash of the PEM-format key in" 539 ," Outputs tor address and base32 hash of the PEM-format key in"
532 ," the given file." 540 ," the given file."
533 ,"" 541 ,""
542 ," --dump For debugging, a thorough info dump of your secret keyring."
543 ,""
534 ," --help Shows this help screen." 544 ," --help Shows this help screen."
535 ,"" 545 ,""
536 ] 546 ]
@@ -1189,6 +1199,7 @@ kiki "show" [] = kiki "show" ["--working"]
1189kiki "show" args = do 1199kiki "show" args = do
1190 let (sargs,margs) = processArgs sargspec polyVariadicArgs "--show" args 1200 let (sargs,margs) = processArgs sargspec polyVariadicArgs "--show" args
1191 sargspec = [ ("--working",0) --("--show-wk",0) 1201 sargspec = [ ("--working",0) --("--show-wk",0)
1202 , ("--dump",0) --("--show-all",0)
1192 , ("--all",0) --("--show-all",0) 1203 , ("--all",0) --("--show-all",0)
1193 , ("--whose-key",0) 1204 , ("--whose-key",0)
1194 , ("--key",1) 1205 , ("--key",1)
@@ -1249,6 +1260,7 @@ kiki "show" args = do
1249 ,("--wip",\[x] -> show_wip x $ fromMaybe "" grip) 1260 ,("--wip",\[x] -> show_wip x $ fromMaybe "" grip)
1250 ,("--cert",\[x] -> show_cert x $ fromMaybe "" grip) 1261 ,("--cert",\[x] -> show_cert x $ fromMaybe "" grip)
1251 ,("--torhash",\[x] -> show_torhash x) 1262 ,("--torhash",\[x] -> show_torhash x)
1263 ,("--dump", const $ debug_dump (rtSecring rt) grip)
1252 ] 1264 ]
1253 shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs 1265 shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs
1254 1266