Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            //正式用
            userIP = GetWebClientIp(context);
            context.Response.ContentType = "text/plain";
            string result = string.Empty;

            if (!string.IsNullOrEmpty(context.Request["url"]) && !string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
            {
                string userKey = context.Request["key"]; //key ,md5值
                wxCheckApiKey = ConfigTool.ReadVerifyConfig("wxCheckApiKey", "WeiXin");
                if (userKey.Trim() == wxCheckApiKey)
                {
                    context.Response.Write("参数错误,进qq群交流:41977413!");
                }
                else
                {
                    //需要检测的网址
                    string urlCheck = context.Request["url"]; //检测的值
                    urlCheck = urlCheck.Replace("https://", "").Replace("http://", "");
                    string json2 = "{\"Mode\":\"AuthKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";

                    ServiceApiClient SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi2");
                    SpVoiceObj2.Open();
                    result = SpVoiceObj2.Api(json2);
                    SpVoiceObj2.Close();
                    JsonObject.Results aup = JsonConvert.DeserializeObject <JsonObject.Results>(result);

                    if (aup.State == true)
                    {
                        string           json       = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";
                        ServiceApiClient SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                        SpVoiceObj.Open();
                        result = SpVoiceObj.Api(json);
                        SpVoiceObj.Close();
                    }

                    Logger.WriteLoggger(userIP + ":" + userKey + ":" + result);

                    if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
                    {
                        string callBack = context.Request.QueryString["callback"].ToString(); //回调
                        result = callBack + "(" + result + ")";
                    }

                    context.Response.Write(result);
                }
            }
            else
            {
                context.Response.Write("参数错误,进qq群交流:41977413!");
            }

            context.Response.End();
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            //正式用
            userIP = GetWebClientIp();
            context.Response.ContentType = "text/plain";

            if (!string.IsNullOrEmpty(context.Request["url"]) && !string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
            {
                string userKey = context.Request["key"]; //key ,md5值

                if (userKey.Trim() == "341e0b5df120394ec99e517b67774399")
                {
                    context.Response.Write("参数错误,进qq群交流:41977413!");
                }
                else
                {
                    //需要检测的网址
                    string urlCheck = context.Request["url"]; //检测的值
                    urlCheck = urlCheck.Replace("https://", "").Replace("http://", "");
                    string json = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";

                    ServiceApiClient SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                    SpVoiceObj.Open();
                    string result = SpVoiceObj.Api(json);
                    SpVoiceObj.Close();
                    Logger.WriteLoggger(userIP + ":" + userKey + ":" + result);

                    if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
                    {
                        string callBack = context.Request.QueryString["callback"].ToString(); //回调
                        result = callBack + "(" + result + ")";
                    }

                    context.Response.Write(result);
                }
            }
            else
            {
                context.Response.Write("参数错误,进qq群交流:41977413!");
            }

            context.Response.End();
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(GET))
            {
                userIP = GetWebClientIp(context);
                context.Response.ContentType = "text/plain";
                TimeSpan dspNow = DateTime.Now.TimeOfDay;

                string urlCheck = string.Empty;
                string callBack = string.Empty;
                if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
                {
                    callBack = string.IsNullOrEmpty(context.Request.QueryString["callback"]) ? "" : context.Request.QueryString["callback"].ToString(); //回调
                    if (!string.IsNullOrEmpty(context.Request["url"]))
                    {
                        //需要检测的网址
                        urlCheck = context.Request["url"]; //检测的值
                        string[] sArray = urlCheck.Split('.');
                        if (sArray.Length == 3 && sArray[1].Length == 15)
                        {
                            result = "{\"State\":false,\"Code\":\"002\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"歇一歇,访问太快了,联系管理员qq:391502069\"}";
                        }
                        else
                        {
                            if (!IsRedis(context))
                            {
                                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"当天请求上限,请明天再试,需要讨论技术,联系管理员qq:391502069!\"}";
                            }
                            else
                            {
                                ServiceApiClient SpVoiceObj2 = null;
                                //    ServiceApiClient SpVoiceObj = null;
                                try
                                {
                                    bool isTrue = urlCheck.StartsWith("http");
                                    if (!isTrue)
                                    {
                                        urlCheck = "http://" + urlCheck;
                                    }
                                    urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                                    string json2 = "{\"Mode\":\"AuthKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\'}\"}";

                                    SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                    SpVoiceObj2.Open();
                                    result = SpVoiceObj2.Api(json2);
                                    SpVoiceObj2.Close();

                                    Logger.WriteLogggerTest("#################################################");
                                    Logger.WriteLogggerTest(userIP + ":" + result);
                                    Logger.WriteLogggerTest(context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                                }
                                catch (System.ServiceModel.CommunicationException)
                                {
                                    //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                                    if (SpVoiceObj2 != null)
                                    {
                                        SpVoiceObj2.Abort();
                                    }
                                }
                                catch (TimeoutException)
                                {
                                    //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                    if (SpVoiceObj2 != null)
                                    {
                                        SpVoiceObj2.Abort();
                                    }
                                }
                                catch (Exception ex)
                                {
                                    //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                    if (SpVoiceObj2 != null)
                                    {
                                        SpVoiceObj2.Abort();
                                    }
                                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                                    LogTools.WriteLine(userIP + ":" + ex.Message);
                                }
                            }
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员qq:391502069.\"}";
                }
                if (!string.IsNullOrEmpty(callBack))
                {
                    result = callBack + "(" + result + ")";
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"QQ:391502069 \",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(GET))
            {
                string urlCheck = string.Empty;
                context.Response.ContentType = "text/plain";

                if (!string.IsNullOrEmpty(context.Request["url"]) && !string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                {
                    string userKey = context.Request["key"]; //key ,md5值

                    if (userKey.Trim() == wxCheckApiKey)
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
                    }
                    else
                    {
                        if (!IsRedis(context, userKey))
                        {
                            result = "{\"State\":false,\"Code\":\"001\",\"Data\":\"" + userKey + "\",\"Msg\":\"非法访问2,访问被拒绝,联系管理员qq:391502069!\"}";
                        }
                        else
                        {
                            ServiceApiClient SpVoiceObj2 = null;
                            //  ServiceApiClient SpVoiceObj = null;
                            try
                            {
                                //需要检测的网址
                                urlCheck = context.Request["url"]; //检测的值
                                bool isTrue = urlCheck.StartsWith("http");
                                if (!isTrue)
                                {
                                    urlCheck = "http://" + urlCheck;
                                }
                                urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                                string json2 = "{\"Mode\":\"AuthQQGJICPKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";

                                SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                SpVoiceObj2.Open();
                                result = SpVoiceObj2.Api(json2);
                                SpVoiceObj2.Close();


                                if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
                                {
                                    string callBack = context.Request.QueryString["callback"].ToString(); //回调
                                    result = callBack + "(" + result + ")";
                                }
                            }
                            catch (System.ServiceModel.CommunicationException)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (TimeoutException)
                            {
                                // if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (Exception ex)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                                //正式用
                                userIP = GetWebClientIp(context);
                                LogTools.WriteLine(userIP + ":" + userKey + ":" + ex.Message);
                            }
                        }
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"QQ:391502069 \",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(POST))
            {
                //PostHtml();

                userIP = GetWebClientIp(context);
                context.Response.ContentType = "text/plain";
                TimeSpan dspNow = DateTime.Now.TimeOfDay;

                string urlCheck = context.Request["url"];

                string model = context.Request["model"];
                if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
                {
                    // string referrer = context.Request.UrlReferrer != null ? context.Request.UrlReferrer.Host.ToLower() : "";

                    if (!string.IsNullOrEmpty(urlCheck) && !string.IsNullOrEmpty(model))
                    {
                        if (!IsRedis(context))
                        {
                            result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"当天请求上限,请明天再试,需要讨论技术,联系管理员qq:391502069!\"}";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                            {
                                wxKey = context.Request["key"]; //key ,md5值
                            }


                            ServiceApiClient SpVoiceObj2 = null;
                            //    ServiceApiClient SpVoiceObj = null;
                            try
                            {
                                //需要检测的网址
                                bool isTrue = urlCheck.StartsWith("http");
                                if (!isTrue)
                                {
                                    urlCheck = "http://" + urlCheck;
                                }
                                urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                                string json2 = "{\"Mode\":\"" + model + "\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxKey + "\'}\"}";

                                SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                SpVoiceObj2.Open();
                                result = SpVoiceObj2.Api(json2);
                                SpVoiceObj2.Close();


                                Logger.WriteLogggerTest("#################################################");
                                Logger.WriteLogggerTest(wxKey + ":" + userIP + ":" + result);
                                Logger.WriteLogggerTest(wxKey + ":" + context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                            }
                            catch (System.ServiceModel.CommunicationException)
                            {
                                //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (TimeoutException)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (Exception ex)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                                LogTools.WriteLine(userIP + ":" + wxKey + ":" + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员qq:391502069.\"}";
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"QQ:391502069 \",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
            }
            context.Response.Headers.Add("Access-Control-Allow-Origin", "http://www.rrbay.xyz");
            context.Response.Headers.Add("Access-Control-Allow-Methods", "POST");
            context.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(GET))
            {
                //PostHtml();
                //lppsd.zq6kcwhbpvg2twb.com
                //vftkt.n06th8owuihzhhs.com
                context.Response.Headers.Add("Access-Control-Allow-Origin", "http://wx.rrbay.com");
                context.Response.Headers.Add("Access-Control-Allow-Methods", "GET");

                userIP = GetWebClientIp(context);
                context.Response.ContentType = "text/plain";
                TimeSpan dspNow = DateTime.Now.TimeOfDay;

                string urlCheck = string.Empty;
                string callBack = string.Empty;
                if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
                {
                    string referrer = context.Request.UrlReferrer != null?context.Request.UrlReferrer.Host.ToLower() : "";

                    callBack = string.IsNullOrEmpty(context.Request.QueryString["callback"]) ? "" : context.Request.QueryString["callback"].ToString(); //回调
                    if (!string.IsNullOrEmpty(context.Request["url"]) && string.IsNullOrEmpty(callBack) && (string.IsNullOrEmpty(referrer) || referrer.ToLower().Contains("v2ex.com") || referrer.ToLower().Contains("hexun.com") || referrer.ToLower().Contains("cnblogs.com") || referrer.ToLower().Contains("zhihu.com") || referrer.ToLower().Contains("csdn.net") || referrer.ToLower().Contains("rrbay.xyz")))
                    {
                        //需要检测的网址
                        urlCheck = context.Request["url"]; //检测的值
                        string[] sArray = urlCheck.Split('.');
                        if (sArray.Length == 3 && sArray[1].Length == 15)
                        {
                            result = "{\"State\":false,\"Code\":\"002\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"歇一歇,访问太快了,联系管理员qq:391502069\"}";
                        }
                        else
                        {
                            if (!IsRedis(context))
                            {
                                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"当天请求上限,请明天再试,需要讨论技术,联系管理员qq:391502069!\"}";
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                                {
                                    wxCheckApiKey = context.Request["key"]; //key ,md5值
                                }

                                ServiceApiClient SpVoiceObj2 = null;
                                //    ServiceApiClient SpVoiceObj = null;
                                try
                                {
                                    bool isTrue = urlCheck.StartsWith("http");
                                    if (!isTrue)
                                    {
                                        urlCheck = "http://" + urlCheck;
                                    }
                                    urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                                    string json2 = "{\"Mode\":\"AuthQQKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\'}\"}";

                                    SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                    SpVoiceObj2.Open();
                                    result = SpVoiceObj2.Api(json2);
                                    SpVoiceObj2.Close();
                                    //JsonObject.Results aup = JsonConvert.DeserializeObject<JsonObject.Results>(result);

                                    //if (aup.State == true)
                                    //{
                                    //    string json = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\'}\"}";
                                    //    SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                    //    SpVoiceObj.Open();
                                    //    result = SpVoiceObj.Api(json);
                                    //    SpVoiceObj.Close();

                                    //}
                                    Logger.WriteLogggerTest("#################################################");
                                    Logger.WriteLogggerTest(userIP + ":" + wxCheckApiKey + ":" + result);

                                    Logger.WriteLogggerTest(urlCheck + ":HTTP_CDN_SRC_IP--" + context.Request.ServerVariables["HTTP_CDN_SRC_IP"]);
                                    Logger.WriteLogggerTest(urlCheck + ":HTTP_Cdn-Src-Ip--" + context.Request.ServerVariables["HTTP_Cdn-Src-Ip"]);
                                    Logger.WriteLogggerTest(urlCheck + ":Cdn-Src-Ip--" + context.Request.ServerVariables["Cdn-Src-Ip"]);
                                    Logger.WriteLogggerTest(urlCheck + ":HTTP_X_FORWARDED_FOR--" + context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                                    Logger.WriteLogggerTest(urlCheck + ":Proxy-Client-IP--" + context.Request.ServerVariables["Proxy-Client-IP"]);
                                    Logger.WriteLogggerTest(urlCheck + ":WL-Proxy-Client-IP--" + context.Request.ServerVariables["WL-Proxy-Client-IP"]);
                                    Logger.WriteLogggerTest(urlCheck + ":HTTP_CLIENT_IP--" + context.Request.ServerVariables["HTTP_CLIENT_IP"]);
                                    Logger.WriteLogggerTest(urlCheck + ":HTTP_VIA--" + context.Request.ServerVariables["HTTP_VIA"]);
                                    Logger.WriteLogggerTest(urlCheck + ":REMOTE_ADDR--" + context.Request.ServerVariables["REMOTE_ADDR"]);

                                    Logger.WriteLogggerTest("==================================================");
                                }
                                catch (System.ServiceModel.CommunicationException)
                                {
                                    //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                                    if (SpVoiceObj2 != null)
                                    {
                                        SpVoiceObj2.Abort();
                                    }
                                }
                                catch (TimeoutException)
                                {
                                    //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                    if (SpVoiceObj2 != null)
                                    {
                                        SpVoiceObj2.Abort();
                                    }
                                }
                                catch (Exception ex)
                                {
                                    //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                    if (SpVoiceObj2 != null)
                                    {
                                        SpVoiceObj2.Abort();
                                    }
                                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                                    LogTools.WriteLine(userIP + ":" + wxCheckApiKey + ":" + ex.Message);
                                }
                            }
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员qq:391502069.\"}";
                }
                if (!string.IsNullOrEmpty(callBack))
                {
                    result = callBack + "(" + result + ")";
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"QQ:391502069 \",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(GET))
            {
                string url  = context.Request["url"];
                string key  = context.Request["key"];  //key ,md5值
                string type = context.Request["type"]; //key ,md5值
                context.Response.ContentType = "text/plain";

                if (!string.IsNullOrEmpty(url) && !string.IsNullOrEmpty(key) && key.Length == 32)
                {
                    if (!IsRedis(context, key))
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + key + "\",\"Msg\":\"当天请求上限,请明天再试,需要讨论技术,联系管理员qq:391502069!\"}";
                    }
                    else
                    {
                        ServiceApiClient SpVoiceObj = null;
                        try
                        {
                            if (!url.Contains("%3a%2f%2f"))
                            {
                                url = System.Web.HttpUtility.UrlEncode(url);
                            }

                            string json2 = "{\"Mode\":\"ShortUrl\",\"Param\":\"{\'CheckUrl\':\'" + url + "\',\'type\':\'" + type + "\',\'UserKey\':\'" + key + "\'}\"}";

                            SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                            SpVoiceObj.Open();
                            result = SpVoiceObj.Api(json2);
                            SpVoiceObj.Close();


                            if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
                            {
                                string callBack = context.Request.QueryString["callback"].ToString(); //回调
                                result = callBack + "(" + result + ")";
                            }
                        }
                        catch (System.ServiceModel.CommunicationException)
                        {
                            if (SpVoiceObj != null)
                            {
                                SpVoiceObj.Abort();
                            }
                        }
                        catch (TimeoutException)
                        {
                            if (SpVoiceObj != null)
                            {
                                SpVoiceObj.Abort();
                            }
                        }
                        catch (Exception ex)
                        {
                            if (SpVoiceObj != null)
                            {
                                SpVoiceObj.Abort();
                            }
                            result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"" + url + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                            LogTools.WriteLine(key + ":" + ex.Message);
                        }
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"" + url + "\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"QQ:391502069 \",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 8
0
        public void ProcessRequest(HttpContext context)
        {
            string result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"QQ:391502069 \",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
            string wxKey  = wxCheckApiKey; //key ,md5值

            if (context.Request.HttpMethod.ToUpper().Equals(POST))
            {
                context.Response.ContentType = "text/plain";
                string urlCheck = context.Request["url"];
                string model    = context.Request["model"];

                if (!string.IsNullOrEmpty(urlCheck) && !string.IsNullOrEmpty(model))
                {
                    if (!string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                    {
                        wxKey = context.Request["key"]; //key ,md5值
                    }
                    if (!wxKey.ToLower().Equals(wxCheckApiKey))
                    {
                        IsFreeKey = 0;
                    }
                    else
                    {
                        IsFreeKey = 1;
                        userIP    = GetWebClientIp(context);
                    }
                    TimeSpan dspNow = DateTime.Now.TimeOfDay;
                    if ((IsFreeKey == 1 && IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM)) || IsFreeKey == 0)
                    {
                        if (!urlCheck.ToLower().Contains(".kuaizhan.com") && !urlCheck.ToLower().Contains(".hatai678.top") && !urlCheck.ToLower().Contains(".jszkgs.top"))
                        {
                            ServiceApiClient SpVoiceObj2 = null;
                            //    ServiceApiClient SpVoiceObj = null;
                            try
                            {
                                //需要检测的网址
                                bool isTrue = urlCheck.StartsWith("http");
                                if (!isTrue)
                                {
                                    urlCheck = "http://" + urlCheck;
                                }
                                urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                                string json2 = "{\"Mode\":\"" + model + "\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxKey + "\',\'UserIP\':\'" + userIP + "\',\'IsFreeKey\':'" + IsFreeKey + "'}\"}";

                                SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                SpVoiceObj2.Open();
                                result = SpVoiceObj2.Api(json2);
                                SpVoiceObj2.Close();

                                Logger.WriteLogggerTest("#################################################");
                                Logger.WriteLogggerTest(wxKey + ":" + userIP + ":" + result);
                                Logger.WriteLogggerTest(wxKey + ":" + context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                            }
                            catch (System.ServiceModel.CommunicationException)
                            {
                                //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (TimeoutException)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (Exception ex)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                                LogTools.WriteLine(userIP + ":" + wxKey + ":" + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员qq:391502069.\"}";
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
                }
            }
            string allowOrigin = "http://www.rrbay.xyz,http://www.hhgzchina.com,http://www.gqwekk.cn,http://www.qqbf.xyz,http://www.qqbg.xyz,http://www.ggxz.xyz,http://www.rgjxyy.shop,http://www.rgjxyy.fun,http://www.rujcyy.store,http://www.rljdyy.store,http://www.rejayy.store,http://www.rgjxyy.store,http://www.xqjqiao.com,http://www.bbpp.xyz,http://www.bbhh.xyz,http://www.bbqq.xyz,http://www.bbkk.xyz,http://www.bbzz.xyz,http://www.bbtt.xyz";
            string origin      = context.Request.Headers.Get("Origin");

            if (allowOrigin.Contains(origin))
            {
                context.Response.Headers.Add("Access-Control-Allow-Origin", origin);
            }
            else
            {
                context.Response.Headers.Add("Access-Control-Allow-Origin", "http://www.rrbay.xyz");
            }
            context.Response.Headers.Add("Access-Control-Allow-Methods", "POST");
            context.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
            context.Response.Write(result);
            context.Response.End();
        }
        public void ProcessRequest(HttpContext context)
        {
            //PostHtml();
            context.Response.Headers.Add("Access-Control-Allow-Origin", "http://wx.rrbay.com");
            context.Response.Headers.Add("Access-Control-Allow-Methods", "GET");

            userIP = GetWebClientIp(context);
            context.Response.ContentType = "text/plain";
            TimeSpan dspNow   = DateTime.Now.TimeOfDay;
            string   result   = string.Empty;
            string   urlCheck = string.Empty;

            if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
            {
                if (!string.IsNullOrEmpty(context.Request["url"]))
                {
                    if (!IsRedis(context))
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"当天请求上限,请明天再试,需要讨论技术,进群交流 QQ群:41977413!\"}";
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                        {
                            wxCheckApiKey = context.Request["key"]; //key ,md5值
                        }

                        ServiceApiClient SpVoiceObj2 = null;
                        //    ServiceApiClient SpVoiceObj = null;
                        try
                        {
                            //需要检测的网址
                            urlCheck = context.Request["url"]; //检测的值
                            bool isTrue = urlCheck.StartsWith("http");
                            if (!isTrue)
                            {
                                urlCheck = "http://" + urlCheck;
                            }
                            urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                            string json2 = "{\"Mode\":\"AuthKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\'}\"}";

                            SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                            SpVoiceObj2.Open();
                            result = SpVoiceObj2.Api(json2);
                            SpVoiceObj2.Close();
                            //JsonObject.Results aup = JsonConvert.DeserializeObject<JsonObject.Results>(result);

                            //if (aup.State == true)
                            //{
                            //    string json = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\'}\"}";
                            //    SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                            //    SpVoiceObj.Open();
                            //    result = SpVoiceObj.Api(json);
                            //    SpVoiceObj.Close();

                            //}
                            Logger.WriteLogggerTest("#################################################");
                            Logger.WriteLogggerTest(userIP + ":" + wxCheckApiKey + ":" + result);

                            Logger.WriteLogggerTest(urlCheck + ":HTTP_CDN_SRC_IP--" + context.Request.ServerVariables["HTTP_CDN_SRC_IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_Cdn-Src-Ip--" + context.Request.ServerVariables["HTTP_Cdn-Src-Ip"]);
                            Logger.WriteLogggerTest(urlCheck + ":Cdn-Src-Ip--" + context.Request.ServerVariables["Cdn-Src-Ip"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_X_FORWARDED_FOR--" + context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                            Logger.WriteLogggerTest(urlCheck + ":Proxy-Client-IP--" + context.Request.ServerVariables["Proxy-Client-IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":WL-Proxy-Client-IP--" + context.Request.ServerVariables["WL-Proxy-Client-IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_CLIENT_IP--" + context.Request.ServerVariables["HTTP_CLIENT_IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_VIA--" + context.Request.ServerVariables["HTTP_VIA"]);
                            Logger.WriteLogggerTest(urlCheck + ":REMOTE_ADDR--" + context.Request.ServerVariables["REMOTE_ADDR"]);

                            Logger.WriteLogggerTest("==================================================");
                        }
                        catch (System.ServiceModel.CommunicationException)
                        {
                            //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                            if (SpVoiceObj2 != null)
                            {
                                SpVoiceObj2.Abort();
                            }
                        }
                        catch (TimeoutException)
                        {
                            //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                            if (SpVoiceObj2 != null)
                            {
                                SpVoiceObj2.Abort();
                            }
                        }
                        catch (Exception ex)
                        {
                            //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                            if (SpVoiceObj2 != null)
                            {
                                SpVoiceObj2.Abort();
                            }
                            result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                            LogTools.WriteLine(userIP + ":" + wxCheckApiKey + ":" + ex.Message);
                        }
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,进qq群交流:41977413!\"}";
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,进群交流 QQ群:41977413.\"}";
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
            {
                string callBack = context.Request.QueryString["callback"].ToString(); //回调

                result = callBack + "(" + result + ")";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 10
0
        public void ProcessRequest(HttpContext context)
        {
            //正式用
            userIP = GetWebClientIp(context);
            string urlCheck = string.Empty;

            context.Response.ContentType = "text/plain";
            string result = string.Empty;

            if (!string.IsNullOrEmpty(context.Request["url"]) && !string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
            {
                string userKey = context.Request["key"]; //key ,md5值

                if (userKey.Trim() == wxCheckApiKey)
                {
                    context.Response.Write("参数错误,进qq群交流:41977413!");
                }
                else
                {
                    try
                    {
                        //需要检测的网址
                        urlCheck = context.Request["url"]; //检测的值
                        bool isTrue = urlCheck.StartsWith("http");
                        if (!isTrue)
                        {
                            urlCheck = "http://" + urlCheck;
                        }
                        urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);

                        string json2 = "{\"Mode\":\"AuthKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";

                        ServiceApiClient SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi2");
                        SpVoiceObj2.Open();
                        result = SpVoiceObj2.Api(json2);
                        SpVoiceObj2.Close();
                        JsonObject.Results aup = JsonConvert.DeserializeObject <JsonObject.Results>(result);

                        if (aup.State == true)
                        {
                            string           json       = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";
                            ServiceApiClient SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                            SpVoiceObj.Open();
                            result = SpVoiceObj.Api(json);
                            SpVoiceObj.Close();
                        }



                        if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
                        {
                            string callBack = context.Request.QueryString["callback"].ToString(); //回调
                            result = callBack + "(" + result + ")";
                        }
                    }
                    catch (Exception ex)
                    {
                        result = "{\"State\":false,\"Data\":\"" + urlCheck + "\",\"Msg\":\"某服务暂停,请联系管理员!\"}";
                        LogTools.WriteLine(userIP + ":" + userKey + ":" + ex.Message);
                    }
                    context.Response.Write(result);
                    LogTools.WriteLine(userIP + ":" + userKey + ":" + result);
                }
            }
            else
            {
                context.Response.Write("参数错误,进qq群交流:41977413!");
            }

            context.Response.End();
        }
Exemplo n.º 11
0
        public void ProcessRequest(HttpContext context)
        {
            string result = "{\"State\":false,\"Code\":\"003\",\"Data\":\" \",\"Msg\":\"参数错误,联系管理员!\"}";
            string wxKey  = wxCheckApiKey; //key ,md5值

            string allowOrigin = "https://www.rrbay.com,http://www.wxcheckurl.com,https://qqwebchat.gitee.io";
            string origin      = context.Request.Headers.Get("Origin");
            string referer     = context.Request.Headers.Get("Referer");

            if (origin != null && referer != null && (allowOrigin.Contains(origin) || origin.Contains("http://localhost:")) && referer.Length > origin.Length && context.Request.HttpMethod.ToUpper().Equals(POST))
            {
                context.Response.ContentType = "text/plain";
                string urlCheck = context.Request["url"];
                string model    = context.Request["model"];

                if (!string.IsNullOrEmpty(urlCheck) && !string.IsNullOrEmpty(model))
                {
                    if (!string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                    {
                        wxKey = context.Request["key"]; //key ,md5值
                    }
                    if (!wxKey.ToLower().Equals(wxCheckApiKey))
                    {
                        IsFreeKey = 0;
                    }
                    else
                    {
                        IsFreeKey = 1;
                        userIP    = GetWebClientIp(context);
                    }
                    TimeSpan dspNow = DateTime.Now.TimeOfDay;
                    if ((IsFreeKey == 1 && IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM)) || IsFreeKey == 0)
                    {
                        if (!urlCheck.ToLower().Contains(".kuaizhan.com") && !urlCheck.ToLower().Contains(".luckhl8.com") && !urlCheck.ToLower().Contains(".kennethhwong.cn") && !urlCheck.ToLower().Contains(".hatai678.top") && !urlCheck.ToLower().Contains(".jszkgs.top"))
                        {
                            ServiceApiClient SpVoiceObj2 = null;
                            //    ServiceApiClient SpVoiceObj = null;
                            try
                            {
                                //需要检测的网址
                                bool isTrue = urlCheck.StartsWith("http");
                                if (!isTrue)
                                {
                                    urlCheck = "http://" + urlCheck;
                                }
                                if (urlCheck.StartsWith("http://") || urlCheck.StartsWith("https://"))
                                {
                                    urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);
                                }

                                string json2 = "{\"Mode\":\"" + model + "\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxKey + "\',\'UserIP\':\'" + userIP + "\',\'IsFreeKey\':'" + IsFreeKey + "'}\"}";

                                SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                SpVoiceObj2.Open();
                                result = SpVoiceObj2.Api(json2);
                                SpVoiceObj2.Close();

                                Logger.WriteLogggerTest("#################################################");
                                Logger.WriteLogggerTest(wxKey + ":" + userIP + ":" + result);
                                Logger.WriteLogggerTest(wxKey + ":" + context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                            }
                            catch (System.ServiceModel.CommunicationException)
                            {
                                //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (TimeoutException)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (Exception ex)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                                LogTools.WriteLine(userIP + ":" + wxKey + ":" + ex.Message);
                            }
                        }
                        else
                        {
                            result = "{\"State\":false,\"Code\":\"002\",\"Data\":\"" + urlCheck + " \",\"Msg\":\"歇一歇,访问太快了,联系管理员!\"}";
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员.\"}";
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,联系管理员!\"}";
                }
            }

            if (origin != null && (allowOrigin.Contains(origin) || origin.Contains("http://localhost:")))
            {
                context.Response.Headers.Add("Access-Control-Allow-Origin", origin);
            }
            else
            {
                context.Response.Headers.Add("Access-Control-Allow-Origin", "https://www.rrbay.com");
            }
            context.Response.Headers.Add("Access-Control-Allow-Methods", "POST");
            context.Response.Headers.Add("Access-Control-Allow-Credentials", "true");
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 12
0
        public void ProcessRequest(HttpContext context)
        {
            userIP = GetWebClientIp(context);
            context.Response.ContentType = "text/plain";
            TimeSpan dspNow = DateTime.Now.TimeOfDay;
            string   result = string.Empty;

            //   if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
            //   {
            if (!IsValid(context))
            {
                result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"当天请求上限,请明天再试,需要讨论技术,进群交流 QQ群:316344705!\"}";
            }
            else
            {
                if (!string.IsNullOrEmpty(context.Request["url"]))
                {
                    if (!string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                    {
                        userKey = context.Request["key"]; //key ,md5值
                    }

                    //需要检测的网址
                    string urlCheck = context.Request["url"]; //检测的值
                    urlCheck = urlCheck.Replace("https://", "").Replace("http://", "");
                    string json = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";

                    ServiceApiClient SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                    SpVoiceObj.Open();
                    result = SpVoiceObj.Api(json);
                    SpVoiceObj.Close();

                    /*
                     * Logger.WriteLoggger(urlCheck + ":HTTP_CDN_SRC_IP--" + context.Request.ServerVariables["HTTP_CDN_SRC_IP"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":HTTP_Cdn-Src-Ip--" + context.Request.ServerVariables["HTTP_Cdn-Src-Ip"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":Cdn-Src-Ip--" + context.Request.ServerVariables["Cdn-Src-Ip"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":HTTP_X_FORWARDED_FOR--" + context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":Proxy-Client-IP--" + context.Request.ServerVariables["Proxy-Client-IP"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":WL-Proxy-Client-IP--" + context.Request.ServerVariables["WL-Proxy-Client-IP"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":HTTP_CLIENT_IP--" + context.Request.ServerVariables["HTTP_CLIENT_IP"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":HTTP_VIA--" + context.Request.ServerVariables["HTTP_VIA"] + ":" + result);
                     * Logger.WriteLoggger(urlCheck + ":REMOTE_ADDR--" + context.Request.ServerVariables["REMOTE_ADDR"] + ":" + result);
                     * Logger.WriteLoggger("==================================================");
                     */
                    Logger.WriteLoggger(userIP + ":" + userKey + ":" + result);
                }
                else
                {
                    result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,进qq群交流:316344705!\"}";
                }
            }

            /*   }
             * else
             * {
             *     context.Response.Write(userIP + ":测试接口,请在每天(09:00-17:00)时间段进行测试,需要讨论技术,进群交流 QQ群:316344705");
             *
             * } */
            if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
            {
                string callBack = context.Request.QueryString["callback"].ToString(); //回调

                result = callBack + "(" + result + ")";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 13
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(GET))
            {
                userIP = LogTools.GetWebClientIp(context);
                context.Response.ContentType = "text/plain";
                TimeSpan dspNow = DateTime.Now.TimeOfDay;

                string urlCheck = "{\"State\":false,\"Code\":\"003\",\"Data\":\" \",\"Msg\":\"参数错误,联系管理员!\"}";

                if (LogTools.IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
                {
                    if (!string.IsNullOrEmpty(context.Request["url"]))
                    {
                        //需要检测的网址
                        urlCheck = context.Request["url"]; //检测的值

                        if (!urlCheck.ToLower().Contains(".kuaizhan.com") && !urlCheck.ToLower().Contains(".luckhl8.com") && !urlCheck.ToLower().Contains(".kennethhwong.cn") && !urlCheck.ToLower().Contains(".hatai678.top") && !urlCheck.ToLower().Contains(".jszkgs.top"))
                        {
                            ServiceApiClient SpVoiceObj2 = null;
                            //    ServiceApiClient SpVoiceObj = null;
                            try
                            {
                                bool isTrue = urlCheck.StartsWith("http");
                                if (!isTrue)
                                {
                                    urlCheck = "http://" + urlCheck;
                                }
                                if (urlCheck.StartsWith("http://") || urlCheck.StartsWith("https://"))
                                {
                                    urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);
                                }

                                string json2 = "{\"Mode\":\"AuthDouYinKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\',\'UserIP\':\'" + userIP + "\',\'IsFreeKey\':1}\"}";

                                SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                SpVoiceObj2.Open();
                                result = SpVoiceObj2.Api(json2);
                                SpVoiceObj2.Close();
                            }
                            catch (System.ServiceModel.CommunicationException)
                            {
                                //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (TimeoutException)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                            }
                            catch (Exception ex)
                            {
                                //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                                if (SpVoiceObj2 != null)
                                {
                                    SpVoiceObj2.Abort();
                                }
                                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                                LogTools.WriteLine(userIP + ":" + ex.Message);
                            }
                        }
                        else
                        {
                            result = "{\"State\":false,\"Code\":\"002\",\"Data\":\"" + urlCheck + " \",\"Msg\":\"歇一歇,访问太快了,联系管理员!\"}";
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,联系管理员!\"}";
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员.\"}";
                }
            }

            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 14
0
        public void ProcessRequest(HttpContext context)
        {
            //PostHtml();
            userIP = GetWebClientIp(context);
            context.Response.ContentType = "text/plain";
            TimeSpan dspNow   = DateTime.Now.TimeOfDay;
            string   result   = string.Empty;
            string   urlCheck = string.Empty;

            if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
            {
                if (!IsValid(context))
                {
                    result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"当天请求上限,请明天再试,需要讨论技术,进群交流 QQ群:41977413!\"}";
                }
                else
                {
                    if (!string.IsNullOrEmpty(context.Request["url"]))
                    {
                        if (!string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
                        {
                            wxCheckApiKey = context.Request["key"]; //key ,md5值
                        }


                        try
                        {
                            //需要检测的网址
                            urlCheck = context.Request["url"]; //检测的值
                            urlCheck = urlCheck.Replace("https://", "").Replace("http://", "");
                            string json2 = "{\"Mode\":\"AuthKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\'}\"}";

                            ServiceApiClient SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi2");
                            SpVoiceObj2.Open();
                            result = SpVoiceObj2.Api(json2);
                            SpVoiceObj2.Close();
                            JsonObject.Results aup = JsonConvert.DeserializeObject <JsonObject.Results>(result);

                            if (aup.State == true)
                            {
                                string           json       = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\'}\"}";
                                ServiceApiClient SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                                SpVoiceObj.Open();
                                result = SpVoiceObj.Api(json);
                                SpVoiceObj.Close();
                            }
                            Logger.WriteLogggerTest("#################################################");
                            Logger.WriteLogggerTest(userIP + ":" + wxCheckApiKey + ":" + result);

                            Logger.WriteLogggerTest(urlCheck + ":HTTP_CDN_SRC_IP--" + context.Request.ServerVariables["HTTP_CDN_SRC_IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_Cdn-Src-Ip--" + context.Request.ServerVariables["HTTP_Cdn-Src-Ip"]);
                            Logger.WriteLogggerTest(urlCheck + ":Cdn-Src-Ip--" + context.Request.ServerVariables["Cdn-Src-Ip"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_X_FORWARDED_FOR--" + context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                            Logger.WriteLogggerTest(urlCheck + ":Proxy-Client-IP--" + context.Request.ServerVariables["Proxy-Client-IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":WL-Proxy-Client-IP--" + context.Request.ServerVariables["WL-Proxy-Client-IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_CLIENT_IP--" + context.Request.ServerVariables["HTTP_CLIENT_IP"]);
                            Logger.WriteLogggerTest(urlCheck + ":HTTP_VIA--" + context.Request.ServerVariables["HTTP_VIA"]);
                            Logger.WriteLogggerTest(urlCheck + ":REMOTE_ADDR--" + context.Request.ServerVariables["REMOTE_ADDR"]);

                            Logger.WriteLogggerTest("==================================================");
                        }
                        catch (Exception ex)
                        {
                            result = "{\"State\":false,\"Data\":\"" + urlCheck + "\",\"Msg\":\"某服务暂停,请联系管理员!\"}";
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,进qq群交流:41977413!\"}";
                    }
                }
            }
            else
            {
                result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,进群交流 QQ群:41977413.\"}";
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
            {
                string callBack = context.Request.QueryString["callback"].ToString(); //回调

                result = callBack + "(" + result + ")";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 15
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(POST))
            {
                string url   = context.Request["url"];
                string type  = context.Request["type"];  //key ,md5值
                string model = context.Request["model"]; //a,还原;b.生成
                context.Response.ContentType = "text/plain";
                TimeSpan dspNow = DateTime.Now.TimeOfDay;

                if (!string.IsNullOrEmpty(model) && model.Equals("b"))
                {  //生成短链接
                    if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM) && !string.IsNullOrEmpty(url))
                    {
                        userIP = GetWebClientIp(context);

                        ServiceApiClient SpVoiceObj = null;
                        try
                        {
                            if (type.ToUpper() != "URLCN" && type.ToUpper() != "WURLCN" && type.ToUpper() != "TCN")
                            {
                                type = "URLCN";
                            }
                            if (url.StartsWith("http://") || url.StartsWith("https://"))
                            {
                                url = System.Web.HttpUtility.UrlEncode(url);
                            }

                            string json2 = "{\"Mode\":\"ShortUrl\",\"Param\":\"{\'CheckUrl\':\'" + url + "\',\'type\':\'" + type + "\',\'UserKey\':\'" + shorturlkey + "\',\'UserIP\':\'" + userIP + "\',\'IsFreeKey\':1}\"}";

                            SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                            SpVoiceObj.Open();
                            result = SpVoiceObj.Api(json2);
                            SpVoiceObj.Close();


                            if (!string.IsNullOrEmpty(context.Request.QueryString["callback"]))
                            {
                                string callBack = context.Request.QueryString["callback"].ToString(); //回调
                                result = callBack + "(" + result + ")";
                            }
                        }
                        catch (System.ServiceModel.CommunicationException)
                        {
                            if (SpVoiceObj != null)
                            {
                                SpVoiceObj.Abort();
                            }
                        }
                        catch (TimeoutException)
                        {
                            if (SpVoiceObj != null)
                            {
                                SpVoiceObj.Abort();
                            }
                        }
                        catch (Exception ex)
                        {
                            if (SpVoiceObj != null)
                            {
                                SpVoiceObj.Abort();
                            }
                            result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"https://url.cn/5mfnDv7\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                            LogTools.WriteLine(shorturlkey + ":" + ex.Message);
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"https://url.cn/5mfnDv7\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员qq:391502069.\"}";
                    }
                }
                else
                { //短链接还原
                    result = HttpHelper.GetLocation(url);
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"https://url.cn/5mfnDv7\",\"Msg\":\"参数错误,联系管理员qq:391502069!\"}";
            }
            context.Response.Headers.Add("Access-Control-Allow-Origin", "https://www.rrbay.com");
            context.Response.Headers.Add("Access-Control-Allow-Methods", "POST");
            context.Response.Headers.Add("Access-Control-Allow-Credentials", "true");

            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 16
0
        public void ProcessRequest(HttpContext context)
        {
            string result = string.Empty;

            if (context.Request.HttpMethod.ToUpper().Equals(GET))
            {
                userIP = GetWebClientIp(context);
                context.Response.ContentType = "text/plain";
                TimeSpan dspNow = DateTime.Now.TimeOfDay;

                string urlCheck = string.Empty;
                string callBack = string.Empty;
                if (IsInTimeInterval(dspNow, _strWorkingDayAM, _strWorkingDayPM))
                {
                    if (!string.IsNullOrEmpty(context.Request["url"]))
                    {
                        //需要检测的网址
                        urlCheck = context.Request["url"]; //检测的值
                        ServiceApiClient SpVoiceObj2 = null;

                        try
                        {
                            bool isTrue = urlCheck.StartsWith("http");
                            if (!isTrue)
                            {
                                urlCheck = "http://" + urlCheck;
                            }
                            if (urlCheck.StartsWith("http://") || urlCheck.StartsWith("https://"))
                            {
                                urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);
                            }

                            string json2 = "{\"Mode\":\"AuthQQGJICPKey\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + wxCheckApiKey + "\',\'UserIP\':\'" + userIP + "\',\'IsFreeKey\':1}\"}";

                            SpVoiceObj2 = new ServiceApiClient("NetTcpBinding_IServiceApi");
                            SpVoiceObj2.Open();
                            result = SpVoiceObj2.Api(json2);
                            SpVoiceObj2.Close();

                            Logger.WriteLogggerTest("#################################################");
                            Logger.WriteLogggerTest(userIP + ":" + result);
                            Logger.WriteLogggerTest(context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                        }
                        catch (System.ServiceModel.CommunicationException)
                        {
                            //  if (SpVoiceObj != null) SpVoiceObj.Abort();
                            if (SpVoiceObj2 != null)
                            {
                                SpVoiceObj2.Abort();
                            }
                        }
                        catch (TimeoutException)
                        {
                            //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                            if (SpVoiceObj2 != null)
                            {
                                SpVoiceObj2.Abort();
                            }
                        }
                        catch (Exception ex)
                        {
                            //   if (SpVoiceObj != null) SpVoiceObj.Abort();
                            if (SpVoiceObj2 != null)
                            {
                                SpVoiceObj2.Abort();
                            }
                            result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                            LogTools.WriteLine(userIP + ":" + wxCheckApiKey + ":" + ex.Message);
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,联系管理员!\"}";
                    }
                }
                else
                {
                    result = "{\"State\":false,\"Code\":\"003\",\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(08:00-21:00)时间段进行测试,需要讨论技术,联系管理员.\"}";
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\":\"003\",\"Data\":\" \",\"Msg\":\"参数错误,联系管理员!\"}";
            }
            context.Response.Write(result);
            context.Response.End();
        }
Exemplo n.º 17
0
        public void ProcessRequest(HttpContext context)
        {
            string urlCheck = string.Empty;

            context.Response.ContentType = "text/plain";
            string result = string.Empty;

            if (!string.IsNullOrEmpty(context.Request["url"]) && !string.IsNullOrEmpty(context.Request["key"]) && context.Request["key"].Length == 32)
            {
                string           userKey    = context.Request["key"]; //key ,md5值
                ServiceApiClient SpVoiceObj = null;
                try
                {
                    SpVoiceObj = new ServiceApiClient("NetTcpBinding_IServiceApi");
                    //需要检测的网址
                    urlCheck = context.Request["url"]; //检测的值
                    bool isTrue = urlCheck.StartsWith("http");
                    if (!isTrue)
                    {
                        urlCheck = "http://" + urlCheck;
                    }
                    urlCheck = System.Web.HttpUtility.UrlEncode(urlCheck);


                    string json = "{\"Mode\":\"WXCheckUrl\",\"Param\":\"{\'CheckUrl\':\'" + urlCheck + "\',\'UserKey\':\'" + userKey + "\'}\"}";

                    SpVoiceObj.Open();
                    result = SpVoiceObj.Api(json);
                    SpVoiceObj.Close();
                }
                catch (System.ServiceModel.CommunicationException)
                {
                    if (SpVoiceObj != null)
                    {
                        SpVoiceObj.Abort();
                    }
                }
                catch (TimeoutException)
                {
                    if (SpVoiceObj != null)
                    {
                        SpVoiceObj.Abort();
                    }
                }
                catch (Exception ex)
                {
                    if (SpVoiceObj != null)
                    {
                        SpVoiceObj.Abort();
                    }
                    result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"请求操作在配置的超时,请联系管理员!\"}";
                    LogTools.WriteLine(ex.Message);
                }
            }
            else
            {
                result = "{\"State\":false,\"Code\",\"003\",\"Data\":\"" + urlCheck + "\",\"Msg\":\"参数错误,进qq群交流:41977413!\"}";
            }

            context.Response.Write(result);
            context.Response.End();
        }