O'Reilly logo

Effective Python Penetration Testing by Rejah Rehim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Brute-force cracking password protected ZIP files

As we discussed, the same method can be used to crack the password in a protected ZIP file. For that, we use the zipfile module:

import zipfile 
 
filename = 'test.zip' 
dictionary = 'passwordlist.txt' 
 
password = None 
file_to_open = zipfile.ZipFile(filename) 
with open(dictionary, 'r') as f: 
   for line in f.readlines(): 
         password = line.strip('\n') 
         try: 
               file_to_open.extractall(pwd=password) 
               password = 'Password found: %s' % password 
               print password 
         except: 
               pass 

Sulley fuzzing framework

By using fuzzing frameworks, we can create fuzzers in less time. A fuzzing framework provides a flexible and reusable development environment that helps to build fuzzers quickly.

Sulley is a Python fuzz testing framework that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required