Password Cracker for DOB format password for PDF

Mahesh Chikkanna
2 min readApr 18, 2021

This post is for technical and educational purposes only. It is not intended for any wrongdoing.

There was a requirement for an immediate PAN card for one of my relative. I searched the web and found out that using the Income-tax filling website, we can get the pan card in 10 mins using the Aadhar card.

So, I immediately filled in the details and generated the PAN Card with the details and download the PAN Card after some 1–2 hours. But, the password for the PAN Card was Date of birth in format DDMMYYYY. I did not notice ask them that the Aadhar card had the proper format of DOB. After generation, I got to know the only YEAR was mentioned in the card.

I started searching for many options like password cracker, google drive upload, software, etc. Even I tried 01011980 ( Aadhard card year: 1980). It also did not work. I called up the PAN Card office, there was no solution there also. I finally thought it is enough and wrote a program to crack the password. It is just a simple piece of code.

import java.io.IOException;import com.itextpdf.text.pdf.PdfReader;public class PasswordExtractor {private static final int MONTHS = 12;private static final int NO_OF_DAYS_IN_PATH = 31;private static final String ORIG = "d://pan_card.pdf";private static final int START_YEAR = 1980;private static final int END_YEAR = 1980;public static void main(String[] args) throws IOException {for (int currentYear = START_YEAR; currentYear <= END_YEAR; currentYear++) {for (int currentMonth = 1; currentMonth <= MONTHS; currentMonth++) {for (int currentDay = 1; currentDay <= NO_OF_DAYS_IN_PATH; currentDay++) {try {String password = new String(String.valueOf(currentDay < 10 ? "0".concat(String.valueOf(currentDay)): currentDay));password = password.concat(currentMonth < 10 ? "0"+ currentMonth : String.valueOf(currentMonth));password = password.concat(String.valueOf(currentYear));new PdfReader(ORIG, password.getBytes());System.out.println("password : " + password);System.exit(0);} catch (Exception e) {// e.printStackTrace();}}}}System.out.println("Could not find the password in the current combination");}}

Output 1:

password : 01061980

Output 2 :

Could not find the password in the current combination

Jar link :

iText Jar

Dependent Jar

--

--