⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 packetnbns.cs

📁 一个抓包工具
💻 CS
📖 第 1 页 / 共 3 页
字号:
					mNode1 = new TreeNode();
					mNode1.Text = "Queries";
					Function.SetPosition( ref mNode1 , Index , PNbns.QuestionRRS * 38 , true );

					PNbns.Questions.Items = new QUESTION_ITEM[ PNbns.QuestionRRS ];
					for( i = 0; i < PNbns.QuestionRRS; i ++ )
					{
						mNode2 = new TreeNode();
						Function.SetPosition( ref mNode2 , Index , 38 , true );

						PNbns.Questions.Items[i].Name = Function.GetNetBiosName( PacketData , ref Index , ref NNumber );
						Tmp = "Name :" + PNbns.Questions.Items[i].Name;
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 34 , 34 , false );

						PNbns.Questions.Items[i].Type = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						Tmp = "Type : " + Function.ReFormatString( PNbns.Questions.Items[i].Type , GetTypeString( PNbns.Questions.Items[i].Type ) );
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );

						PNbns.Questions.Items[i].Class = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						Tmp = "Class : " + Function.ReFormatString( PNbns.Questions.Items[i].Class , GetClassString( PNbns.Questions.Items[i].Class ) );
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );

						mNode2.Text = PNbns.Questions.Items[i].Name + " , " + GetTypeString( PNbns.Questions.Items[i].Type ) + " , " + GetClassString( PNbns.Questions.Items[i].Class );
						mNode1.Nodes.Add( mNode2 );

					}

					mNodex.Nodes.Add( mNode1 );

				}

				if( PNbns.AnswerRRS > 0 )
				{
					mNode1 = new TreeNode();
					mNode1.Text = "Answers";
					kkk = Index;

					PNbns.Answers.Name = Function.GetNetBiosName( PacketData , ref Index , ref NNumber );
					Tmp = "Name :" + PNbns.Answers.Name;
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 34 , 34 , false );

					PNbns.Answers.Type = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Type : " + Function.ReFormatString( PNbns.Answers.Type , GetTypeString( PNbns.Answers.Type ) );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.Class = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Class : " + Function.ReFormatString( PNbns.Answers.Class , GetClassString( PNbns.Answers.Class ) );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.TimeToLive = Function.Get4Bytes( PacketData , ref Index , Const.VALUE );
					Tmp = "Time to Live : " + Function.ReFormatString( PNbns.Answers.TimeToLive , PNbns.Answers.TimeToLive.ToString() + " sn" );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 4 , 4 , false );

					PNbns.Answers.DataLength = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Data Length : " + Function.ReFormatString( PNbns.Answers.DataLength , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfNames = PacketData[ Index ++ ];
					Tmp = "Number of Names : " + Function.ReFormatString( PNbns.Answers.NumberOfNames , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 1 , 1 , false );

					if( PNbns.Answers.NumberOfNames > 0 )
					{
						PNbns.Answers.Items = new ANSWER_ITEM[PNbns.Answers.NumberOfNames];

						for( i = 0; i < PNbns.Answers.NumberOfNames; i ++ )
						{
							PNbns.Answers.Items[i].Name = Function.GetNetBiosNameSerial( PacketData , ref Index , ref NNumber );
							PNbns.Answers.Items[i].Name += " ( " + Const.GetNetBiosNames( NNumber ) + " )";
							Tmp = "Name : " + PNbns.Answers.Items[i].Name;
							mNode1.Nodes.Add( Tmp );
							Function.SetPosition( ref mNode1 , Index - 16 , 16 , false );

							PNbns.Answers.Items[i].Flags = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
							mNode2 = new TreeNode();
							Function.SetPosition( ref mNode2 , Index - 2 , 2 , true );
							mNode2.Text = "Name Flags : " + Function.ReFormatString( PNbns.Answers.Items[i].Flags , null );
							mNode2.Nodes.Add( Function.DecodeBitField( PNbns.Answers.Items[i].Flags , 0x8000 , "Group name", "Unique name" ) );
							Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );
							mNode2.Nodes.Add( Function.DecodeBitField( PNbns.Answers.Items[i].Flags , 0x6000 , NBFlagsNodeTypeList ) );
							Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );
							mNode2.Nodes.Add( Function.DecodeBitField( PNbns.Answers.Items[i].Flags , 0x1000 , "Name is being deregistered", "Name is not being deregistered" ) );
							Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );
							mNode2.Nodes.Add( Function.DecodeBitField( PNbns.Answers.Items[i].Flags , 0x0800 , "Name is in conflict", "Name is not in conflict" ) );
							Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );
							mNode2.Nodes.Add( Function.DecodeBitField( PNbns.Answers.Items[i].Flags , 0x0400 , "Name is active", "Name is not active" ) );
							Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );
							mNode2.Nodes.Add( Function.DecodeBitField( PNbns.Answers.Items[i].Flags , 0x0200 , "Permanent node name", "Not permanent node name" ) );
							Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );
							mNode1.Nodes.Add( mNode2 );

						}
					}
					
					PNbns.Answers.UnitId = Function.GetMACAddress( PacketData , ref Index );
					Tmp = "Unit Id : " + PNbns.Answers.UnitId;
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 6 , 6 , false );

					PNbns.Answers.Jumpers = PacketData[ Index ++ ];
					Tmp = "Jumpers : " + Function.ReFormatString( PNbns.Answers.Jumpers , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 1 , 1 , false );

					PNbns.Answers.TestResult = PacketData[ Index ++ ];
					Tmp = "Test Result : " + Function.ReFormatString( PNbns.Answers.TestResult , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 1 , 1 , false );

					PNbns.Answers.VersionNumber = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Version Number : " + Function.ReFormatString( PNbns.Answers.VersionNumber , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.PeriodOfStatistics = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Period of statistics : " + Function.ReFormatString( PNbns.Answers.PeriodOfStatistics , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.CRCs = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of CRCs : " + Function.ReFormatString( PNbns.Answers.CRCs , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfAlignmentErrors = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of alignment errors : " + Function.ReFormatString( PNbns.Answers.NumberOfAlignmentErrors , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfCollisions = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of collisions : " + Function.ReFormatString( PNbns.Answers.NumberOfCollisions , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfSendAborts = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of send aborts : " + Function.ReFormatString( PNbns.Answers.NumberOfSendAborts , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfGoodSends = Function.Get4Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of good sends : " + Function.ReFormatString( PNbns.Answers.NumberOfGoodSends , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 4 , 4 , false );

					PNbns.Answers.NumberOfReceives = Function.Get4Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of good receives : " + Function.ReFormatString( PNbns.Answers.NumberOfReceives , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 4 , 4 , false );

					PNbns.Answers.NumberOfRetransmits = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of retransmits : " + Function.ReFormatString( PNbns.Answers.NumberOfRetransmits , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfNoResourceConditions = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of no resource conditions : " + Function.ReFormatString( PNbns.Answers.NumberOfNoResourceConditions , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfCommandBlocks = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of command blocks : " + Function.ReFormatString( PNbns.Answers.NumberOfCommandBlocks , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.NumberOfPendingSessions = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Number of pending sessions : " + Function.ReFormatString( PNbns.Answers.NumberOfPendingSessions , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.MaxNumberOfPendingSessions = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Max number of pending sessions : " + Function.ReFormatString( PNbns.Answers.MaxNumberOfPendingSessions , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.MaxTotalSessionPossible = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Max total sessions possible : " + Function.ReFormatString( PNbns.Answers.MaxTotalSessionPossible , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					PNbns.Answers.SessionDataPacketSize = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
					Tmp = "Session data packet size : " + Function.ReFormatString( PNbns.Answers.SessionDataPacketSize , null );
					mNode1.Nodes.Add( Tmp );
					Function.SetPosition( ref mNode1 , Index - 2 , 2 , false );

					Function.SetPosition( ref mNode1 , kk , Index - kk , false );
					mNodex.Nodes.Add( mNode1 );

				}

				if( PNbns.AuthorityRRS > 0 )
				{
					/*PNbns.AuthorityObject = new QUESTION_ITEM[ PNbns.AuthorityRRS ];
					for( i = 0; i < PNbns.AuthorityRRS; i ++ )
					{
						PNbns.AuthorityObject[i].Name = "";
						while( PacketData[ Index ] != 0 )
							PNbns.AuthorityObject[i].Name += (char) PacketData[ Index ++ ];

						Index ++;
						u = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						PNbns.AuthorityObject[i].Type = u;
						PNbns.AuthorityObject[i].TypeStr = GetTypeString( u );

						u = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						PNbns.AuthorityObject[i].Class = u;
						PNbns.AuthorityObject[i].ClassStr = GetClassString( u );
					}*/
				}

				if( PNbns.AdditionalRRS > 0 )
				{
					mNode1 = new TreeNode();
					mNode1.Text = "Additionals";
					Function.SetPosition( ref mNode1 , Index , PNbns.AdditionalRRS * 50 , true );

					PNbns.Additionals.Items = new ADDITIONAL_ITEM[ PNbns.AdditionalRRS ];
					for( i = 0; i < PNbns.AdditionalRRS; i ++ )
					{
						mNode2 = new TreeNode();
						Function.SetPosition( ref mNode2 , Index , 50 , true );

						PNbns.Additionals.Items[i].Name = Function.GetNetBiosName( PacketData , ref Index , ref NNumber );
						Tmp = "Name :" + PNbns.Additionals.Items[i].Name;
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 34 , 34 , false );

						PNbns.Additionals.Items[i].Type = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						Tmp = "Type : " + Function.ReFormatString( PNbns.Additionals.Items[i].Type , GetTypeString( PNbns.Additionals.Items[i].Type ) );
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );

						PNbns.Additionals.Items[i].Class = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						Tmp = "Class : " + Function.ReFormatString( PNbns.Additionals.Items[i].Class , GetClassString( PNbns.Additionals.Items[i].Class ) );
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );

						mNode2.Text = PNbns.Additionals.Items[i].Name + " , " + GetTypeString( PNbns.Additionals.Items[i].Type ) + " , " + GetClassString( PNbns.Additionals.Items[i].Class );

						PNbns.Additionals.Items[i].TimeToLive = Function.Get4Bytes( PacketData , ref Index , Const.VALUE );
						Tmp = "Time to Live : " + Function.ReFormatString( PNbns.Additionals.Items[i].TimeToLive , PNbns.Additionals.Items[i].TimeToLive.ToString() + " sn" );
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 4 , 4 , false );

						PNbns.Additionals.Items[i].DataLength = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						Tmp = "Data Length : " + Function.ReFormatString( PNbns.Additionals.Items[i].DataLength , null );
						mNode2.Nodes.Add( Tmp );
						Function.SetPosition( ref mNode2 , Index - 2 , 2 , false );

						PNbns.Additionals.Items[i].Flags = Function.Get2Bytes( PacketData , ref Index , Const.NORMAL );
						mNode3 = new TreeNode();
						mNode3.Text = "Flags :" + Function.ReFormatString( PNbns.Additionals.Items[i].Flags , null );
						Function.SetPosition( ref mNode3 , Index - 2 , 2 , true );
						mNode3.Nodes.Add( Function.DecodeBitField( PNbns.Additionals.Items[i].Flags , 0x8000 , "Group name", "Unique name" ) );
						Function.SetPosition( ref mNode3 , Index - 2 , 2 , false );
						mNode3.Nodes.Add( Function.DecodeBitField( PNbns.Additionals.Items[i].Flags , 0x6000 , NBFlagsNodeTypeList ) );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -