Sinisterly
Pyzipcracker - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Pyzipcracker (/Thread-Pyzipcracker)

Pages: 1 2


Pyzipcracker - H4R0015K - 04-20-2013

Python version : 2.7
Code:
from zipfile import *
from sys import stdout

def process(word_file,zip_file):
    passes=[]
    tries = 0
    word = 'h4r0015k'
    while word != '':
        word = word_file.readline().replace('\n','')
        if check_pass(word,zip_file):
            passes.append(word)
        else:
            tries+=1
            stdout.write("\rNumber of words tried : "+str(tries))
            stdout.flush()
    return passes
def check_pass(word,zip_file):
    try:
        zip_file.read(zip_file.namelist()[0],word)
        return True
    except:
        return False


word_file = open(raw_input("Enter word filename : "))
zip_file = ZipFile(raw_input("Enter zip filename : "),'r')
print "\n\nPasswords :"+str(process(word_file,zip_file))+"\n\n"

Screenshot :
[Image: flAVeIa.png]

Sometimes my code catch wrong word has a correct password hence it check's each word and print the words out of which only one word can be a correct password.


Pyzipcracker - H4R0015K - 04-20-2013

Python version : 2.7
Code:
from zipfile import *
from sys import stdout

def process(word_file,zip_file):
    passes=[]
    tries = 0
    word = 'h4r0015k'
    while word != '':
        word = word_file.readline().replace('\n','')
        if check_pass(word,zip_file):
            passes.append(word)
        else:
            tries+=1
            stdout.write("\rNumber of words tried : "+str(tries))
            stdout.flush()
    return passes
def check_pass(word,zip_file):
    try:
        zip_file.read(zip_file.namelist()[0],word)
        return True
    except:
        return False


word_file = open(raw_input("Enter word filename : "))
zip_file = ZipFile(raw_input("Enter zip filename : "),'r')
print "\n\nPasswords :"+str(process(word_file,zip_file))+"\n\n"

Screenshot :
[Image: flAVeIa.png]

Sometimes my code catch wrong word has a correct password hence it check's each word and print the words out of which only one word can be a correct password.


RE: Pyzipcracker - Coder-san - 04-20-2013

Nice work. I'm gaining interest in Python. Smile


RE: Pyzipcracker - Coder-san - 04-20-2013

Nice work. I'm gaining interest in Python. Smile


RE: Pyzipcracker - GreyPhantom - 05-19-2013

It works like a bruteforce.


RE: Pyzipcracker - noize - 05-19-2013

Nice code, but I made a zip with the password "asshole" and a list.txt file with

Code:
qwerty
asshole
password
test

I tried to crack it with a great wordlist first and said "24 words tried" and no passwords. Then I tried with this list.txt and said "5 words tried" but again "Passwords: []".

Edit: @GreyPhantom, nope, it works with wordlist-attacks.


RE: Pyzipcracker - H4R0015K - 05-19-2013

(05-19-2013, 11:00 AM)noize Wrote: Nice code, but I made a zip with the password "asshole" and a list.txt file with

Code:
qwerty
asshole
password
test

I tried to crack it with a great wordlist first and said "24 words tried" and no passwords. Then I tried with this list.txt and said "5 words tried" but again "Passwords: []".

Edit: @GreyPhantom, nope, it works with wordlist-attacks.

Upload your zip file and post it here.


RE: Pyzipcracker - noize - 05-19-2013

(05-19-2013, 05:17 PM)H4R0015K Wrote:
(05-19-2013, 11:00 AM)noize Wrote: Nice code, but I made a zip with the password "asshole" and a list.txt file with

Code:
qwerty
asshole
password
test

I tried to crack it with a great wordlist first and said "24 words tried" and no passwords. Then I tried with this list.txt and said "5 words tried" but again "Passwords: []".

Edit: @GreyPhantom, nope, it works with wordlist-attacks.

Upload your zip file and post it here.

Got it. I supposed this might be the problem but didn't still try out.

Here is the archive: http://trythis00011.altervista.org/zipcracker.zip

No password, it just contains the wordlist and two archives.

list.zip fails to be cracked as it is AES256 encrypted.
list2.zip gets to be cracked being it ZipCrypto encrypted.

Maybe you'd like to mention this in the OP.


RE: Pyzipcracker - ArkPhaze - 05-20-2013

Not bad, but I think it needs some work, you should probably check if the input file is a valid zip file though for this module to be able to deal with it properly.

Use this function:
Code:
is_zipfile()



RE: Pyzipcracker - noize - 05-20-2013

(05-20-2013, 06:32 AM)ArkPhaze Wrote: Not bad, but I think it needs some work, you should probably check if the input file is a valid zip file though for this module to be able to deal with it properly.

Use this function:
Code:
is_zipfile()

Well, in the case, maybe you could add also an error in case given files do not exist and let the user enter them again, 'cause right now it just quits the file.