Python Forum
Brute force password breaker
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Brute force password breaker
#1
create a list of word strings by reading this file. Then loop over each word in this list, passing it to the decrypt() method. If this method returns the integer 0, the password was wrong and your program should continue to the next password. If decrypt() returns 1, then your program should break out of the loop and print the hacked password. You should try both the uppercase and lower-case form of each word.
This dictionary.txt file contains words in capital letters.

my code:
import PyPDF2

pdfFile = open('reverse.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFile)
pdfWriter = PyPDF2.PdfFileWriter()
for pageNum in range(pdfReader.numPages):
	pdfWriter.addPage(pdfReader.getPage(pageNum))
pdfWriter.encrypt('inside')
resultPdf = open('encryptedreverse.pdf', 'wb')
pdfWriter.write(resultPdf)
resultPdf.close()
print(pdfReader.isEncrypted)

helloDict = open('dictionary.txt')
helloDictCont = helloDict.read().splitlines()

liDict = []
for word in helloDictCont:
	liDict.append(word)

PdfFile2 = open('encryptedreverse.pdf', 'rb')
pdfReader2 = PyPDF2.PdfFileReader(PdfFile2)
print(pdfReader2.isEncrypted)
	
for word in liDict:
    if pdfReader2.decrypt(word) == 1:
        break
        print(word)
    elif pdfReader2.decrypt(word.lower()) == 1:
        break
        print(word)
    else:
        pass 
As you can see I first encrypted a file and then wrote a code that should decrypt it. The output is that it prints True and then after minutes of work it doesn't give anything. What am I doing wrong?
Reply


Messages In This Thread
Brute force password breaker - by Truman - Jan-20-2019, 01:09 AM
RE: Brute force password breaker - by stullis - Jan-20-2019, 01:32 AM
RE: Brute force password breaker - by Truman - Jan-21-2019, 01:00 AM
RE: Brute force password breaker - by stullis - Jan-21-2019, 01:04 AM
RE: Brute force password breaker - by Truman - Jan-21-2019, 01:28 AM
RE: Brute force password breaker - by Truman - Jan-22-2019, 01:08 AM
RE: Brute force password breaker - by stullis - Jan-22-2019, 01:52 PM
RE: Brute force password breaker - by Truman - Jan-23-2019, 01:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Brute force for CTF (easy one) JokerTux 1 2,367 Feb-18-2020, 08:05 PM
Last Post: JokerTux
  Why can't I force an int to be a string? fad3r 4 3,429 Feb-13-2018, 11:17 PM
Last Post: fad3r
  brute force skriff 4 3,897 Sep-12-2017, 06:23 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020