Created
February 18, 2021 20:50
-
-
Save artizirk/ab162cbbc5f0c22f91b7d6a3f8af733d to your computer and use it in GitHub Desktop.
Try bunch of passwords from csv list on a password protected ssh key
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 | |
from pprint import pprint | |
from subprocess import run | |
passwords = set() | |
with open("/tmp/passwords.csv") as f: | |
for line in f.readlines(): | |
passwords.add(line.split(',')[2].strip().strip('"')) | |
for password in passwords: | |
res = run(["ssh-keygen", "-f", "/tmp/ssh/id_rsa", "-y", "-P", password]) | |
if res.returncode == 0: | |
print("found", password) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment