Bitcoin Forum

Other => Off-topic => Topic started by: bitjet on October 19, 2012, 07:59:28 PM



Title: Cracking 7zip file you have the pass to.. Almost.?
Post by: bitjet on October 19, 2012, 07:59:28 PM
Hey guys Im trying to unzip a file with a 40char password. I have the password but the capitalization and possily order of the phrasing is unknown all manual entry tries have failed. Would it even be possible to crack this file under 256it encryption? Even with 99.9% of the passphrase is known?


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: SgtSpike on October 19, 2012, 08:22:18 PM
EDIT:  My maths skills fail at life today.  Will be back tomorrow.


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: bitjet on October 19, 2012, 08:37:40 PM
Well, if capitalization is completely unknown and potentially truly random, that's 2^40 of entropy right there.  Even if you're doing 1 billion attempts a second (no idea if that's possible), you'd still have 2^31 seconds to complete it, or about 68 years.

Actually the capitalization is somewhat known. there are several words in the passphrase. The first letter in each word is either capitalized or not.


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: SgtSpike on October 19, 2012, 08:46:30 PM
Well, if capitalization is completely unknown and potentially truly random, that's 2^40 of entropy right there.  Even if you're doing 1 billion attempts a second (no idea if that's possible), you'd still have 2^31 seconds to complete it, or about 68 years.

Actually the capitalization is somewhat known. there are several words in the passphrase. The first letter in each word is either capitalized or not.
And the order of the words is unknown?  Any other unknowns?  How many words?


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: bitjet on October 19, 2012, 09:07:48 PM
Oder of the words is semi know, the first two are known adnt the last word is known how it all fits together is not. nothing is actually missing, just the possible combinations.

5 phrases. they are numbers followed by a word.


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: BC12345 on October 19, 2012, 09:15:14 PM
windows or linux?


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: Pieter Wuille on October 19, 2012, 10:25:28 PM
Well, if capitalization is completely unknown and potentially truly random, that's 2^40 of entropy right there.  Even if you're doing 1 billion attempts a second (no idea if that's possible), you'd still have 2^31 seconds to complete it, or about 68 years.

Heh?

2^40 / 1000000000 = 1100s.


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: SgtSpike on October 19, 2012, 11:04:03 PM
Well, if capitalization is completely unknown and potentially truly random, that's 2^40 of entropy right there.  Even if you're doing 1 billion attempts a second (no idea if that's possible), you'd still have 2^31 seconds to complete it, or about 68 years.

Heh?

2^40 / 1000000000 = 1100s.

MATHS FAIL.

Will update my post.


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: bitjet on October 19, 2012, 11:47:53 PM
Its a 7zip exe archive on windows. If I could feed it a library and let it fiill in the holes that would be awesome I have 3.5gh to put towards it.


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: BC12345 on October 20, 2012, 12:09:03 AM
I am not sure if I understand what your passphrase looks like, could you give an example?

Does it look like this:

"1234(P/p)eter 1234(P/p)aul 1234(M/m)arry 1234(M/m)olly 1234(B/b)aby"

?


Edit:
If it looks like this and you are sure that you know the first, second and last word (except the capitalization) then there are only 64 possible combinations;

             2           *          2       *    (     4          *         2   )       *         2                =      64

In  this case I would suggest that you make a list of all combinations and try them manually. (I hope my math was correct here)


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: ralree on October 20, 2012, 01:42:34 AM
Code:
#!/usr/bin/env python
import string
mystr="peter piper picked a peck of pickled peppers"

def gen(s):
  words = s.split()
  for word in words:
    yield s
    repl = string.capitalize(word)
    s = string.replace(s, word, repl)
    yield s

combinations = gen(mystr)
for i in combinations:
  print i

Output:

Code:
peter piper picked a peck of pickled peppers
Peter piper picked a peck of pickled peppers
Peter piper picked a peck of pickled peppers
Peter Piper picked a peck of pickled peppers
Peter Piper picked a peck of pickled peppers
Peter Piper Picked a peck of pickled peppers
Peter Piper Picked a peck of pickled peppers
Peter Piper Picked A peck of pickled peppers
Peter Piper Picked A peck of pickled peppers
Peter Piper Picked A Peck of pickled peppers
Peter Piper Picked A Peck of pickled peppers
Peter Piper Picked A Peck Of pickled peppers
Peter Piper Picked A Peck Of pickled peppers
Peter Piper Picked A Peck Of Pickled peppers
Peter Piper Picked A Peck Of Pickled peppers
Peter Piper Picked A Peck Of Pickled Peppers

Then it's just something like:

Code:
hank@shelob ~/tmp $ python foo.py | while read line; do echo 7z e somefile.7z -p\"$line\"; done
7z e somefile.7z -p"peter piper picked a peck of pickled peppers"
7z e somefile.7z -p"Peter piper picked a peck of pickled peppers"
7z e somefile.7z -p"Peter piper picked a peck of pickled peppers"
7z e somefile.7z -p"Peter Piper picked a peck of pickled peppers"
7z e somefile.7z -p"Peter Piper picked a peck of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked a peck of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked a peck of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A peck of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A peck of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A Peck of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A Peck of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A Peck Of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A Peck Of pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A Peck Of Pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A Peck Of Pickled peppers"
7z e somefile.7z -p"Peter Piper Picked A Peck Of Pickled Peppers"

This doesn't use recursion, so it won't generate the power set of all capitalization combinations, but it should get you started..
I'm going to continue messing around with it to try and get all capitalization combinations - it's a fun problem!


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: ralree on October 20, 2012, 02:12:36 AM
Fixed it:

Code:
#!/usr/bin/env python
import string
mystr="peter piper picked a peck of pickled peppers"

def gen_inner(s, words):
  if(len(words) > 1):
    gen_inner(s, words[1:])
  else:
    print s

  repl = string.capitalize(words[0])
  s = string.replace(s, words[0], repl)
  if(len(words) > 1):
    gen_inner(s, words[1:])
  else:
    print s

words = mystr.split()
gen_inner(mystr, words)

This generates ALL capitalization permutations of the given string.  Then you feed them in the same way as I showed in my previous post.


Title: Re: Cracking 7zip file you have the pass to.. Almost.?
Post by: BC12345 on October 20, 2012, 03:27:48 PM
Nice!  :)