[issue10876] Zipfile crashes when zip password is set to 610/844/numerous other numbers

2011-01-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Well, the password-checking scheme uses a one-byte check against the zip header 
for consistency. 
So there is a (near) 1/256 chance of false positives, that is of bad passwords 
mistakenly detected as good; then the ZipFile class proceeds with unarchiving 
and that's where things fail (because the decrypted stream is really junk).

Therefore, I'd call it not a bug. If you want to crack a password, you need to 
trap this exception and interpret it as bad password.

--
nosy: +pitrou
resolution:  - invalid
status: open - closed
type: crash - behavior
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10876
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10876] Zipfile crashes when zip password is set to 610

2011-01-09 Thread Kira Erethon

Changes by Kira Erethon shinjieret...@gmail.com:


--
title: Zipfile crashes when zip password is 610 - Zipfile crashes when zip 
password is set to 610

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10876
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10876] Zipfile crashes when zip password is set to 610

2011-01-09 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

What do you mean by is set to 610? Can you show us the code that caused this 
error?

--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10876
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10876] Zipfile crashes when zip password is set to 610

2011-01-09 Thread Kira Erethon

Kira Erethon shinjieret...@gmail.com added the comment:

Ok, I tried recreating the bug and found out that I couldn't. Originally this 
happened when I tried to find the password of a zip file through a dictionary 
attack. The code I used is this:

import zipfile

zfile=raw_input(Please input zip's file name\n)
diction=raw_input(Please input dictionary\n)
found = False
zipf = zipfile.ZipFile( zfile, 'r' )
f = open(diction, 'r')
for line in f:
pswd = line
pswd = pswd[:-1]
zipf.setpassword(pswd)
try:
zipf.extractall()
found = True
break
except RuntimeError:
continue
zipf.close()  

First time I encountered the bug was when on my dictionary I had all the 
numbers from 000 to 999 and saw that it crashed at 610. Now it crashes at 
844.Even when I do this 

import zipfile

zfile=raw_input(Please input zip's file name\n)
zipf = zipfile.ZipFile( zfile, 'r' )
zipf.setpassword('844')
zipf.extractall()
zipf.close()  

it crashes with the error in my first post.
If this is any help, i'm using python 2.6.6 on linux and the number changed 
from 610 to 844 when I opened a new terminal window.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10876
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10876] Zipfile crashes when zip password is set to 610/844

2011-01-09 Thread Kira Erethon

Changes by Kira Erethon shinjieret...@gmail.com:


--
title: Zipfile crashes when zip password is set to 610 - Zipfile crashes when 
zip password is set to 610/844

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10876
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10876] Zipfile crashes when zip password is set to 610/844/numerous other numbers

2011-01-09 Thread Kira Erethon

Kira Erethon shinjieret...@gmail.com added the comment:

Update, tried this in another machine of mine, same exact code and this time it 
crashes at 68

--
title: Zipfile crashes when zip password is set to 610/844 - Zipfile crashes 
when zip password is set to 610/844/numerous other numbers

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10876
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com