@@ -31,12 +31,14 @@ struct Magics
3131 public int SEND_QUIC_HEADERS ;
3232 public int SEND_HTTP2_HEADERS ;
3333 public int READ_HEADERS ;
34+ public int FAKE_RESPONSE_HEADERS_CREATED ;
3435 public int COOKIE_INCLUSION_STATUS ;
3536 public int FILTERED_BYTES_READ ;
3637 public int SEND_BODY ;
3738 public int SEND_REQUEST ;
3839 public int SSL_CERTIFICATES_RECEIVED ;
3940 public int SSL_HANDSHAKE_MESSAGE_RECEIVED ;
41+ public int TCP_CONNECT ;
4042 }
4143
4244 internal static string DescribeExceptionWithStack ( Exception eX )
@@ -151,12 +153,14 @@ private void ExtractSessionsFromTraceJSON(ArrayList alTraceEvents)
151153 NetLogMagics . SEND_QUIC_HEADERS = 6 ;
152154 NetLogMagics . SEND_HTTP2_HEADERS = 7 ;
153155 NetLogMagics . READ_HEADERS = 8 ;
154- NetLogMagics . COOKIE_INCLUSION_STATUS = 9 ;
155- NetLogMagics . FILTERED_BYTES_READ = 10 ;
156- NetLogMagics . SEND_BODY = 11 ;
157- NetLogMagics . SEND_REQUEST = 12 ;
158- NetLogMagics . SSL_CERTIFICATES_RECEIVED = 13 ;
159- NetLogMagics . SSL_HANDSHAKE_MESSAGE_RECEIVED = 14 ;
156+ NetLogMagics . FAKE_RESPONSE_HEADERS_CREATED = 9 ;
157+ NetLogMagics . COOKIE_INCLUSION_STATUS = 10 ;
158+ NetLogMagics . FILTERED_BYTES_READ = 11 ;
159+ NetLogMagics . SEND_BODY = 12 ;
160+ NetLogMagics . SEND_REQUEST = 13 ;
161+ NetLogMagics . SSL_CERTIFICATES_RECEIVED = 14 ;
162+ NetLogMagics . SSL_HANDSHAKE_MESSAGE_RECEIVED = 15 ;
163+ NetLogMagics . TCP_CONNECT = 16 ;
160164
161165 List < Hashtable > listEvents = new List < Hashtable > ( ) ;
162166 foreach ( Hashtable htItem in alTraceEvents )
@@ -196,14 +200,14 @@ private void ExtractSessionsFromTraceJSON(ArrayList alTraceEvents)
196200 iType != NetLogMagics.SSL_HANDSHAKE_MESSAGE_RECEIVED) continue;
197201
198202 // Get (or create) the List of entries for this SOCKET.
199- if (!dictSecureSockets .ContainsKey(iSocketID))
203+ if (!dictSockets .ContainsKey(iSocketID))
200204 {
201205 events = new List<Hashtable>();
202- dictSecureSockets .Add(iSocketID, events);
206+ dictSockets .Add(iSocketID, events);
203207 }
204208 else
205209 {
206- events = dictSecureSockets [iSocketID];
210+ events = dictSockets [iSocketID];
207211 }
208212 // Add this event to the SOCKET's list.
209213 events.Add(htEvent);
@@ -270,7 +274,7 @@ private void ExtractSessionsFromTraceJSON(ArrayList alTraceEvents)
270274 sessSummary.utilSetResponseBody(sbClientInfo.ToString());*/
271275
272276 //GenerateDebugTreeSession(dictURLRequests);
273- //GenerateSocketListSession(dictSecureSockets );
277+ //GenerateSocketListSession(dictSockets );
274278
275279 NotifyProgress ( 1 , "Import Completed." ) ;
276280 }
@@ -328,14 +332,16 @@ public bool ExtractSessionsFromJSON(Hashtable htFile)
328332 NetLogMagics . SEND_QUIC_HEADERS = getIntValue ( htEventTypes [ "HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS" ] , - 995 ) ;
329333 NetLogMagics . SEND_HTTP2_HEADERS = getIntValue ( htEventTypes [ "HTTP_TRANSACTION_HTTP2_SEND_REQUEST_HEADERS" ] , - 994 ) ;
330334 NetLogMagics . READ_HEADERS = getIntValue ( htEventTypes [ "HTTP_TRANSACTION_READ_RESPONSE_HEADERS" ] , - 993 ) ;
331- NetLogMagics . FILTERED_BYTES_READ = getIntValue ( htEventTypes [ "URL_REQUEST_JOB_FILTERED_BYTES_READ" ] , - 992 ) ;
332- NetLogMagics . COOKIE_INCLUSION_STATUS = getIntValue ( htEventTypes [ "COOKIE_INCLUSION_STATUS" ] , - 991 ) ;
333- NetLogMagics . SEND_BODY = getIntValue ( htEventTypes [ "HTTP_TRANSACTION_SEND_REQUEST_BODY" ] , - 990 ) ;
334- NetLogMagics . SEND_REQUEST = getIntValue ( htEventTypes [ "HTTP_TRANSACTION_SEND_REQUEST" ] , - 989 ) ;
335+ NetLogMagics . FAKE_RESPONSE_HEADERS_CREATED = getIntValue ( htEventTypes [ "URL_REQUEST_FAKE_RESPONSE_HEADERS_CREATED" ] , - 992 ) ;
336+ NetLogMagics . FILTERED_BYTES_READ = getIntValue ( htEventTypes [ "URL_REQUEST_JOB_FILTERED_BYTES_READ" ] , - 991 ) ;
337+ NetLogMagics . COOKIE_INCLUSION_STATUS = getIntValue ( htEventTypes [ "COOKIE_INCLUSION_STATUS" ] , - 990 ) ;
338+ NetLogMagics . SEND_BODY = getIntValue ( htEventTypes [ "HTTP_TRANSACTION_SEND_REQUEST_BODY" ] , - 989 ) ;
339+ NetLogMagics . SEND_REQUEST = getIntValue ( htEventTypes [ "HTTP_TRANSACTION_SEND_REQUEST" ] , - 988 ) ;
335340
336341 // Socket-level Events
337- NetLogMagics . SSL_CERTIFICATES_RECEIVED = getIntValue ( htEventTypes [ "SSL_CERTIFICATES_RECEIVED" ] , - 988 ) ;
338- NetLogMagics . SSL_HANDSHAKE_MESSAGE_RECEIVED = getIntValue ( htEventTypes [ "SSL_HANDSHAKE_MESSAGE_RECEIVED" ] , - 987 ) ;
342+ NetLogMagics . SSL_CERTIFICATES_RECEIVED = getIntValue ( htEventTypes [ "SSL_CERTIFICATES_RECEIVED" ] , - 987 ) ;
343+ NetLogMagics . SSL_HANDSHAKE_MESSAGE_RECEIVED = getIntValue ( htEventTypes [ "SSL_HANDSHAKE_MESSAGE_RECEIVED" ] , - 986 ) ;
344+ NetLogMagics . TCP_CONNECT = getIntValue ( htEventTypes [ "TCP_CONNECT" ] , - 987 ) ;
339345
340346 // Get ALL event type names as strings for pretty print view
341347 dictEventTypes = new Dictionary < int , string > ( ) ;
@@ -410,7 +416,7 @@ public bool ExtractSessionsFromJSON(Hashtable htFile)
410416 int iEvent = - 1 ;
411417 int iLastPct = 25 ;
412418 var dictURLRequests = new Dictionary < int , List < Hashtable > > ( ) ;
413- var dictSecureSockets = new Dictionary < int , List < Hashtable > > ( ) ;
419+ var dictSockets = new Dictionary < int , List < Hashtable > > ( ) ;
414420
415421 // Loop over events; bucket those associated to URLRequests by the source request's ID.
416422 ArrayList alEvents = htFile [ "events" ] as ArrayList ;
@@ -435,17 +441,18 @@ public bool ExtractSessionsFromJSON(Hashtable htFile)
435441 int iSocketID = getIntValue ( htSource [ "id" ] , - 1 ) ;
436442
437443 if ( iType != NetLogMagics . SSL_CERTIFICATES_RECEIVED &&
438- iType != NetLogMagics . SSL_HANDSHAKE_MESSAGE_RECEIVED ) continue ;
444+ iType != NetLogMagics . SSL_HANDSHAKE_MESSAGE_RECEIVED &&
445+ iType != NetLogMagics . TCP_CONNECT ) continue ;
439446
440447 // Get (or create) the List of entries for this SOCKET.
441- if ( ! dictSecureSockets . ContainsKey ( iSocketID ) )
448+ if ( ! dictSockets . ContainsKey ( iSocketID ) )
442449 {
443450 events = new List < Hashtable > ( ) ;
444- dictSecureSockets . Add ( iSocketID , events ) ;
451+ dictSockets . Add ( iSocketID , events ) ;
445452 }
446453 else
447454 {
448- events = dictSecureSockets [ iSocketID ] ;
455+ events = dictSockets [ iSocketID ] ;
449456 }
450457 // Add this event to the SOCKET's list.
451458 events . Add ( htEvent ) ;
@@ -506,7 +513,7 @@ public bool ExtractSessionsFromJSON(Hashtable htFile)
506513 sessSummary . utilSetResponseBody ( sbClientInfo . ToString ( ) ) ;
507514
508515 GenerateDebugTreeSession ( dictURLRequests ) ;
509- GenerateSocketListSession ( dictSecureSockets ) ;
516+ GenerateSocketListSession ( dictSockets ) ;
510517
511518 NotifyProgress ( 1 , "Import Completed." ) ;
512519 return true ;
@@ -600,6 +607,24 @@ private void GenerateSocketListSession(Dictionary<int, List<Hashtable>> dictSock
600607 int iType = getIntValue ( htEvent [ "type" ] , - 1 ) ;
601608 var htParams = ( Hashtable ) htEvent [ "params" ] ;
602609
610+ if ( iType == NetLogMagics . TCP_CONNECT )
611+ {
612+ if ( htParams . ContainsKey ( "local_address" ) )
613+ {
614+ htThisSocket . Add ( "local_address" , htParams [ "local_address" ] ) ;
615+ }
616+ //"remote_address", "local_address", "address_list"
617+ if ( htParams . ContainsKey ( "remote_address" ) )
618+ {
619+ htThisSocket . Add ( "remote_address" , htParams [ "remote_address" ] ) ;
620+ }
621+ if ( htParams . ContainsKey ( "address_list" ) )
622+ {
623+ htThisSocket . Add ( "address_list" , htParams [ "address_list" ] ) ;
624+ }
625+ continue ;
626+ }
627+
603628 if ( iType == NetLogMagics . SSL_CERTIFICATES_RECEIVED )
604629 {
605630 StringBuilder sbCertsReceived = new StringBuilder ( ) ;
@@ -730,7 +755,7 @@ private void GenerateSocketListSession(Dictionary<int, List<Hashtable>> dictSock
730755 {
731756 _listSessions . Add ( Session . BuildFromData ( false ,
732757 new HTTPRequestHeaders (
733- String . Format ( "/SECURE_SOCKETS " ) , // TODO: Add Machine name?
758+ String . Format ( "/SOCKETS " ) , // TODO: Add Machine name?
734759 new [ ] { "Host: NETLOG" } ) ,
735760 Utilities . emptyByteArray ,
736761 new HTTPResponseHeaders ( 200 , "Analyzed Data" , new [ ] { "Content-Type: application/json; charset=utf-8" } ) ,
@@ -857,7 +882,7 @@ private void ParseSessionsFromBucket(KeyValuePair<int, List<Hashtable>> kvpUR)
857882 // Most events we care about should have parameters. LANDMINE_MEME HERE
858883 if ( iType != NetLogMagics . SEND_REQUEST && null == htParams ) continue ;
859884
860- FiddlerApplication . Log . LogFormat ( "URLRequest#{0} - Event type: {1} - {2}" , kvpUR . Key , iType , sURL ) ;
885+ // FiddlerApplication.Log.LogFormat("URLRequest#{0} - Event type: {1} - {2}", kvpUR.Key, iType, sURL);
861886
862887 #region ParseImportantEvents
863888 // C# cannot |switch()| on non-constant case values. Hrmph.
@@ -1032,7 +1057,8 @@ private void ParseSessionsFromBucket(KeyValuePair<int, List<Hashtable>> kvpUR)
10321057 continue ;
10331058 }
10341059
1035- if ( iType == NetLogMagics . READ_HEADERS )
1060+ if ( ( iType == NetLogMagics . READ_HEADERS ) ||
1061+ ( iType == NetLogMagics . FAKE_RESPONSE_HEADERS_CREATED ) )
10361062 {
10371063 ArrayList alHeaderLines = htParams [ "headers" ] as ArrayList ;
10381064 oTimers . ServerBeginResponse = oTimers . FiddlerGotResponseHeaders = GetTimeStamp ( htEvent [ "time" ] , baseTime ) ;
0 commit comments