Even though the syntax all seems correct I'm still thrown an output error, any reason why it throws this on the output? (please ignore my bad indentation).
import zipfile
myZip = zipfile.ZipFile("/mydile.zip")
count = 0
for x in range(0,1005310):
password = count
count += 1
try:
myZip.extractall(pwd = password)
print(password)
except Exception as e:
print(e)
print "Sorry, password not found."
count = 0
count is an integer.
password = count
password is an integer.
myZip.extractall(pwd = password)
This cannot be right. pwd must have the value of a string. You can convert it to a string using str()
As suggested by Ryan this is exactly what you have to do.
myZip.extractall(pwd = str(password))
You cannot place str() anywhere else because up to this point you are performing arithmetic and you cannot do arithmetic on string without converting.
Bear in mind that this brute-force method will only work if the password is an integer. This is highly improbable so you may also want to include characters. This post might be of some use if you decide to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With