Esempio n. 1
0
        private string gotoRedirectUrl = ConfigTool.ReadVerifyConfig("DefaultUrl", "JumpDomain");//最终用户访问的网址

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string getJump = QueryString("key");   //参数1:授权key
            string getUrl  = QueryString("qqmap"); //参数1:用户传当前推广的网址,url需要编码

            if (string.IsNullOrEmpty(getJump) || string.IsNullOrEmpty(getUrl))
            {
                context.Response.Redirect(gotoRedirectUrl);
            }
            else
            {
                getJump = getJump + "!" + getUrl;

                string domainLeft = "http://";

                string isHttps = ConfigTool.ReadVerifyConfig("IsSSL", "JumpDomain");//这些域名都需要指向用户最终要访问的站点

                if (isHttps.ToLower() == "true")
                {
                    domainLeft = "https://";
                }

                string domainCenter = GetRandHostUrl();
                gotoRedirectUrl = domainLeft + domainCenter + "/home/GoToNovel";
                // string xxx =PostHtml(gotoRedirectUrl, getJump);

                string html = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "dev/sply.html");
                html = html.Replace("$newsView", gotoRedirectUrl).Replace("$newsValue", getJump);
                //  LogTools.WriteLine(getJump);

                context.Response.Write(html);
            }
            context.Response.End();
        }
Esempio n. 2
0
        private string GetRandHostUrl()
        {
            Random ran     = new Random();
            int    RandKey = ran.Next(4, 9);
            string randUrl = "";

            try
            {
                string   hosturl  = ConfigTool.ReadVerifyConfig("Host", "Other");
                string[] sArray   = hosturl.Split(',');
                Random   ran1     = new Random();
                int      RandKey1 = ran.Next(0, sArray.Length);//随机选中域名


                randUrl = GenerateRandomNumber(RandKey);

                if (string.IsNullOrEmpty(sArray[RandKey1]))
                {
                    randUrl = randUrl + "." + ConfigTool.ReadVerifyConfig("exp", "Other");
                }
                else
                {
                    randUrl = randUrl + "." + sArray[RandKey1] + "";
                }
            }
            catch (Exception ex)
            {
                randUrl = "abc." + ConfigTool.ReadVerifyConfig("exp", "Other");
                //randUrl = ex.Message.ToString();
                return(randUrl);
            }
            return(randUrl);
        }
Esempio n. 3
0
        private void getImg(HttpContext context)
        {
            HttpHelper helper = new HttpHelper();

            string hosturl = ConfigTool.ReadVerifyConfig("qqzoneImg", "Other");//这些域名都需要指向用户最终要访问的站点

            string[] sArray   = hosturl.Split(',');
            Random   ran      = new Random();
            int      RandKey1 = ran.Next(0, sArray.Length);//随机选中action
            string   imgName  = sArray[RandKey1];

            string url = context.Request.Url.Scheme + "://" + context.Request.Url.Authority + "/wechat/" + imgName;

            HttpItem item = new HttpItem()
            {
                URL     = url,
                Referer = "",                                                                                                                                  //必填参数,这里置空

                UserAgent  = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B176 MicroMessenger/4.3.2", //useragent可有可无
                ResultType = ResultType.Byte
            };

            HttpResult res = helper.GetHtml(item);

            string code = "data:image/webp;base64," + Convert.ToBase64String(res.ResultByte);

            context.Response.ContentType = "image/webp";
            context.Response.OutputStream.Write(res.ResultByte, 0, res.ResultByte.Length);
        }
Esempio n. 4
0
        private string gotoRedirectUrl = ConfigTool.ReadVerifyConfig("DefaultUrl", "WapToWeiXin");//最终用户访问的网址

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string getJump = QueryString("jump");//参数1:用户传当前推广的网址

            if (string.IsNullOrEmpty(getJump))
            {
                context.Response.Redirect(gotoRedirectUrl);
            }
            else
            {
                Random ran     = new Random();
                int    RandKey = ran.Next(00, 99);
                getJump = getJump + "!" + RandKey;

                string domainLeft = "https://";
                string isHttps    = ConfigTool.ReadVerifyConfig("IsSSL", "WapToWeiXin");
                if (isHttps.ToLower() == "false")
                {
                    domainLeft = "http://";
                }

                string domainCenter = GetRandHostUrl();
                gotoRedirectUrl = domainLeft + domainCenter + "/home/GoToWX";


                string html = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "dev/sply.html");
                html = html.Replace("$actionUrl", gotoRedirectUrl).Replace("$jumpValue", getJump);


                context.Response.Write(html);
            }
            context.Response.End();
        }
