diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-02-27 15:21:05 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-02-27 15:21:05 +1300 |
commit | 2ba8296843fc83256e3e13a23529a915d73a2e2d (patch) | |
tree | a4159b23305a86d7dc02f13cd11440e5b3d9e496 /test/tools/getcert | |
parent | 00942c1431c551e0bded111271be9b69f5261d91 (diff) | |
download | mitmproxy-2ba8296843fc83256e3e13a23529a915d73a2e2d.tar.gz mitmproxy-2ba8296843fc83256e3e13a23529a915d73a2e2d.tar.bz2 mitmproxy-2ba8296843fc83256e3e13a23529a915d73a2e2d.zip |
Better certificate parsing.
Diffstat (limited to 'test/tools/getcert')
-rwxr-xr-x | test/tools/getcert | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/tools/getcert b/test/tools/getcert new file mode 100755 index 00000000..dc655958 --- /dev/null +++ b/test/tools/getcert @@ -0,0 +1,24 @@ +#!/usr/bin/env python +import sys +sys.path.insert(0, "../..") +import socket, tempfile, ssl, subprocess + +addr = socket.gethostbyname(sys.argv[1]) +s = ssl.get_server_certificate((addr, 443)) +f = tempfile.NamedTemporaryFile() +f.write(s) +f.flush() +p = subprocess.Popen( + [ + "openssl", + "x509", + "-in", f.name, + "-text", + "-noout" + ], + stdout = subprocess.PIPE +) +out, _ = p.communicate() +print out + + |