From 7684008ab57e8718cb90458ed20c4f66a2887efe Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Wed, 3 Jun 2015 19:09:17 -0700 Subject: [PATCH] --- Tupfile | 3 ++- crack.nim | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 crack.nim diff --git a/Tupfile b/Tupfile index 9d4533b..053f19f 100644 --- a/Tupfile +++ b/Tupfile @@ -1,4 +1,5 @@ .gitignore include_rules -: crypt.nim |> !nim |> crypt \ No newline at end of file +: crypt.nim |> !nim |> crypt +: crack.nim |> !nim |> crack \ No newline at end of file diff --git a/crack.nim b/crack.nim new file mode 100644 index 0000000..92b79cd --- /dev/null +++ b/crack.nim @@ -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 \ No newline at end of file