Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Script to crack gpg passphrase
Date: Thu, 28 Apr 2011 14:06:14
Message-Id: BANLkTi=UkxofbPrOZGVuyS3TWaBpPeMUkA@mail.gmail.com
In Reply to: Re: [gentoo-user] [OT] Script to crack gpg passphrase by Mick
1 On 27 April 2011 19:56, Mick <michaelkintzios@×××××.com> wrote:
2 > On Wednesday 27 April 2011 19:15:46 felix@×××××××.com wrote:
3 >> On Tue, Apr 26, 2011 at 09:24:44PM +0100, Mick wrote:
4 >> > Back to plan A.  Any ideas how I can improve my script?
5 >>
6 >> Do you have any guesses as to your passphrase or is it a total shot in
7 >> the dark, could be anything from one word to a poem?
8 >>
9 >> Unless you can narrow it down tremendously, you're wasting time and it
10 >> will never be recovered.
11 >
12 > There are some candidate passphrases.  I tried them all with rephrase and all
13 > the permutations that I could think of.
14 >
15 > Now I am trying app-crypt/nasty, for brute force cracking, but I can't get it
16 > to work.  :-(
17 >
18 > It keeps popping up my pinentry and asking me for my default key passphrase,
19 > not the key I am trying to feed to it.
20 >
21 > Is there a way to change that script I posted so that it a)takes the
22 > passphrases from a file, or b)incrementally tries {a,b,...,z}, and/or capitals
23 > and/or numbers?
24
25 I'm making some good progress!
26
27 First I used the key to encrypt a file:
28
29 gpg -e file.txt
30
31 Then run this script to try to decrypt it:
32 ==========================================
33 #!/bin/bash
34 #
35
36 # try all word in test.txt
37 for word in $(cat test.txt); do
38
39 # try to decrypt with word
40 echo "${word}" | gpg --passphrase-fd 0 -q --batch --no-tty --output
41 file_success.txt -d file.txt.gpg;
42
43 # if decrypt is successfull; stop
44 if [ $? -eq 0 ]; then
45
46 echo "GPG passphrase is: ${word}";
47 exit 0;
48
49 fi
50
51 done;
52
53 exit 1;
54 ==========================================
55
56 This finds the passphrase and prints it out on the terminal. However, its
57 success depends on the dictionary file I use. Also, it's not particularly
58 fast ...
59
60 Any idea how I can create a dictionary file? I've used apg but it's <aheam!>
61 too random. :-)
62
63 I have been given something like 6 passphrases that may have been used. The
64 problem is that at the time of creation the passphrase was typed in
65 incorrectly (twice!) So I would need to use some method of generating a
66 dictionary with potential typos of these known passphrases (pretty much how
67 the rephrase application works). What is a good way to generate such a file
68 by imputing a range of candidate characters?
69
70 Finally, is there a way or parallelising the run so that it speeds up?
71
72 --
73 Regards,
74 Mick

Replies

Subject Author
Re: [gentoo-user] [OT] Script to crack gpg passphrase Michael Orlitzky <michael@××××××××.com>