### Install dependencies Source: https://github.com/aapooksman/certmitm/blob/main/README.md Install the required Python packages listed in requirements.txt. ```bash pip install -r requirements.txt ``` -------------------------------- ### Configure DHCP and DNS server Source: https://github.com/aapooksman/certmitm/blob/main/README.md Set up the network interface and start dnsmasq to act as a DHCP/DNS server for clients. ```bash sudo ip addr add 10.0.0.1/24 dev eth0 sudo dnsmasq --no-daemon --interface eth0 --dhcp-range=10.0.0.100,10.0.0.200 --log-dhcp --log-queries --bind-interfaces -C /dev/null ``` -------------------------------- ### View certmitm output Source: https://github.com/aapooksman/certmitm/blob/main/README.md Example output showing intercepted and secured connections. ```console test@certmitm$ python3 certmitm.py -v -l 9900 INFO - 10.0.0.140: 216.58.211.238:443:google.com for test self_signed = [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:992) INFO - 10.0.0.140: 216.58.211.238:443:google.com for test replaced_key = [SSL: TLSV1_ALERT_DECRYPT_ERROR] tlsv1 alert decrypt error (_ssl.c:992) INFO - 10.0.0.140: 216.58.211.238:443:google.com for test real_cert_letsencrypt = Nothing received INFO - 10.0.0.140: 216.58.211.238:443:google.com for test real_cert_CA_letsencrypt = [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:992) CRITICAL - 10.0.0.140: 216.58.209.164:443:www.google.com for test self_signed = data intercepted! CRITICAL - 10.0.0.140: 216.58.209.164:443:www.google.com for test replaced_key = data intercepted! CRITICAL - 10.0.0.140: 216.58.209.164:443:www.google.com for test real_cert_letsencrypt = data intercepted! CRITICAL - 10.0.0.140: 216.58.209.164:443:www.google.com for test real_cert_CA_letsencrypt = data intercepted! ``` -------------------------------- ### Start certmitm Source: https://github.com/aapooksman/certmitm/blob/main/README.md Launch the certmitm tool to listen on the specified port and process intercepted traffic. ```bash python3 certmitm.py --listen 9900 --workdir testing --verbose --show-data ``` -------------------------------- ### Test connections with curl Source: https://github.com/aapooksman/certmitm/blob/main/README.md Verify interception results by attempting connections with curl from a client machine. ```console test@victim:~$ curl https://google.com curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above. test@victim:~$ curl https://google.com curl: (35) error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding test@victim:~$ curl https://google.com curl: (60) SSL: no alternative certificate subject name matches target host name 'google.com' More details here: https://curl.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above. test@victim:~$ curl https://google.com curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above. test@victim:~$ curl https://google.com