public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mick <michaelkintzios@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] [OT] Script to crack gpg passphrase
Date: Thu, 28 Apr 2011 15:04:34 +0100	[thread overview]
Message-ID: <BANLkTi=UkxofbPrOZGVuyS3TWaBpPeMUkA@mail.gmail.com> (raw)
In-Reply-To: <201104271956.18941.michaelkintzios@gmail.com>

On 27 April 2011 19:56, Mick <michaelkintzios@gmail.com> wrote:
> On Wednesday 27 April 2011 19:15:46 felix@crowfix.com wrote:
>> On Tue, Apr 26, 2011 at 09:24:44PM +0100, Mick wrote:
>> > Back to plan A.  Any ideas how I can improve my script?
>>
>> Do you have any guesses as to your passphrase or is it a total shot in
>> the dark, could be anything from one word to a poem?
>>
>> Unless you can narrow it down tremendously, you're wasting time and it
>> will never be recovered.
>
> There are some candidate passphrases.  I tried them all with rephrase and all
> the permutations that I could think of.
>
> Now I am trying app-crypt/nasty, for brute force cracking, but I can't get it
> to work.  :-(
>
> It keeps popping up my pinentry and asking me for my default key passphrase,
> not the key I am trying to feed to it.
>
> Is there a way to change that script I posted so that it a)takes the
> passphrases from a file, or b)incrementally tries {a,b,...,z}, and/or capitals
> and/or numbers?

I'm making some good progress!

First I used the key to encrypt a file:

gpg -e file.txt

Then run this script to try to decrypt it:
==========================================
#!/bin/bash
#

# try all word in test.txt
for word in $(cat test.txt); do

  # try to decrypt with word
echo "${word}" | gpg --passphrase-fd 0 -q --batch --no-tty --output
file_success.txt -d file.txt.gpg;

  # if decrypt is successfull; stop
  if [ $? -eq 0 ]; then

    echo "GPG passphrase is: ${word}";
    exit 0;

  fi

done;

exit 1;
==========================================

This finds the passphrase and prints it out on the terminal.  However, its
success depends on the dictionary file I use.  Also, it's not particularly
fast ...

Any idea how I can create a dictionary file?  I've used apg but it's <aheam!>
too random.  :-)

I have been given something like 6 passphrases that may have been used.  The
problem is that at the time of creation the passphrase was typed in
incorrectly (twice!)  So I would need to use some method of generating a
dictionary with potential typos of these known passphrases (pretty much how
the rephrase application works).  What is a good way to generate such a file
by imputing a range of candidate characters?

Finally, is there a way or parallelising the run so that it speeds up?

-- 
Regards,
Mick



  reply	other threads:[~2011-04-28 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 14:20 [gentoo-user] [OT] Script to crack gpg passphrase Mick
2011-04-26 14:34 ` Paul Hartman
2011-04-26 15:42   ` Mick
2011-04-26 20:24     ` Mick
2011-04-27 18:15       ` felix
2011-04-27 18:56         ` Mick
2011-04-28 14:04           ` Mick [this message]
2011-04-28 16:47             ` Michael Orlitzky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=UkxofbPrOZGVuyS3TWaBpPeMUkA@mail.gmail.com' \
    --to=michaelkintzios@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox