From 3cb6f29af87a4fd34b069a648d26fd8666bd4102 Mon Sep 17 00:00:00 2001 From: Alankar Dutta Date: Wed, 19 Jun 2024 19:07:05 +0530 Subject: [PATCH 1/7] Create guess_pdfPass-parallel.py Parallel password guessing script using python --- guess_pdfPass-parallel.py | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 guess_pdfPass-parallel.py diff --git a/guess_pdfPass-parallel.py b/guess_pdfPass-parallel.py new file mode 100644 index 0000000..4b05f50 --- /dev/null +++ b/guess_pdfPass-parallel.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +""" +Created on Sun Jun 16 21:57:11 2024 +@author: alankar +Usage: time mpiexec -n python guess_pdfPass-parallel.py +Dependency: qpdf (https://github.com/qpdf/qpdf), tested with version 11.9.1 +Note: Make sure qpdf and its libraries are added to PATH and LD_LIBRARY_PATH respectively +Thanks: Samriddhi Sankar Maity +- This code uses MPI to perform coordinated parallel guesses using multiple processors. +- This is ideal for guessing long passwords with brute force using supercomputers +""" + +import subprocess as sp +from mpi4py import MPI +from itertools import product + +## start parallel programming ---------------------------------------- # +comm = MPI.COMM_WORLD +rank = comm.Get_rank() +size = comm.Get_size() + +verbose = False + +initial_known_pass = "9899" + +input_file = "sample.pdf" +output_file = "sample-decrypt.pdf" + +# trying to guess unknown 6 digits +tries = list(product(range(10),range(10),range(10),range(10),range(10),range(10))) + +for i in range(rank, len(tries), size): + guess_pass = "".join(str(x) for x in tries[i]) + text = sp.getoutput(f'qpdf -password="{initial_known_pass}{guess_pass}" -decrypt {input_file} {output_file}') + if verbose: + print(f"{initial_known_pass}{guess_pass}: {text}", flush=True) + if "invalid password" not in text: + print(f"Password found: {initial_known_pass}{guess_pass}", flush=True) + comm.Abort() +print("Set settings failed to guess the password.") From f197135412b0a5fe73b24a37453c039658ec168a Mon Sep 17 00:00:00 2001 From: Alankar Dutta Date: Wed, 19 Jun 2024 19:07:40 +0530 Subject: [PATCH 2/7] Delete pdf_passwd.sh --- pdf_passwd.sh | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 pdf_passwd.sh diff --git a/pdf_passwd.sh b/pdf_passwd.sh deleted file mode 100644 index ac763ec..0000000 --- a/pdf_passwd.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -name="PASS" # First 4 letters of your name -FILEIN="sample_out.pdf" # Input file name -FILEOUT="sample_open.pdf" # Output file name - -for mm in $(seq -f "%02g" 1 12) -do - for dd in $(seq -f "%02g" 1 31) - do - qpdf -password="${name}"$dd$mm -decrypt $FILEIN $FILEOUT - if test -f "$FILEOUT"; then - echo File Opened! - echo Password "${name}"$dd$mm - break - fi - done -done -echo all done - From bc6ccb794c8b954677ba577075cda1597408e02b Mon Sep 17 00:00:00 2001 From: Alankar Dutta Date: Wed, 19 Jun 2024 19:09:38 +0530 Subject: [PATCH 3/7] Create requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..386e96a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +mpi4py==3.1.5 ; python_version >= "3.10" and python_version < "4.0" From 819b44ef00740038e47d155bbb4a936cffb5d047 Mon Sep 17 00:00:00 2001 From: Alankar Dutta Date: Wed, 19 Jun 2024 19:14:22 +0530 Subject: [PATCH 4/7] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index ad7189c..ae759b9 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,12 @@ Files are: (1) Bank account statement (2) Few certificates where the first four letters are first four letters of your name along with your date and month of birthdate. + +- This code uses MPI to perform coordinated parallel guesses using multiple processors. +- This is ideal for guessing long passwords with brute force using supercomputers. + +Use Python (tested with version `3.10`) to run this +- [Optional] Create virtual environment: `python -m venv .venv && source .venv/bin/activate` +- Run the code: `time mpiexec -n python guess_pdfPass-parallel.py` + +> Note: Dependency: qpdf (https://github.com/qpdf/qpdf), tested with version 11.9.1. Make sure `qpdf` and its libraries are added to `PATH` and `LD_LIBRARY_PATH` respectively. From 7eda58aac42b18b312f1ceae15c4b5e1d0e99ef6 Mon Sep 17 00:00:00 2001 From: Alankar Dutta Date: Wed, 19 Jun 2024 19:15:44 +0530 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae759b9..3cb5397 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ where the first four letters are first four letters of your name along with your - This is ideal for guessing long passwords with brute force using supercomputers. Use Python (tested with version `3.10`) to run this -- [Optional] Create virtual environment: `python -m venv .venv && source .venv/bin/activate` +- [Optional] Create virtual environment: `python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt` - Run the code: `time mpiexec -n python guess_pdfPass-parallel.py` > Note: Dependency: qpdf (https://github.com/qpdf/qpdf), tested with version 11.9.1. Make sure `qpdf` and its libraries are added to `PATH` and `LD_LIBRARY_PATH` respectively. From 67763757afa05f455d22f91a42b42cc83a7cb020 Mon Sep 17 00:00:00 2001 From: Alankar Dutta Date: Wed, 19 Jun 2024 19:16:08 +0530 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cb5397..2912062 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ where the first four letters are first four letters of your name along with your - This is ideal for guessing long passwords with brute force using supercomputers. Use Python (tested with version `3.10`) to run this -- [Optional] Create virtual environment: `python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt` +- [Optional] Create and use virtual environment: `python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt` - Run the code: `time mpiexec -n python guess_pdfPass-parallel.py` > Note: Dependency: qpdf (https://github.com/qpdf/qpdf), tested with version 11.9.1. Make sure `qpdf` and its libraries are added to `PATH` and `LD_LIBRARY_PATH` respectively. From 9dec8c6ad44c4bd312a89067e62d8b14a9c7ab23 Mon Sep 17 00:00:00 2001 From: Alankar Dutta Date: Wed, 19 Jun 2024 19:19:12 +0530 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2912062..fe2df74 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,4 @@ Use Python (tested with version `3.10`) to run this - [Optional] Create and use virtual environment: `python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt` - Run the code: `time mpiexec -n python guess_pdfPass-parallel.py` -> Note: Dependency: qpdf (https://github.com/qpdf/qpdf), tested with version 11.9.1. Make sure `qpdf` and its libraries are added to `PATH` and `LD_LIBRARY_PATH` respectively. +> Dependency: qpdf (https://github.com/qpdf/qpdf), tested with version 11.9.1. Make sure `qpdf` and its libraries are added to `PATH` and `LD_LIBRARY_PATH` respectively.