Exemple #1
0
        public string LookupISN(string isn)
        {
            byte[] bytes;
            string text4;
            string plainText  = "isn=" + isn;
            string text2      = ReplayHelper.ByteArrayToHexString(ReplayCrypt.RDDNSEncrypt(plainText)).ToLower();
            string requestUri = string.Format("http://{0}/rd/servlet/gu?q={1}", this.rddnsServer, text2);

            ZoggrLogger.DebugLog("requestUri: " + requestUri);
            try
            {
                bytes = ReplayCrypt.RDDNSDecrypt(HTTPClient.Get(requestUri));
                text4 = Encoding.Default.GetString(bytes);
            }
            catch
            {
                Console.WriteLine("RDDNS Lookup Failed");
                return(null);
            }
            if (text4.IndexOf("ReplayError") >= 0)
            {
                char[]   separator = new char[] { ' ' };
                string[] textArray = text4.Split(separator);
                char[]   trimChars = new char[] { '"' };
                string   text5     = textArray[2].Substring(5).Trim(trimChars);
                char[]   chArray3  = new char[] { '"' };
                string   text6     = textArray[3].Substring(3).Trim(chArray3);
                if (!text5.Equals("SERVER") || !text6.Equals("-1"))
                {
                    return(text4);
                }
                text2      = ReplayHelper.ByteArrayToHexString(ReplayCrypt.RDDNSEncrypt(plainText)).ToLower();
                requestUri = string.Format("http://{0}/rd/servlet/gu?q={1}", this.rddnsServer, text2);
                ZoggrLogger.DebugLog("requestUri: " + requestUri);
                try
                {
                    bytes = ReplayCrypt.RDDNSDecrypt(HTTPClient.Get(requestUri));
                    text4 = Encoding.Default.GetString(bytes);
                }
                catch
                {
                    Console.WriteLine("RDDNS Lookup Failed");
                    return(null);
                }
            }
            return(text4);
        }