I have forgotten part of my password to Keepassxc database (.kdbx with keyfile). The password consists of 20 symbols, 17 of which are known. I have generated the list of all possible combinations using the characters I believe to be used in the unknown part of the password (they are put into charlist.txt) and following small one-liner:

for i in $(cat charlist.txt); do
  for j in $(cat charlist.txt); do
    for k in $(cat charlist); do
      echo $a$i$j$k
done > output.txt

Keepassxc allows me to read a password from stdin (either with keepassxc --pw-stdin or with keepassxc-cli; the first one opens the GUI with the stdin input and the second one asks for input in the usual form "enter the password"). However, I cannot wrap my head around the way to do it iteratively. There are 5832 lines in output.txt, which makes manual bruteforcing unfeasible.

How can I pass either the contents of the output.txt or the one-liner output to the keepassxc?


Maybe something like this:

while read p; do
         echo "$p" | keepassxc --pw-stdin; 
done <output.txt

I don't know the behavior of keepassxc when receiving a wrong input. Maybe be prepared for 5831 open error windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.