Skip to content

Commit 6b23bbc

Browse files
committed
Add lightweight info on server cert chain
1 parent 5fda507 commit 6b23bbc

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

FiddlerImportNetlog/FiddlerInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace FiddlerImportNetlog
1010
{
1111
[ProfferFormat("NetLog JSON",
12-
"Chromium's JSON-based event log format (v1.3.4.3). See https://textslashplain.com/2020/01/17/capture-network-logs-from-edge-and-chrome/ for more info.",
12+
"Chromium's JSON-based event log format (v1.3.4.4). See https://textslashplain.com/2020/01/17/capture-network-logs-from-edge-and-chrome/ for more info.",
1313
// We handle import of JSON files, whether uncompressed, or compressed with ZIP or GZ. I'm not completely sure I remember the implications
1414
// of declaring .gz here, nor why .zip isn't mentioned. Is this about the drag/drop import feature?
1515
".json;.gz"

FiddlerImportNetlog/Importer.cs

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -711,20 +711,45 @@ private void GenerateSocketListSession(Dictionary<int, List<Hashtable>> dictSock
711711
{
712712
StringBuilder sbCertsReceived = new StringBuilder();
713713
ArrayList alCerts = htParams["certificates"] as ArrayList;
714+
if (alCerts.Count < 1) continue;
714715

715-
// Try to promote the SubjectCN to the title of this node
716+
Hashtable htParsedCerts = new Hashtable(alCerts.Count);
716717
try
717718
{
718-
if (String.IsNullOrEmpty(sSubjectCNinFirstCert) && alCerts.Count > 0)
719+
for (int i = 0; i < alCerts.Count; i++)
719720
{
720-
var FirstCert = new X509Certificate2();
721-
string sCertInfo = alCerts[0] as string;
722-
FirstCert.Import(Encoding.ASCII.GetBytes(sCertInfo));
723-
sSubjectCNinFirstCert = (" - " + FirstCert.GetNameInfo(X509NameType.SimpleName, false)).ToLower();
721+
var htThisCert = new Hashtable();
722+
htParsedCerts.Add(i.ToString(), htThisCert);
723+
var certItem = new X509Certificate2();
724+
725+
certItem.Import(Encoding.ASCII.GetBytes(alCerts[i] as string));
726+
727+
// Try to promote the SubjectCN to the title of this Socket.
728+
if (String.IsNullOrEmpty(sSubjectCNinFirstCert))
729+
{
730+
sSubjectCNinFirstCert = (" - " + certItem.GetNameInfo(X509NameType.SimpleName, false)).ToLower();
731+
}
732+
733+
htThisCert.Add("Parsed", new ArrayList
734+
{
735+
"Subject: " + certItem.GetNameInfo(X509NameType.SimpleName, false),
736+
"Issuer: " + certItem.Issuer,
737+
"Expires: " + certItem.NotAfter.ToString("yyyy-MM-dd")
738+
});
739+
740+
htThisCert.Add("RAW", new ArrayList
741+
{
742+
alCerts[i]
743+
});
724744
}
745+
htThisSocket.Add("Server Certificates", htParsedCerts);
725746
}
726-
catch { }
727-
htThisSocket.Add("Server Certificates", alCerts);
747+
catch (Exception ex)
748+
{
749+
FiddlerApplication.Log.LogString(ex.Message);
750+
htThisSocket.Add("Server Certificates", alCerts);
751+
}
752+
728753
continue;
729754
}
730755

FiddlerImportNetlog/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[assembly: AssemblyCopyright("Copyright ©2023 Eric Lawrence")]
77
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
88
[assembly: ComVisible(false)]
9-
[assembly: AssemblyVersion("1.3.4.3")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
9+
[assembly: AssemblyVersion("1.3.4.4")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
1010
[assembly: Fiddler.RequiredVersion("4.6.0.0")]
1111

1212

@@ -20,6 +20,9 @@ HTTP_STREAM_JOB has a binding between the request and the socket. Hook them up s
2020
--> source_dependency = 1701 (URL_REQUEST)
2121
*/
2222

23+
// v1.3.4.4
24+
// Add lightweight breakout of server certinfo
25+
2326
// v1.3.4.3
2427
// Set oTimers' values for ClientBeginResponse, ClientDoneResponse, and ServerDoneResponse so Timeline view works better.
2528

0 commit comments

Comments
 (0)