Skip to content

Commit 59f429d

Browse files
committed
✨ Add python script to get TLS fingerprint of a server
1 parent 9f54f00 commit 59f429d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
3+
import argparse
4+
import ssl
5+
import hashlib
6+
7+
parser = argparse.ArgumentParser(description='Compute SSL/TLS fingerprints.')
8+
parser.add_argument('--host', required=True)
9+
parser.add_argument('--port', default=8883)
10+
11+
args = parser.parse_args()
12+
print(args.host)
13+
14+
cert_pem = ssl.get_server_certificate((args.host, args.port))
15+
cert_der = ssl.PEM_cert_to_DER_cert(cert_pem)
16+
17+
md5 = hashlib.md5(cert_der).hexdigest()
18+
sha1 = hashlib.sha1(cert_der).hexdigest()
19+
sha256 = hashlib.sha256(cert_der).hexdigest()
20+
print("MD5: " + md5)
21+
print("SHA1: " + sha1)
22+
print("SHA256: " + sha256)

0 commit comments

Comments
 (0)