Skip to content

Commit

Permalink
Version 0.53. See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Git committed Nov 6, 2023
1 parent ef0fc4a commit 4998e2e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2023/11/05
## Version 0.53
* Fixed an issue with the mechanism behind getting the SSL certificate chain.

# 2023/10/14
## Version 0.52
### Fixes
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Certificate Checker

Version: 0.52
Version: 0.53

Author: TheScriptGuy

Expand Down Expand Up @@ -30,7 +30,7 @@ usage: certCheck.py [-h] [--hostname HOSTNAME] [--displayCertificate] [--display
[--sendEmail] [--retryAmount RETRYAMOUNT] [--timeBetweenRetries TIMEBETWEENRETRIES] [--contextVariables] [--environmentVariables] [--setTag SETTAG] [--delTag] [--getTag] [--renewDeviceId]
[--getDeviceId] [--deleteDeviceId] [--setTenantId SETTENANTID] [--getTenantId] [--delTenantId] [--createBlankConfiguration]

Certificate Checker v0.52
Certificate Checker v0.53

optional arguments:
-h, --help show this help message and exit
Expand Down
6 changes: 3 additions & 3 deletions certCheck.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Program: Certificate Checker
# Author: Nolan Rumble
# Date: 2023/10/14
# Version: 0.52
# Date: 2023/11/05
# Version: 0.53

import argparse
import datetime
Expand All @@ -18,7 +18,7 @@
from data import sendDataEmail
from mongo import mongo_connection

scriptVersion = "0.52"
scriptVersion = "0.53"

# Global Variables
args = None
Expand Down
11 changes: 6 additions & 5 deletions certificate/getCertificateChain.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Description: Get the certificate chain from a website.
# Author: TheScriptGuy
# Last modified: 2023-08-13
# Version: 0.05
# Last modified: 2023-11-05
# Version: 0.06

import ssl
import socket
Expand Down Expand Up @@ -86,8 +86,7 @@ def getCertificate(
# Create the SSL context.
# We will ignore any certificate warnings for this process.
sslContext = ssl._create_unverified_context()
sslContext.options &= ~ssl.OP_NO_RENEGOTIATION

sslContext.options |= 0x4 # OP_LEGACY_SERVER_CONNECT
with socket.create_connection((__hostname, __port)) as sock, sslContext.wrap_socket(sock, server_hostname=__hostname) as sslSocket:
# Get the certificate from the connection, convert it to PEM format.
sslCertificate = ssl.DER_cert_to_PEM_cert(sslSocket.getpeercert(True))
Expand All @@ -98,6 +97,8 @@ def getCertificate(
except ConnectionRefusedError:
print(f"Connection refused to {__hostname}:{__port}")
sys.exit(1)
except ssl.SSLError as e:
print(f"SSL Error - {e}")

# Return the sslCertificate object.
return sslCertificate
Expand Down Expand Up @@ -299,7 +300,7 @@ def getCertificateChain(self, __hostname: str, __port: int):

def __init__(self):
"""Init the getCertChain class."""
self.classVersion = "0.05"
self.classVersion = "0.06"
self.maxDepth = 4
self.certChain = []
self.certificateHash = ""

0 comments on commit 4998e2e

Please sign in to comment.