workshit/src/crack.nim

28 lines
681 B
Nim

import posix, strutils
{.passL: "-lcrypt".}
echo "What would you like to decrypt?"
var
line: string = readLine stdin
salt = line[0 .. 1]
count = 0
const
chars = "1234567890qwertyuiopasdfghjklzxcvbnm"
for c1 in chars:
for c2 in chars:
for c3 in chars:
for c4 in chars:
for c5 in chars:
for c6 in chars:
for c7 in chars:
for c8 in chars:
var res = crypt(c1&c2&c3&c4&c5&c6&c7&c8, salt)
if line.startsWith($res):
echo "password: " & c1&c2&c3&c4&c5&c6&c7&c8
echo "took " & $count & " tries"
quit 0
count = count + 1