public TreeNode GetDNSNode(PACKET_DNS PDns)
        {
            TreeNode mNode;
            TreeNode mNode1;
            TreeNode mNode2;
            string   Tmp = "";
            int      i   = 0;

            mNode      = new TreeNode();
            mNode.Text = "DOMAIN NAME SERVICE";

            Tmp = "Transaction Id :" + Function.ReFormatString(PDns.TransactionId, null);
            mNode.Nodes.Add(Tmp);

            mNode1      = new TreeNode();
            mNode1.Text = "Flags :" + Function.ReFormatString(PDns.Flags, null);
            GetFlagsString(PDns.Flags);
            for (i = 0; i < 8; i++)
            {
                mNode1.Nodes.Add(FlagsArray[i]);
            }
            mNode.Nodes.Add(mNode1);

            Tmp = "Questions :" + Function.ReFormatString(PDns.Questions, null);
            mNode.Nodes.Add(Tmp);

            Tmp = "Answer RRS :" + Function.ReFormatString(PDns.AnswerRRS, null);
            mNode.Nodes.Add(Tmp);

            Tmp = "Authority RRS :" + Function.ReFormatString(PDns.AuthorityRRS, null);
            mNode.Nodes.Add(Tmp);

            Tmp = "Additional RRS :" + Function.ReFormatString(PDns.AdditionalRRS, null);
            mNode.Nodes.Add(Tmp);

            if (PDns.Questions > 0)
            {
                mNode1      = new TreeNode();
                mNode1.Text = "QUERIES";

                for (i = 1; i <= PDns.Questions; i++)
                {
                    mNode2      = new TreeNode();
                    mNode2.Text = "Query Record " + i.ToString();

                    Tmp = "Name :" + PDns.QuestionObject[i - 1].Name;
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Type : " + Function.ReFormatString(PDns.QuestionObject[i - 1].Type, PDns.QuestionObject[i - 1].TypeStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Class : " + Function.ReFormatString(PDns.QuestionObject[i - 1].Class, PDns.QuestionObject[i - 1].ClassStr);
                    mNode2.Nodes.Add(Tmp);

                    mNode1.Nodes.Add(mNode2);
                }

                mNode.Nodes.Add(mNode1);
            }

            if (PDns.AnswerRRS > 0)
            {
                mNode1      = new TreeNode();
                mNode1.Text = "ANSWER RECORDS";

                for (i = 1; i <= PDns.AnswerRRS; i++)
                {
                    mNode2      = new TreeNode();
                    mNode2.Text = "Answer Record " + i.ToString();

                    Tmp = "Name :" + PDns.AnswerObject[i - 1].Name;
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Type : " + Function.ReFormatString(PDns.AnswerObject[i - 1].Type, PDns.AnswerObject[i - 1].TypeStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Class : " + Function.ReFormatString(PDns.AnswerObject[i - 1].Class, PDns.AnswerObject[i - 1].ClassStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Time to Live : " + Function.ReFormatString(PDns.AnswerObject[i - 1].TimeToLive, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Data Length : " + Function.ReFormatString(PDns.AnswerObject[i - 1].DataLength, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Ip Address :" + PDns.AnswerObject[i - 1].IpAddress;
                    mNode2.Nodes.Add(Tmp);

                    mNode1.Nodes.Add(mNode2);
                }

                mNode.Nodes.Add(mNode1);
            }

            if (PDns.AuthorityRRS > 0)
            {
                mNode1      = new TreeNode();
                mNode1.Text = "AUTHORITY RECORDS";

                for (i = 1; i <= PDns.AuthorityRRS; i++)
                {
                    mNode2      = new TreeNode();
                    mNode2.Text = "Authority Record " + i.ToString();

                    Tmp = "Name :" + PDns.AuthorityObject[i - 1].Name;
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Type : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].Type, PDns.AuthorityObject[i - 1].TypeStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Class : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].Class, PDns.AuthorityObject[i - 1].ClassStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Time to Live : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].TimeToLive, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Data Length : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].DataLength, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Primary Name Server : " + PDns.AuthorityObject[i - 1].PrimaryNameServer;
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Responsible Authority's Mailbox : " + PDns.AuthorityObject[i - 1].ResponsibleAuthoritysMailBox;
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Serial Number : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].SerialNumber, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Refresh Interval : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].RefreshInterval, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Retry Interval : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].RetryInterval, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Expiration Limit : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].ExpirationLimit, null);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Minimum TTL : " + Function.ReFormatString(PDns.AuthorityObject[i - 1].MinimumTTL, null);
                    mNode2.Nodes.Add(Tmp);

                    mNode1.Nodes.Add(mNode2);
                }

                mNode.Nodes.Add(mNode1);
            }

            if (PDns.AdditionalRRS > 0)
            {
                mNode1      = new TreeNode();
                mNode1.Text = "Additional Records";

                for (i = 1; i <= PDns.AdditionalRRS; i++)
                {
                    mNode2      = new TreeNode();
                    mNode2.Text = "Additional Record " + i.ToString();

                    Tmp = "Name :" + PDns.AdditionalObject[i - 1].Name;
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Type : " + Function.ReFormatString(PDns.AdditionalObject[i - 1].Type, PDns.AdditionalObject[i - 1].TypeStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Class : " + Function.ReFormatString(PDns.AdditionalObject[i - 1].Class, PDns.AdditionalObject[i - 1].ClassStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Time to Live : " + Function.ReFormatString(PDns.AdditionalObject[i - 1].TimeToLive, PDns.AdditionalObject[i - 1].TimeToLiveStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Data Length : " + Function.ReFormatString(PDns.AdditionalObject[i - 1].DataLength, null);
                    mNode2.Nodes.Add(Tmp);

                    mNode2      = new TreeNode();
                    mNode2.Text = "Flags :" + Function.ReFormatString(PDns.AdditionalObject[i - 1].Flags, null);
                    for (i = 0; i < 2; i++)
                    {
                        mNode2.Nodes.Add(Flags2Array[i]);
                    }
                    mNode1.Nodes.Add(mNode2);

                    Tmp = "Flags : " + Function.ReFormatString(PDns.AdditionalObject[i - 1].Class, PDns.AdditionalObject[i - 1].ClassStr);
                    mNode2.Nodes.Add(Tmp);

                    Tmp = "Address : " + Function.ReFormatString(PDns.AdditionalObject[i - 1].Address, PDns.AdditionalObject[i - 1].AddressStr);
                    mNode2.Nodes.Add(Tmp);

                    mNode1.Nodes.Add(mNode2);
                }

                mNode.Nodes.Add(mNode1);
            }

            return(mNode);
        }
