- 5paisa
- AdSense
- Android
- Asphalt 8 : Airborne Mod Apk 4.9.1b Unlimited Money
- Battlegrounds Mobile India
- Blogger
- Blogging
- Bug Hunting
- cloud storage
- Cmd
- Damn vulnerable Web Application
- Demat Account
- Difference between
- dj alok
- dj alok in free firefree
- Doodle Army 2 : Mini Militia 5.2.0 Apk + Mod for android
- DVMA
- E-books
- earn Bitcoins
- Ethical hacking tutorials
- Express vpn
- EXPRESSVPN PRO APK 7.12.1
- EXPRESVPN CRACKED APK
- fire dj alok
- Freefire
- Gaming
- Google drive
- Google llc
- gplink
- Groww App
- Health
- helo
- helo mela
- helo app
- Helo app earn paytm
- Helo app full guide
- Helo app invite and earn
- Helo app redeem proof
- Helo app refer and earn
- Helo app unlimited trick
- Helo app withdraw proof
- Helo Mela Offer: Get Rs.2 Free Paytm Cash + Win Upto Rs.10000 Paytm Cash
- helo refer and earn
- How to
- How to combine two Wifi Connections to get a faster Internet
- how to get dj alok for free
- how to get free dj alok
- how to get free dj alok in free fire
- How to install DVWA on Kali Linux 2020.2
- How To Use Light Speed WebCache on Your website
- ICICI Direct
- IOS
- kali linux
- Live streaming
- makeup
- meesho
- Money Earning
- My poems
- Netflix
- Netflix mod
- Netflix premium
- News
- online courses
- Pentesting
- programming
- PUBG
- Puffin Browser Pro 8.3.0.41446 (Full) Apk + Mod for Android
- Puzzles
- Recharge offers
- Refer and Earn
- Reviews
- SEO
- shell Scripting
- Shortlink
- Spotify Music 8.5.57.1164 APK Mega Mod Cracked Latest Android
- stylish name
- Technology
- Tips&Tricks
- Township Mod Apk 7.5.0 Unlimited Money
- Udemy
- Udemy courses
- Udemy free
- Udemy premium
- VClip app download link
- VClip app full details
- VClip app invitation link
- VClip app referral code
- VClip app referral link
- VClip app review
- Web designing
- What is
- WINDOWS
- Wishes
- Wordpress
- World Cricket Championship 2 2.8.9 Apk + Mod (Coins/Unlocked)
- Youtube tricks
- zoom app
- zoom bombing
- zoom call
- Zoom safety tips
How to crack password of zip files using python
How to crack password of zip files using python
The time to crack a password is related to bit strength (see password strength), which is a measure of the password’s entropy, and the details of how the password is stored. Most methods of password cracking require the computer to produce many candidate passwords, each of which is checked. One example is brute-force cracking, in which a computer tries every possible key or password until it succeeds. More common methods of password cracking, such as dictionary attacks, pattern checking, word list substitution, etc. attempt to reduce the number of trials required and will usually be attempted before brute force. Higher password bit strength exponentially increases the number of candidate passwords that must be checked, on average, to recover the password and reduces the likelihood that the password will be found in any cracking dictionary.
why write such a script? Well, you might’ve forgotten the password for an important zip file or just don’t know the file’s password in the first place and you need extract its contents ASAP. This script comes to the rescue.
#import the required modules
import optparse
import zipfile
from time import time
- optparse – to parse the arguments
- zipfile – to handle the zipfiles
- time – to find the time taken to crack the zip file
parser = optparse.OptionParser()
parser.add_option('-f', '--file', action="store", dest="file_path", help="Zip File Path", default=None)
parser.add_option('-w', '--word_list', action="store", dest="word_list", help="Word List Path", default=None)
options, args = parser.parse_args()
We use a try…except statement to check if the password is the right one, if yes, the script prints the correct password and stops, if not, the script tries the next password in the list.
#!/usr/bin/python
#import the required modules
import optparse
import zipfile
from time import time
#parse arguments
parser = optparse.OptionParser()
parser.add_option('-f', '--file', action="store", dest="file_path", help="Zip File Path", default=None)
parser.add_option('-w', '--word_list', action="store", dest="word_list", help="Word List Path", default=None)
options, args = parser.parse_args()
def main(file_path, word_list):
#check if the Zip file exists
try:
zip_ = zipfile.ZipFile(file_path)
except zipfile.BadZipfile:
print "Please check the file's path. It doesn't seem to be a zip file."
quit()
password = None #just in case if the word list is empty
i = 0 #password count
c_t = time() #start time
with open(word_list, "r") as f: #open the word list
passes = f.readlines() #read the text file line by line
for x in passes:
i += 1 #increment the password try count
password = x.split("\n")[0] #splitting the newline character
try:
zip_.extractall(pwd=password) #try the password
t_t = time() - c_t #total time
print "\nPassword cracked: %s\n" % password #print the password
print "Took %f seconds to crack the password. That is, %i attempts per second." % (t_t,i/t_t) #stats
quit() #stop the script
except Exception:
pass
print "Sorry, password not found."
if __name__ == '__main__':
main(options.file_path, options.word_list)
Take your time to comment on this article.
Also Read

KUMAR JEERU
. I am a Programmer and Pentester. I find and Fix loophole in websites and networks. Connect with me for queries , web developemnt , Scanning and Fixing website Security issues. My company gives special discount for independent entrepreneur , small and Medium size companies. Contact me directly on my face page
Post a Comment
Post a Comment