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 | |
parent | 00942c1431c551e0bded111271be9b69f5261d91 (diff) | |
download | mitmproxy-2ba8296843fc83256e3e13a23529a915d73a2e2d.tar.gz mitmproxy-2ba8296843fc83256e3e13a23529a915d73a2e2d.tar.bz2 mitmproxy-2ba8296843fc83256e3e13a23529a915d73a2e2d.zip |
Better certificate parsing.
Diffstat (limited to 'test/tools')
-rwxr-xr-x | test/tools/getcert | 24 | ||||
-rwxr-xr-x | test/tools/getcn | 2 |
2 files changed, 25 insertions, 1 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 + + diff --git a/test/tools/getcn b/test/tools/getcn index d17ec0f6..4cc028ca 100755 --- a/test/tools/getcn +++ b/test/tools/getcn @@ -10,4 +10,4 @@ if san: for i in san: print "\t", i - + |