diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2012-02-28 10:55:37 +1300 |
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2012-02-28 10:55:37 +1300 |
| commit | a03e1af7e73af285447c7ecc28f7202a725537e4 (patch) | |
| tree | 61ca8f29220843105ee25d42355cb21f7d78d6e9 /test/tools | |
| parent | 883424030f2ad7955209ff7b1a55b84e5aa4321c (diff) | |
| parent | 688faa9baa79750642ffbf4241bb166f594e4179 (diff) | |
| download | mitmproxy-a03e1af7e73af285447c7ecc28f7202a725537e4.tar.gz mitmproxy-a03e1af7e73af285447c7ecc28f7202a725537e4.tar.bz2 mitmproxy-a03e1af7e73af285447c7ecc28f7202a725537e4.zip | |
Merge branch 'upstream-cert'
Diffstat (limited to 'test/tools')
| -rwxr-xr-x | test/tools/getcert | 24 | ||||
| -rwxr-xr-x | test/tools/getcn | 13 |
2 files changed, 37 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 + + diff --git a/test/tools/getcn b/test/tools/getcn new file mode 100755 index 00000000..4cc028ca --- /dev/null +++ b/test/tools/getcn @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import sys +sys.path.insert(0, "../..") +from libmproxy import utils + +cn, san = utils.get_remote_cn(sys.argv[1], 443) +print cn +if san: + for i in san: + print "\t", i + + |