Esempio n. 5
0
        private string GetRandHostUrl()
        {
            Random ran = new Random();

            string randUrl = "";

            bool isBlacklist = true;

            // int xx = 0;//没有做剔除操作,暂时限制循环次数。
            while (isBlacklist)
            {
                try
                {
                    string   hosturl = ConfigTool.ReadVerifyConfig("HostHttp", "HostUrl");//这些域名都需要指向用户最终要访问的站点
                    string[] sArray  = hosturl.Split(',');

                    int RandKey1 = ran.Next(0, sArray.Length);//随机选中域名
                    randUrl = sArray[RandKey1];


                    wxCheckApi    = ConfigTool.ReadVerifyConfig("wxCheckApi", "WeiXin");;
                    wxCheckApiKey = ConfigTool.ReadVerifyConfig("wxCheckApiKey", "WeiXin");

                    WebRequest wr     = (HttpWebRequest)WebRequest.Create(wxCheckApi + "?key=" + wxCheckApiKey + "&url=http://" + randUrl);
                    var        stream = wr.GetResponse().GetResponseStream();
                    var        sr     = new StreamReader(stream, Encoding.GetEncoding("UTF-8"));
                    var        all    = sr.ReadToEnd();
                    sr.Close();
                    stream.Close();
                    //读取网站的数据
                    if (all.Contains("屏蔽"))
                    {
                        //剔除域名
                        if (hosturl.Contains(sArray[RandKey1] + ","))
                        {
                            hosturl = hosturl.Replace(sArray[RandKey1] + ",", "");
                        }
                        if (hosturl.Contains("," + sArray[RandKey1]))
                        {
                            hosturl = hosturl.Replace("," + sArray[RandKey1], "");
                        }
                        ConfigTool.WriteVerifyConfig("Host", hosturl, "HostUrl");//剔除黑名单域名
                    }
                    else
                    {
                        isBlacklist = false;
                        return(randUrl);
                    }
                }
                catch (Exception ex)
                {
                    randUrl = "";
                    //randUrl = ex.Message.ToString();
                    return(randUrl);
                }
            }
            return(randUrl);
        }
Esempio n. 6
0
        private string gotoRedirectUrl = "/404.html";                                                 //最终用户访问的网址

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string jump    = QueryString("jump"); //参数1:用户传当前推广的网址
            string getJump = jump;                //参数1:用户传当前推广的网址

            if (string.IsNullOrEmpty(getJump))
            {
                context.Response.Redirect(gotoRedirectUrl);
            }
            else
            {
                Random ran     = new Random();
                int    RandKey = ran.Next(00, 99);
                getJump = getJump + "!" + RandKey;

                string   hosturl    = ConfigTool.ReadVerifyConfig("ActionName", "WeChatAnti"); //这些域名都需要指向用户最终要访问的站点
                string[] sArray     = hosturl.Split(',');
                int      RandKey1   = ran.Next(0, sArray.Length);                              //随机选中action
                string   actionName = sArray[RandKey1];
                string   domainLeft = "http://";

                string isHttps = ConfigTool.ReadVerifyConfig("IsSSL", "WeChatAnti");//这些域名都需要指向用户最终要访问的站点

                if (isHttps.ToLower() == "true")
                {
                    string agent = context.Request.UserAgent;
                    if (!agent.Contains("Macintosh") && !agent.Contains("iPhone") && !agent.Contains("iPod") && !agent.Contains("iPad") && !agent.Contains("Windows Phone") && !agent.Contains("Windows NT"))
                    {
                        domainLeft = "https://";
                    }
                }

                string domainCenter = GetRandHostUrl();
                if (string.IsNullOrEmpty(domainCenter))
                {
                    context.Response.Redirect(gotoRedirectUrl);
                }
                else
                {
                    gotoRedirectUrl = domainLeft + domainCenter + "/" + actionName;
                    // string xxx =PostHtml(gotoRedirectUrl, getJump);

                    string html = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "dev/sply.html");
                    html = html.Replace("$newsView", gotoRedirectUrl).Replace("$newsValue", getJump);

                    bool check = RedisCacheTools.Exists(jump + "IsTitle");
                    if (check)
                    {
                        html = html.Replace("太阳湾软件", "");
                    }


                    context.Response.Write(html);
                }
            }
            context.Response.End();
        }
