Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'int' object is not iterable python brute force password

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."
like image 383
Robertgold Avatar asked May 15 '26 18:05

Robertgold


1 Answers

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.

like image 99
Xantium Avatar answered May 18 '26 08:05

Xantium