Skip to content

Instantly share code, notes, and snippets.

@benhagen
Created March 12, 2013 22:25
Show Gist options
  • Save benhagen/5147659 to your computer and use it in GitHub Desktop.
Save benhagen/5147659 to your computer and use it in GitHub Desktop.
Enumerate locally supported SSL/TLS ciphers in Python / M2Crypto
#!/usr/bin/env python
from M2Crypto import SSL
versions = ["sslv2", "sslv23", "sslv3", "tlsv1"]
ciphers = []
for version in versions:
ctx = SSL.Context(version, weak_crypto=True)
conn = SSL.Connection(ctx)
cipher_stack = conn.get_ciphers()
for cipher in cipher_stack:
print "%s\t%s" % (version, cipher)
@benhagen
Copy link
Author

This turned out to be easy, but was hard to find any details on. Essentially you connect to yourself with each SSL version and see what ciphers are available. The command line version:

openssl ciphers -v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment