Skip to content

Instantly share code, notes, and snippets.

@artizirk
Created February 18, 2021 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artizirk/ab162cbbc5f0c22f91b7d6a3f8af733d to your computer and use it in GitHub Desktop.
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
#!/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