Exemplo n.º 1
0
        /// <summary>
        /// DNS 조회 결과 분석
        /// </summary>
        /// <param name="i_dnsQuery"></param>
        /// <param name="i_nslookupResults"></param>
        public ParseDnsResult(DnsQuery i_dnsQuery, string i_nslookupResults)
        {
            if ((i_dnsQuery == null) || (i_nslookupResults == null))
            {
                throw new Exception("Invalid input while attempting to parse DNS results.");
            }
            this.m_dnsResult.query = i_dnsQuery;
            bool flag = false;

            if (this.m_dnsResult.query.QueryType == DnsRecordType.SRV)
            {
                this.ParseData("svr hostname   = ", i_nslookupResults, out flag, out this.m_dnsResult.hostname);
                if (flag)
                {
                    this.m_dnsResult.foundRecord = true;
                }
                else
                {
                    this.m_dnsResult.foundRecord = false;
                }
                if (this.m_dnsResult.foundRecord)
                {
                    this.ParseData("internet address = ", i_nslookupResults, out flag, out this.m_dnsResult.ip);
                    this.ParseData("port           = ", i_nslookupResults, out flag, out this.m_dnsResult.port);
                    this.ParseData("weight         = ", i_nslookupResults, out flag, out this.m_dnsResult.weight);
                    this.ParseData("priority       = ", i_nslookupResults, out flag, out this.m_dnsResult.priority);
                }
            }
            else
            {
                if (this.m_dnsResult.query.QueryType != DnsRecordType.A)
                {
                    throw new Exception("Only SRV records are implemented");
                }
                this.ParseData("Name:    ", i_nslookupResults, out flag, out this.m_dnsResult.hostname);
                if (flag)
                {
                    this.m_dnsResult.foundRecord = true;
                }
                else
                {
                    this.m_dnsResult.foundRecord = false;
                }
                if (this.m_dnsResult.foundRecord)
                {
                    this.ParseData("Address:  ", i_nslookupResults, out flag, out this.m_dnsResult.hostname);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// DNS 조회 결과 분석
 /// </summary>
 /// <param name="i_dnsQuery"></param>
 /// <param name="i_nslookupResults"></param>
 public ParseDnsResult(DnsQuery i_dnsQuery, string i_nslookupResults)
 {
     if ((i_dnsQuery == null) || (i_nslookupResults == null))
     {
         throw new Exception("Invalid input while attempting to parse DNS results.");
     }
     this.m_dnsResult.query = i_dnsQuery;
     bool flag = false;
     if (this.m_dnsResult.query.QueryType == DnsRecordType.SRV)
     {
         this.ParseData("svr hostname   = ", i_nslookupResults, out flag, out this.m_dnsResult.hostname);
         if (flag)
         {
             this.m_dnsResult.foundRecord = true;
         }
         else
         {
             this.m_dnsResult.foundRecord = false;
         }
         if (this.m_dnsResult.foundRecord)
         {
             this.ParseData("internet address = ", i_nslookupResults, out flag, out this.m_dnsResult.ip);
             this.ParseData("port           = ", i_nslookupResults, out flag, out this.m_dnsResult.port);
             this.ParseData("weight         = ", i_nslookupResults, out flag, out this.m_dnsResult.weight);
             this.ParseData("priority       = ", i_nslookupResults, out flag, out this.m_dnsResult.priority);
         }
     }
     else
     {
         if (this.m_dnsResult.query.QueryType != DnsRecordType.A)
         {
             throw new Exception("Only SRV records are implemented");
         }
         this.ParseData("Name:    ", i_nslookupResults, out flag, out this.m_dnsResult.hostname);
         if (flag)
         {
             this.m_dnsResult.foundRecord = true;
         }
         else
         {
             this.m_dnsResult.foundRecord = false;
         }
         if (this.m_dnsResult.foundRecord)
         {
             this.ParseData("Address:  ", i_nslookupResults, out flag, out this.m_dnsResult.hostname);
         }
     }
 }