Skip to content

Instantly share code, notes, and snippets.

Created January 20, 2020 12:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save JavanXD/c7b92a34e19511d44e3c55fb922e0e85 to your computer and use it in GitHub Desktop.
python rockyou.txt test.7z
# python rockyou.txt test.7z
import concurrent.futures
import os
import subprocess
import sys
FNULL = open(os.devnull, 'w')
found = False
def try_password(aPassword, aFile):
global FNULL, myExecutor, found
if not found:
myRet =["7z", "t", "-p" + aPassword, aFile], stdout=FNULL, stderr=subprocess.STDOUT)
if myRet == 0:
print ("The password is: " + aPassword)
found = True
# TODO: kill process
except Exception as ex:
myFilename = sys.argv[2]
myPasswordFile = sys.argv[1]
print ("File to crack: " + myFilename)
print ("Password list: " + myPasswordFile)
myFile = open(myPasswordFile, "rt")
myExecutor = concurrent.futures.ThreadPoolExecutor(max_workers=3)
# Test a Password
#myExecutor.submit(try_password, "123456", myFilename)
for myLine in iter(myFile):
myPassword = myLine.strip('\n')
myExecutor.submit(try_password, myPassword, myFilename)
except Exception as ex:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment