mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 16:17:49 +00:00
e3d390e036
run the following command: $ autopep8 -i -r -a -a .
28 lines
518 B
Python
Executable File
28 lines
518 B
Python
Executable File
#!/usr/bin/env python
|
|
import sys
|
|
sys.path.insert(0, "../../")
|
|
from netlib import tcp
|
|
|
|
|
|
def get_remote_cert(host, port, sni):
|
|
c = tcp.TCPClient((host, port))
|
|
c.connect()
|
|
c.convert_to_ssl(sni=sni)
|
|
return c.cert
|
|
|
|
if len(sys.argv) > 2:
|
|
port = int(sys.argv[2])
|
|
else:
|
|
port = 443
|
|
if len(sys.argv) > 3:
|
|
sni = sys.argv[3]
|
|
else:
|
|
sni = None
|
|
|
|
cert = get_remote_cert(sys.argv[1], port, sni)
|
|
print "CN:", cert.cn
|
|
if cert.altnames:
|
|
print "SANs:",
|
|
for i in cert.altnames:
|
|
print "\t", i
|