Guest User

Untitled

a guest
Jan 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import subprocess
  2. import sys
  3.  
  4. def main():
  5. dictionary = sys.argv[1]
  6. with open(dictionary, "r") as dic:
  7. for line in dic:
  8. word = line.rstrip('\n')
  9. stdout = subprocess.call(
  10. 'ssh-keygen -c -C "user@server" -P "{0}" -f "./id_rsa"'.format(word),
  11. stderr=subprocess.DEVNULL,
  12. stdout=subprocess.DEVNULL,
  13. shell=True
  14. )
  15. if stdout == 0:
  16. print("Password found: " + word)
  17. return
  18. print("Password not found.")
  19.  
  20. if __name__ == "__main__":
  21. if len(sys.argv) == 2:
  22. main()
  23. else:
  24. print("missing args")
Add Comment
Please, Sign In to add comment