This commit is contained in:
Christine Dodrill 2015-06-03 19:09:17 -07:00
parent faca3f4446
commit 7684008ab5
2 changed files with 30 additions and 1 deletions

View File

@ -1,4 +1,5 @@
.gitignore
include_rules
: crypt.nim |> !nim |> crypt
: crypt.nim |> !nim |> crypt
: crack.nim |> !nim |> crack

28
crack.nim Normal file
View File

@ -0,0 +1,28 @@
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