Skip to content

Instantly share code, notes, and snippets.

@573
Created August 5, 2015 10:26
Show Gist options
  • Save 573/d842fe81984e903b3e6d to your computer and use it in GitHub Desktop.
Save 573/d842fe81984e903b3e6d to your computer and use it in GitHub Desktop.
Funny enough - How I recovered my lost Keepass password (Windows version)

How to

I needed some long-forgotten pass phrase only knowing it's stored within my Keepass database (~\Documents\MyKeepasses.kdbx below). I remembered vaguely it was anything around "auntie erna" but with variations on the letters more or less anywhere, see ll. 4 in leeter.hs (The source for leeter.hs) below. Luckily there's KeeCracker somewhere:

echo "Auntie$erna" | runhaskell ~\leeter.hs | ~\bin\bundles\KeeCracker\KeeCracker.exe -w - '~\Documents\MyKeepasses.kdbx'

Take home message in the 2nd place: pass phrases can never be safe enough

import Data.Char
import Data.List
-- here the potential variations/mutations on letters are stored/encoded
leets = ["oO0*;%&","aA4@;%&","lL1!;%&", "eE3;%&", "tT7;%&", "hHkK;%&", "iI1!;%&", "sS&5;%"]
leetchar c [] = nub [c, toUpper c, toLower c]
leetchar c (l:ls) = if c `elem` l then l else leetchar c ls
leet [] = return []
leet (x:xs) = do { p <- leetchar x leets ; n <- leet xs ; return $ p : n }
main :: IO ()
main = do { cs <- getContents ; mapM_ putStrLn (concatMap leet (lines cs)) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment