This FiddlerScript highlights in red Sessions secured by certificates that will expire in the next 30 days
// Inside Rules > Customize Rules > OnBoot, add the following line: | |
FiddlerApplication.add_OnValidateServerCertificate(onEvalCert); | |
// Just before that function, add the following new function: | |
static function onEvalCert(o: Object, e: ValidateServerCertificateEventArgs) | |
{ | |
try | |
{ | |
var X2: System.Security.Cryptography.X509Certificates.X509Certificate2 = | |
new System.Security.Cryptography.X509Certificates.X509Certificate2(e.ServerCertificate); | |
// Cert expires in next 30 days | |
if (DateTime.UtcNow.AddDays(30) > X2.NotAfter) | |
{ | |
if (DateTime.UtcNow.AddDays(5) > X2.NotAfter) | |
{ | |
FiddlerApplication.AlertUser("Certificate Expiring!", | |
"The certificate for " + e.Session.hostname + " is expiring " + X2.NotAfter.ToShortDateString() + "!"); | |
} | |
e.Session["ui-backcolor"] = "red"; | |
e.Session["ui-Comments"] = "Cert Expires:" + e.ServerCertificate.GetExpirationDateString(); | |
e.Session.RefreshUI(); | |
} | |
} | |
catch (ex) | |
{ | |
FiddlerApplication.Log.LogFormat("Failed to evaluate certificate: {0}", ex.Message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment