Created
February 18, 2021 20:51
-
-
Save artizirk/0e072b24d593d76d8b95c1e8d3cf2f8a to your computer and use it in GitHub Desktop.
Try to import password protected gnupg openpgp by using passwords from csv file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
## Try all of the passwords for gpg openpgp key | |
from subprocess import run | |
p = open("/tmp/passwords.csv") | |
passwords = set() | |
for line in p.readlines(): | |
passwords.add(line.split(",")[2].strip().replace('"','')) | |
for password in passwords: | |
print(password) | |
try: | |
#run("GNUPGHOME=/tmp/gnupg gpg --pinentry-mode loopback --passphrase-fd 0 --import test.asc", shell=True, check=True, input=password.encode()) | |
run("gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/test.asc", shell=True, check=True, input=password.encode()) | |
except Exception as e: | |
print(e) | |
continue | |
exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment