Question: Create a python program to obtain a collection of TLS certificates. You dont need to save every field of the certificate, but you should

Create a python program to obtain a collection of TLS certificates. You dont need to save every field of the import ss1 hostname www.google.com port 443 f = open('cert.der', 'wb'). cert = ss1.get_server_certificate 

Create a python program to obtain a collection of TLS certificates. You dont need to save every field of the certificate, but you should consider which fields might be useful for foren- sics/analytics later on. There is no required number of certificates, but you will need a large collection for the higher level machine learning tasks. Submit a document containing the following. 1. Your code and a screenshot of it running. 2. A description of what part of the certificates you have saved. 3. A print out of all the certs you have collected. You may find the following code helpful in getting started. import ss1 hostname = 'www.google.com port 443 f = open('cert.der', 'wb'). cert = ssl.get_server_certificate ((hostname, port)) f.write(ssl.PEM_cert_to_DER_cert (cert)) f.close() ### or alternatively ### # Import modules import socket import pyshark # Docs: https://github.com/KimiNewt/pyshark/ from pprint import pprint data = pyshark. FileCapture (unipcap.pcap) #Loop through each item (packet) for pkt in data: if TLS in pkt: # Look for attribute of x509 if hasattr(pkt['TLS' ], 'x509sat_utf8string'): print (pkt[TLS]) pprint(dir (pkt['TLS'])) print (pkt['TLS'].x589sat_utf8string) print (NEW CERT)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To obtain a collection of TLS certificates and save relevant information from the certificates you can use the ssl module in Python to establish a con... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!