Skip to content

Commit 4cdc835

Browse files
SQLNA Updates
Find and display the ConnectionID in the CSV file. Display the InstOpt value in the CSV file.
1 parent c6c5b0d commit 4cdc835

File tree

8 files changed

+18
-5
lines changed

8 files changed

+18
-5
lines changed
1 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

SQL_Network_Analyzer/SQLNA/ConversationData.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ public class ConversationData // - constructed in GetI
110110
public bool hasLowTLSVersion = false; // - set in ProcessTDS
111111
public string databaseName = null; // - set in ProcessTDS
112112
public string serverName = null; // - set in ProcessTDS
113+
public string serverInstance = null; // - set in GetClientPreloginInfo
113114
public uint processID = 0;
114115
public uint threadID = 0; // - set in GetClientPreloginInfo
116+
public Guid connectionID = Guid.Empty; // - set in GetClientPreloginInfo
115117
// Login Error and Delay Stats
116118
public long synTime = 0; //
117119
public long ackSynTime = 0; //

SQL_Network_Analyzer/SQLNA/OutputText.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3517,7 +3517,7 @@ private static void DisplayFooter()
35173517

35183518
private static void OutputStats(NetworkTrace Trace)
35193519
{
3520-
Program.logStat(@"SourceIP,SourcePort,DestIP,DestPort,IPVersion,Protocol,Syn,Fin,Reset,AckSynDelayms,Retransmit,ClientDup,ServerDup,KeepAlive,Integrated Login,NTLM,Login7,Encrypted,Mars,PacketVisualization,Pktmon,MaxPktmonDelay,PktmonDrop,PktmonDropReason,MaxPayloadSize,PayloadSizeLimit,Frames,Bytes,SentBytes,ReceivedBytes,Bytes/Sec,StartFile,EndFile,StartTime,EndTime,Duration,ClientTTL,ClientLowHops,ServerTTL,ServerLowHops,ServerName,ServerVersion,DatabaseName,ServerTDSVersion,ClientTDSVersion,ServerTLSVersion,ClientTLSVersion,RedirSrv,RedirPort,Error,ErrorState,ErrorMessage,");
3520+
Program.logStat(@"SourceIP,SourcePort,DestIP,DestPort,IPVersion,Protocol,Syn,Fin,Reset,AckSynDelayms,Retransmit,ClientDup,ServerDup,KeepAlive,Integrated Login,NTLM,Login7,Encrypted,Mars,PacketVisualization,Pktmon,MaxPktmonDelay,PktmonDrop,PktmonDropReason,MaxPayloadSize,PayloadSizeLimit,Frames,Bytes,SentBytes,ReceivedBytes,Bytes/Sec,StartFile,EndFile,StartTime,EndTime,Duration,ClientTTL,ClientLowHops,ServerTTL,ServerLowHops,ConnectionID,ServerName,InstOpt,ServerVersion,DatabaseName,ServerTDSVersion,ClientTDSVersion,ServerTLSVersion,ClientTLSVersion,RedirSrv,RedirPort,Error,ErrorState,ErrorMessage,");
35213521

35223522
long traceFirstTick = 0;
35233523
if (Trace.frames != null && Trace.frames.Count > 0)
@@ -3583,7 +3583,9 @@ private static void OutputStats(NetworkTrace Trace)
35833583
(c.TTLCountOut == 0 ? "" : c.minTTLHopsOut.ToString()) + "," +
35843584
(c.TTLCountIn == 0 ? "" : (c.TTLSumIn / c.TTLCountIn).ToString()) + "," +
35853585
(c.TTLCountIn == 0 ? "" : c.minTTLHopsIn.ToString()) + "," +
3586+
(c.connectionID == Guid.Empty ? "" : c.connectionID.ToString()) + "," +
35863587
ServerName + "," +
3588+
(c.serverInstance == null ? "" : c.serverInstance) + "," +
35873589
ServerVersion + "," +
35883590
((c.databaseName == null) ? "" : c.databaseName) + "," +
35893591
c.FriendlyTDSVersionServer + "," +

SQL_Network_Analyzer/SQLNA/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.5.2085.0")]
36-
[assembly: AssemblyFileVersion("1.5.2085.0")]
35+
[assembly: AssemblyVersion("1.5.2093.0")]
36+
[assembly: AssemblyFileVersion("1.5.2093.0")]

SQL_Network_Analyzer/SQLNA/TDSParser.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ private static void GetClientPreloginInfo(byte[] tdsPayLoad, ConversationData co
8989
case 1: // encyption options.
9090
if (tdsPayLoad[8 + offset] == 1) conv.isEncrypted = true;
9191
break;
92-
case 2: // Client requested Instance
93-
clientInstance = utility.CleanString(utility.ReadAnsiString(tdsPayLoad, 8 + offset, length));
92+
case 2: // Client requested Instance - this is an ASCIIZ string - but fotunately, we are given the length of the token, which ends in a null (0x00) string terminator byte
93+
clientInstance = utility.CleanString(utility.ReadAnsiString(tdsPayLoad, 8 + offset, length)); // cleans trailing nulls
94+
conv.serverInstance = clientInstance; // the instance that the client is requesting
9495
break;
9596
case 3: //Client TID.
9697
if (4 == length)
@@ -99,6 +100,14 @@ private static void GetClientPreloginInfo(byte[] tdsPayLoad, ConversationData co
99100
case 4: // MARS options.
100101
if (tdsPayLoad[8 + offset] == 1) conv.isMARSEnabled = true;
101102
break;
103+
case 5: // ConnectionID (16 byte GUID) and ActivityID (20 bytes) - ignoring ActivityID as we don't need it
104+
if (length == 36)
105+
{
106+
byte[] guidBytes = new byte[16];
107+
Array.Copy(tdsPayLoad, 8 + offset, guidBytes, 0, 16);
108+
conv.connectionID = new Guid(guidBytes);
109+
}
110+
break;
102111
default:
103112
break;
104113
}

0 commit comments

Comments
 (0)