Esempio n. 7
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();
        }
Esempio n. 8
0
        private string GetRandHostUrl()
        {
            string randUrl = "";

            //  bool isBlacklist = true;
            //  while (isBlacklist)
            //  {
            try
            {
                string   hosturl  = ConfigTool.ReadVerifyConfig("Domain", "WeChatAnti"); //这些域名都需要指向用户最终要访问的站点
                string[] sArray   = hosturl.Split(',');
                Random   ran      = new Random();
                int      RandKey1 = ran.Next(0, sArray.Length);//随机选中域名
                randUrl = sArray[RandKey1];

                WebRequest wr     = (HttpWebRequest)WebRequest.Create(wxCheckApi + "?key=" + wxCheckApiKey + "&url=http://" + randUrl);
                var        stream = wr.GetResponse().GetResponseStream();
                var        sr     = new StreamReader(stream, Encoding.GetEncoding("UTF-8"));
                var        all    = sr.ReadToEnd();
                sr.Close();
                stream.Close();

                //读取网站的数据
                if (all.Contains("屏蔽"))
                {
                    /*
                     * //剔除域名
                     * if (hosturl.Contains(sArray[RandKey1] + ","))
                     * {
                     *  hosturl = hosturl.Replace(sArray[RandKey1] + ",", "");
                     * }
                     * if (hosturl.Contains("," + sArray[RandKey1]))
                     * {
                     *  hosturl = hosturl.Replace("," + sArray[RandKey1], "");
                     * }
                     * ConfigTool.WriteVerifyConfig("Domain", hosturl, "WeChatAnti");//剔除黑名单域名
                     */
                    randUrl = "";
                }
                else
                {
                    // isBlacklist = false;
                    return(randUrl);
                }
            }
            catch (Exception ex)
            {
                randUrl = "";
                return(randUrl);
            }
            // }

            return(randUrl);
        }
Esempio n. 9
0
        public void ProcessRequest(HttpContext context)
        {
            //GET /index.php?g=Wap&m=Vote&a=index&token=uDSrEHNs9CFGcTSC&wecha_id=ocMqvwRjzPH9eseHRc_Z9nlP-DSM&id=25&iMicms=mp.weixin.qq.com HTTP/1.1
            context.Response.ContentType = "text/plain";
            pToken = QueryString("token");
            pWecha_id = QueryString("wecha_id");
            pId = QueryString("id");
            iMicms = QueryString("iMicms");

            stateUrl = ConfigTool.ReadVerifyConfig("state", "Other");

            if (stateUrl.Equals("true"))
            {
                string tokens = ConfigTool.ReadVerifyConfig("tokens", "Other");
                if (tokens.Contains(pToken))
                {
                    string pRedirectUrl = "http://" + GetRandHostUrl() + "/index.php?g=Wap&m=Vote&a=index&id=" + pId + "&token=" + pToken + "&wecha_id=" + pWecha_id + "&iMicms=" + iMicms;

                    string json = "{\"Mode\": \"WXCheckUrl\", \"Param\": \"{\'CheckUrl\':\'" + pRedirectUrl + "\'}\"}";
                    _service = new ServiceApi();
                    string resultCheck = _service.Api(json);

                    if (!resultCheck.Contains("屏蔽"))
                    {
                        //域名未被微信封号
                        hmdOpenid = ConfigTool.ReadVerifyConfig("hmdOpenid", "Other");
                        if (!hmdOpenid.Contains(pWecha_id))
                        {
                            //当前访问的用户不在黑名单
                            redirectUrl = pRedirectUrl;
                            Logger.WriteLoggger("openid:" + pWecha_id);  //后续可以扩展,可以屏蔽一些恶意投诉的微信号
                        }
                    }
                    else
                    {

                        //修改投票状态
                        ConfigTool.WriteVerifyConfig("state", "false", "Other");
                        Logger.WriteLoggger("恶意的openid:" + pWecha_id);  //后续可以扩展,可以屏蔽一些恶意投诉的微信号
                    }
                }

            }

            context.Response.Redirect(redirectUrl);
            // context.Response.Write(redirectUrl);
            context.Response.End();
        }
