OfficeGoogle
Home
Quizzes
Blog
News
Sign In
Sign Up
Update an article
Title
*
Overview
*
The purpose is to showcase the programming skill to solve daily life problems. Cracking the password of a pdf file or simply opening a password-protected file.
Content
*
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">How many times does it happens with us that we use our professional skills to solve daily life problems. For software developers, it would hardly happen that they write a piece of code for themself. Recently it happened to me. Not sure how but one of my personal bank accounts had the wrong personal details. They sent me statement in a password-protected file, but when I was trying to open the file it prompted "Incorrect Password". I was urgent and I had to view the information in that file. Cutting long story short, I decided to crack the password of the file. </span></p> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">So the password was, first four letters of my name followed by the date of birth. </span></p> <ol> <li><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">First four characters of name .</span></li> <li><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">date of birth DDMM format. </span></li> </ol> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">Since in other communication, they had my correct name. So I knew I don't have to work on the first condition.It has to be the second condition which I have to crack. </span></p> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">So wrote a Python program to loop through all the dates of the year and try to open the file. Its a tedious and boring task if you do it manually but for computers it's a piece of cake. </span></p> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">so here goes the program for you guys. </span></p> <div style="color: #d4d4d4; background-color: #1e1e1e; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px; line-height: 18px; white-space: pre;"> <div> <div style="line-height: 18px;"> </div> </div> </div> <pre class="language-python"><code>from datetime import timedelta, date import pikepdf import datetime dt = datetime.date(2015, 1, 20) print(dt.day) start_date = date(2021, 1, 1) end_date = date(2022, 1, 1) def daterange(start_date, end_date): for n in range(int((end_date - start_date).days)): yield start_date + timedelta(n) def open_pdf(f,msg): with pikepdf.open(f,password=msg) as pdf: num_pages = len(pdf.pages) print("Total pages:", num_pages) for single_date in daterange(start_date, end_date): msg = "Name"+single_date.strftime("%d%m") try: open_pdf("icici.pdf",msg) print(msg) except: print(end='')</code></pre> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">and finally above program will print the password which opened the file. the fun part is you can crack any password if you have a hint of the password. </span></p> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">So the learning is, Keep your password as strong as possible so that it cannot be broken easily. </span></p> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">The purpose of this article is to share the use case of programming in daily life. </span></p> <p><span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">Have fun!</span></p> <p> </p>
Thumbnail
*
Currently:
paulius-dragunas-uw_NWjC1mBE-unsplash.jpg
Change:
Categories
*
Tech
Salesforce
Life
Social
Finance
FRM
Java-J2EE
PTE
Featured
Previous post
---------
How to resolve 'You have reached the maximum of 10 Trailhead playgrounds' error?
What is meant by isThreadSafe in JSP?
Collection of the best 190 sites for kids education
The best free books of Science and Business
Why boycott Chinese product is not good for India
PTE Speaking (English) - 4 word stress rules to improve pronunciation score
PTE Writing - How to score 90?
Finding frequency of an element in python list
How I prepared for and passed my Salesforce Administrator Certification
Salesforce NPSP Learning resources
OpenJDK8 trustAnchor paramerer must be non empty (unable to connect to repository on eclipse)
Salesforce B2C Commerce Cloud Architecture (Demandware)
Opening password protected pdf file using Python.
Camping Checklist
Daily Finance and Market Update
Next post
---------
How to resolve 'You have reached the maximum of 10 Trailhead playgrounds' error?
What is meant by isThreadSafe in JSP?
Collection of the best 190 sites for kids education
The best free books of Science and Business
Why boycott Chinese product is not good for India
PTE Speaking (English) - 4 word stress rules to improve pronunciation score
PTE Writing - How to score 90?
Finding frequency of an element in python list
How I prepared for and passed my Salesforce Administrator Certification
Salesforce NPSP Learning resources
OpenJDK8 trustAnchor paramerer must be non empty (unable to connect to repository on eclipse)
Salesforce B2C Commerce Cloud Architecture (Demandware)
Opening password protected pdf file using Python.
Camping Checklist
Daily Finance and Market Update
Submit