Skip to content

Commit

Permalink
Proffer file extensions and show DNS resolves
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlaw1979 committed Sep 28, 2021
1 parent e7c31ef commit f224498
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 23 deletions.
5 changes: 4 additions & 1 deletion FiddlerImportNetlog/FiddlerInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

namespace FiddlerImportNetlog
{
[ProfferFormat("NetLog JSON", "Chromium's JSON-based event log format (v1.3.2.1). See https://dev.chromium.org/for-testers/providing-network-details for more details.")]
[ProfferFormat("NetLog JSON",
"Chromium's JSON-based event log format (v1.3.2.2). See https://dev.chromium.org/for-testers/providing-network-details for more details.",
".json;.gz" // We handle import of JSON files.
)]
public class HTTPArchiveFormatImport : ISessionImporter
{
public Session[] ImportSessions(string sFormat, Dictionary<string, object> dictOptions, EventHandler<Fiddler.ProgressCallbackEventArgs> evtProgressNotifications)
Expand Down
48 changes: 27 additions & 21 deletions FiddlerImportNetlog/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -836,44 +836,50 @@ private void GenerateSocketListSession(Dictionary<int, List<Hashtable>> dictSock

private void GenerateDNSResolutionListSession(Dictionary<int, List<Hashtable>> dictDNSResolutions)
{
if (dictDNSResolutions.Count < 1) return;
try
{
// if (htAllSockets.Count > 0)
Hashtable htAllResolutions = new Hashtable();
foreach (KeyValuePair<int, List<Hashtable>> kvpResolution in dictDNSResolutions)
{
Hashtable htAllResolutions = new Hashtable();
foreach (KeyValuePair<int, List<Hashtable>> kvpResolution in dictDNSResolutions)
string sHost = String.Empty;
Hashtable htData = new Hashtable();
foreach (Hashtable htEvent in kvpResolution.Value)
{
string sHost = String.Empty;
Hashtable htData = new Hashtable();
foreach (Hashtable htEvent in kvpResolution.Value)
{
int iType = getIntValue(htEvent["type"], -1);
var htParams = (Hashtable)htEvent["params"];
int iType = getIntValue(htEvent["type"], -1);
var htParams = (Hashtable)htEvent["params"];

if (iType == NetLogMagics.HOST_RESOLVER_IMPL_JOB)
{
sHost = (htParams["host"] as String) ?? "(missing)";
continue;
}
if (iType == NetLogMagics.HOST_RESOLVER_IMPL_PROC_TASK)
// TODO: HOST_RESOLVER_IMPL_JOB_REQUEST_ATTACH has a list of all of the sslconnectjobs
// that attached to this resolution looking for an address to use.

if (iType == NetLogMagics.HOST_RESOLVER_IMPL_JOB)
{
sHost = (htParams["host"] as String) ?? "(missing)";
continue;
}
if (iType == NetLogMagics.HOST_RESOLVER_IMPL_PROC_TASK)
{
// TODO: What if there's more than one?
if (htParams.ContainsKey("canonical_name") && ((htParams["canonical_name"] as String) == String.Empty))
{
htData = htParams;
continue;
htParams.Remove("canonical_name");
}

htData = htParams;
continue;
}
htAllResolutions.Add(sHost, htData);

}
_listSessions.Add(Session.BuildFromData(false,
htAllResolutions.Add(sHost, htData);
}

_listSessions.Add(Session.BuildFromData(false,
new HTTPRequestHeaders(
String.Format("/DNS_LOOKUPS"), // TODO: Add Machine name?
new[] { "Host: NETLOG" }),
Utilities.emptyByteArray,
new HTTPResponseHeaders(200, "Analyzed Data", new[] { "Content-Type: application/json; charset=utf-8" }),
Encoding.UTF8.GetBytes(JSON.JsonEncode(htAllResolutions)),
SessionFlags.ImportedFromOtherTool | SessionFlags.RequestGeneratedByFiddler | SessionFlags.ResponseGeneratedByFiddler | SessionFlags.ServedFromCache));
}
}
catch (Exception e) { FiddlerApplication.Log.LogFormat("GenerateDNSResolutionListSession failed: " + DescribeExceptionWithStack(e)); }
}
Expand Down
5 changes: 4 additions & 1 deletion FiddlerImportNetlog/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[assembly: AssemblyCopyright("Copyright ©2021 Eric Lawrence")]
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.3.2.1")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
[assembly: AssemblyVersion("1.3.2.2")] // ALWAYS UPDATE THE VERSION in the [ProfferFormat] attribute in FiddlerInterface.cs to match!
[assembly: Fiddler.RequiredVersion("4.6.0.0")]


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

// v1.3.2.2
// Add ".json;.gz" hint to ProfferFormat registration

// v1.3.2.1
// Add DNS entries to log
// Add READ_EARLY_HINTS_RESPONSE_HEADERS - _X-NetLog-Found-Early-Hint - https://www.fastly.com/blog/beyond-server-push-experimenting-with-the-103-early-hints-status-code
Expand Down

0 comments on commit f224498

Please sign in to comment.