Esempio n. 10
0
        private string GetRandHostUrl()
        {
            Random ran = new Random();

            string randUrl = "";

            string hosturl = ConfigTool.ReadVerifyConfig("Domain", "JumpDomain");//这些域名都需要指向用户最终要访问的站点

            string[] sArray = hosturl.Split(',');

            int RandKey1 = ran.Next(0, sArray.Length);//随机选中域名

            randUrl = sArray[RandKey1];

            return(randUrl);
        }
Esempio n. 11
0
        private string gotoRedirectUrl = "http://www.rrbay.com/";//最终用户访问的网址

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string getJump = QueryString("jump");//参数1:用户传当前推广的网址

            if (string.IsNullOrEmpty(getJump))
            {
                context.Response.Redirect(gotoRedirectUrl);
            }
            else
            {
                Random ran     = new Random();
                int    RandKey = ran.Next(00, 99);
                getJump = getJump + "!" + RandKey;

                string domainLeft = "http://";

                string isHttps = ConfigTool.ReadVerifyConfig("IsHttps", "HostUrl");//这些域名都需要指向用户最终要访问的站点

                if (isHttps.ToLower() == "true")
                {
                    string agent = context.Request.UserAgent;
                    if (!agent.Contains("Macintosh") && !agent.Contains("iPhone") && !agent.Contains("iPod") && !agent.Contains("iPad") && !agent.Contains("Windows Phone") && !agent.Contains("Windows NT"))
                    {
                        domainLeft = "https://";
                    }
                }

                string domainCenter = GetRandHostUrl();
                gotoRedirectUrl = domainLeft + domainCenter + "/home/GoToWX";
                // string xxx =PostHtml(gotoRedirectUrl, getJump);

                string html = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "dev/sply.html");
                html = html.Replace("$actionUrl", gotoRedirectUrl).Replace("$jumpValue", getJump);


                context.Response.Write(html);
            }
            context.Response.End();
        }
Esempio n. 12
0
        private string GetRandHostUrl()
        {
            string randUrl = "";

            //  bool isBlacklist = true;
            //  while (isBlacklist)
            //  {
            try
            {
                string   hosturl  = ConfigTool.ReadVerifyConfig("Domain", "WeChatAnti");//这些域名都需要指向用户最终要访问的站点
                string[] sArray   = hosturl.Split(',');
                Random   ran      = new Random();
                int      RandKey1 = ran.Next(0, sArray.Length);//随机选中域名
                randUrl = sArray[RandKey1];

                /*
                 * var all = HttpHelper.GetHtml2(wxCheckApi + "?key=" + wxCheckApiKey + "&url=http://" + randUrl);
                 * //读取网站的数据
                 * if (all.Contains("屏蔽"))
                 * {
                 *
                 *  randUrl = "";
                 * }
                 * else
                 * {
                 * // isBlacklist = false;
                 *  return randUrl;
                 * }
                 *
                 */
            }
            catch (Exception ex)
            {
                randUrl = "";
                return(randUrl);
            }
            // }

            return(randUrl);
        }
Esempio n. 13
0
 public void ProcessRequest(HttpContext context)
 {
     //防止盗链,增加自己服务器压力
     if (context.Request.UrlReferrer != null)
     {
         string refurl  = context.Request.UrlReferrer.Host.ToString();
         string refhost = ConfigTool.ReadVerifyConfig("wxShowImg", "Other");
         if (refurl.Equals(refhost))
         {
             getImg(context);
         }
         else
         {
             context.Response.ContentType = "text/plain";
             context.Response.Write("非法访问!");
         }
     }
     else
     {
         getImg(context);
     }
     context.Response.End();
 }
Esempio n. 14
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群: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值
                        }
                        else
                        {
                            wxCheckApiKey = ConfigTool.ReadVerifyConfig("wxCheckApiKey", "WeiXin");
                        }

                        try
                        {
                            //需要检测的网址
                            string 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.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 + ":" + wxCheckApiKey + ":" + result);
                        }
                        catch (Exception ex)
                        {
                            result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"" + ex.Message + "\"}";
                        }
                    }
                    else
                    {
                        result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"参数错误,进qq群交流:41977413!\"}";
                    }
                }
            }
            else
            {
                result = "{\"State\":false,\"Data\":\"" + userIP + "\",\"Msg\":\"测试接口,请在每天(07:00-23: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();
        }