Exemple #2
0
        public TreeNode GetDNSNode( PACKET_DNS PDns )
        {
            TreeNode mNode;
            TreeNode mNode1;
            TreeNode mNode2;
            string Tmp = "";
            int i = 0;

            mNode = new TreeNode();
            mNode.Text = "DOMAIN NAME SERVICE";

            Tmp = "Transaction Id :" + Function.ReFormatString( PDns.TransactionId , null );
            mNode.Nodes.Add( Tmp );

            mNode1 = new TreeNode();
            mNode1.Text = "Flags :" + Function.ReFormatString( PDns.Flags , null );
            GetFlagsString( PDns.Flags );
            for( i = 0; i < 8; i ++ )
                mNode1.Nodes.Add( FlagsArray[ i ] );
            mNode.Nodes.Add( mNode1 );

            Tmp = "Questions :" + Function.ReFormatString( PDns.Questions , null );
            mNode.Nodes.Add( Tmp );

            Tmp = "Answer RRS :" + Function.ReFormatString( PDns.AnswerRRS , null );
            mNode.Nodes.Add( Tmp );

            Tmp = "Authority RRS :" + Function.ReFormatString( PDns.AuthorityRRS , null );
            mNode.Nodes.Add( Tmp );

            Tmp = "Additional RRS :" + Function.ReFormatString( PDns.AdditionalRRS , null );
            mNode.Nodes.Add( Tmp );

            if( PDns.Questions > 0 )
            {
                mNode1 = new TreeNode();
                mNode1.Text = "QUERIES";

                for( i = 1; i <= PDns.Questions; i ++ )
                {
                    mNode2 = new TreeNode();
                    mNode2.Text = "Query Record " + i.ToString();

                    Tmp = "Name :" + PDns.QuestionObject[i-1].Name;
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Type : " + Function.ReFormatString( PDns.QuestionObject[i-1].Type , PDns.QuestionObject[i-1].TypeStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Class : " + Function.ReFormatString( PDns.QuestionObject[i-1].Class , PDns.QuestionObject[i-1].ClassStr );
                    mNode2.Nodes.Add( Tmp );

                    mNode1.Nodes.Add( mNode2 );

                }

                mNode.Nodes.Add( mNode1 );
            }

            if( PDns.AnswerRRS > 0 )
            {
                mNode1 = new TreeNode();
                mNode1.Text = "ANSWER RECORDS";

                for( i = 1; i <= PDns.AnswerRRS; i ++ )
                {
                    mNode2 = new TreeNode();
                    mNode2.Text = "Answer Record " + i.ToString();

                    Tmp = "Name :" + PDns.AnswerObject[i-1].Name;
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Type : " + Function.ReFormatString( PDns.AnswerObject[i-1].Type , PDns.AnswerObject[i-1].TypeStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Class : " + Function.ReFormatString( PDns.AnswerObject[i-1].Class , PDns.AnswerObject[i-1].ClassStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Time to Live : " + Function.ReFormatString( PDns.AnswerObject[i-1].TimeToLive , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Data Length : " + Function.ReFormatString( PDns.AnswerObject[i-1].DataLength , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Ip Address :" + PDns.AnswerObject[i-1].IpAddress;
                    mNode2.Nodes.Add( Tmp );

                    mNode1.Nodes.Add( mNode2 );
                }

                mNode.Nodes.Add( mNode1 );
            }

            if( PDns.AuthorityRRS > 0 )
            {
                mNode1 = new TreeNode();
                mNode1.Text = "AUTHORITY RECORDS";

                for( i = 1; i <= PDns.AuthorityRRS; i ++ )
                {
                    mNode2 = new TreeNode();
                    mNode2.Text = "Authority Record " + i.ToString();

                    Tmp = "Name :" + PDns.AuthorityObject[i-1].Name;
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Type : " + Function.ReFormatString( PDns.AuthorityObject[i-1].Type , PDns.AuthorityObject[i-1].TypeStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Class : " + Function.ReFormatString( PDns.AuthorityObject[i-1].Class , PDns.AuthorityObject[i-1].ClassStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Time to Live : " + Function.ReFormatString( PDns.AuthorityObject[i-1].TimeToLive , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Data Length : " + Function.ReFormatString( PDns.AuthorityObject[i-1].DataLength , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Primary Name Server : " + PDns.AuthorityObject[i-1].PrimaryNameServer;
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Responsible Authority's Mailbox : " + PDns.AuthorityObject[i-1].ResponsibleAuthoritysMailBox;
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Serial Number : " + Function.ReFormatString( PDns.AuthorityObject[i-1].SerialNumber , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Refresh Interval : " + Function.ReFormatString( PDns.AuthorityObject[i-1].RefreshInterval , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Retry Interval : " + Function.ReFormatString( PDns.AuthorityObject[i-1].RetryInterval , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Expiration Limit : " + Function.ReFormatString( PDns.AuthorityObject[i-1].ExpirationLimit , null );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Minimum TTL : " + Function.ReFormatString( PDns.AuthorityObject[i-1].MinimumTTL , null );
                    mNode2.Nodes.Add( Tmp );

                    mNode1.Nodes.Add( mNode2 );

                }

                mNode.Nodes.Add( mNode1 );
            }

            if( PDns.AdditionalRRS > 0 )
            {
                mNode1 = new TreeNode();
                mNode1.Text = "Additional Records";

                for( i = 1; i <= PDns.AdditionalRRS; i ++ )
                {
                    mNode2 = new TreeNode();
                    mNode2.Text = "Additional Record " + i.ToString();

                    Tmp = "Name :" + PDns.AdditionalObject[i-1].Name;
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Type : " + Function.ReFormatString( PDns.AdditionalObject[i-1].Type , PDns.AdditionalObject[i-1].TypeStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Class : " + Function.ReFormatString( PDns.AdditionalObject[i-1].Class , PDns.AdditionalObject[i-1].ClassStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Time to Live : " + Function.ReFormatString( PDns.AdditionalObject[i-1].TimeToLive , PDns.AdditionalObject[i-1].TimeToLiveStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Data Length : " + Function.ReFormatString( PDns.AdditionalObject[i-1].DataLength , null );
                    mNode2.Nodes.Add( Tmp );

                    mNode2 = new TreeNode();
                    mNode2.Text = "Flags :" + Function.ReFormatString( PDns.AdditionalObject[i-1].Flags , null );
                    for( i = 0; i < 2; i ++ )
                        mNode2.Nodes.Add( Flags2Array[ i ] );
                    mNode1.Nodes.Add( mNode2 );

                    Tmp = "Flags : " + Function.ReFormatString( PDns.AdditionalObject[i-1].Class , PDns.AdditionalObject[i-1].ClassStr );
                    mNode2.Nodes.Add( Tmp );

                    Tmp = "Address : " + Function.ReFormatString( PDns.AdditionalObject[i-1].Address , PDns.AdditionalObject[i-1].AddressStr );
                    mNode2.Nodes.Add( Tmp );

                    mNode1.Nodes.Add( mNode2 );

                }

                mNode.Nodes.Add( mNode1 );
            }

            return mNode;
        }