mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
25 lines
438 B
Plaintext
25 lines
438 B
Plaintext
|
#!/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
|
||
|
|
||
|
|