Forked from ericlaw1979/WarningBeforeCertExpires.js
Created
March 18, 2017 20:15
Revisions
-
ericlaw1979 revised this gist
Jan 25, 2016 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,13 @@ 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(); -
ericlaw1979 created this gist
Jan 23, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ // 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.Now.AddDays(30) > X2.NotAfter) { 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); } }