Thu, 27 Aug 2020 05:49:41 -0700
I tried following the tutorial here but:
I then tried writing my own python script but got caught up on making the generic leet transformation function and gave up on the whole project for a while
My new attempt was using keepass-simple-crack-kit and HashcatRulesEngine.
problems: 1) keepass-simple-crack-kit was broken because the opening
code failed, looks like this can’t handle keepassxc’s kdbx files either
2) I didn’t see a way to only replace individual characters with
hashcatrulesengine. for example I wanted to change only a single
l
in hello
, but I couldn’t come up with a
rule, kept getting he11o
Finally went back to my own custom scripts with the previous
expreiences, I decided on a more hollistic approach of rule engines as
files piping into eachother. I developed two rules,
replace-combinations
which just replaces any instace of one
character with another (does not deal with multiple characters nor
replacing multiple at the same time)
rules/replace-combinations
:
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
from sys import argv, stdin
import re
def replacenth(string, sub, wanted, n):
= re.compile(sub)
pattern = [m for m in pattern.finditer(string)][n-1]
where = string[:where.start()]
before = string[where.end():]
after = before + wanted + after
newString
return newString
= argv[1]
from_char = argv[2]
to_char
for line in stdin:
= line.strip()
line print(line)
for i in range(line.count(from_char)):
print(replacenth(line, from_char, to_char, i))
And also a leet file just for helpin rules/leet
:
#!/usr/bin/env bash
./rules/replace-combinations e 3 | ./rules/replace-combinations i 1 | ./rules/replace-combinations o 0
to generate the word list:
cat password.file | ./rules/replace-combinations i e | ./rules/replace-combinations E e | ./rules/replace-combinations E '#' | ./rules/leet.sh | sort -u | ./rules/replace-combinations n N | ./rules/replace-combinations r R > word.list
and finally, to replace keepass-simple-crack-kit
:
$ for line in $(cat word.list); do keepassxc-cli open password.kdbx <<< "$line" |& grep Error || echo "$line" ; done | grep -v Error
Very homebrew, but it got the job done after a bit.
My word count was at 1000 words and it took a few minutes to find the right one.