Exemplo n.º 1
0
        //获取域名是否已经备案
        public static int getDomainISBeiAN(string domain)
        {
            int re = 0;

            if (domain.Contains("http://"))
            {
                domain = new Uri(domain.Trim()).Host.Replace("www.", "");
            }
            else
            {
                domain = domain.Trim().Replace("www.", "");
            }
            int l = domain.Split('.').Length;

            if (l > 2)
            {
                domain = domain.Split('.')[l - 2] + "." + domain.Split('.')[l - 1];
            }
            CookieCollection cookies = new CookieCollection();
            string           html    = new xkHttp().httpGET("http://www.15so.com/baidu/index.html?type=0&kword=" + domain, ref cookies);

            if (html.Contains("查看详细备案信息"))
            {
                re = 1;
            }
            return(re);
        }
Exemplo n.º 2
0
        public static int checkDomain(string domain)
        {
            if (domain.Contains("http://"))
            {
                domain = new Uri(domain.Trim()).Host.Replace("www.", "");
            }
            else
            {
                domain = domain.Trim();
            }
            int re = 0;
            CookieCollection cookies = new CookieCollection();
            string           html    = new xkHttp().httpGET("http://whoissoft.com/" + domain, ref cookies);

            if (html.Contains("No match for domain"))
            {
                re = 1;
            }
            return(re);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="title">文章标题</param>
        /// <param name="turl">文章地址</param>
        /// <param name="siteName">站点名</param>
        /// <param name="taskName">任务名</param>
        /// <param name="siteUrl">站点地址</param>
        public static void upToRenzheBBS(string title, string turl, string siteName, string taskName, string siteUrl)
        {
            if (turl.Contains("127.0.0.1") || turl.Contains("localhost"))
            {
                return;//如果是本机测试用的话,就不要去上传到论坛上了。
            }

            title = string.Format("【{0}-{1}】:{2}", Login_Base.member.group, Login_Base.member.netname, title);
            string content = string.Format("授权会员:{0}\n用户组别:{1}\n当前金币:{7}\n\n网站名称:{2}\n任务名称:{3}\n[hide=99999]网站地址:{4}\n\n文章标题:{5}\n文章地址:{6}[/hide]",
                                           Login_Base.member.netname,
                                           Login_Base.member.group,
                                           siteName,
                                           taskName,
                                           siteUrl,
                                           title,
                                           turl,
                                           Login_Base.member.userMoney.ToString()
                                           );

            if (title.Length > 40)
            {
                title = StringHelper.SubString(title, 0, 38);
            }
            content = content.Replace("&", "-");
            string purl   = "http://www.renzhe.org/forum.php?mod=post&action=newthread&fid=37&extra=&topicsubmit=yes";
            string pdata  = string.Format("formhash={0}&posttime=&wysiwyg=0&subject={1}&checkbox=0&message={2}&replycredit_extcredits=0&replycredit_times=1&replycredit_membertimes=1&replycredit_random=100&readperm=&price=&save=&usesig=1&allownoticeauthor=1", Login_Base.member.formhash, title, content);
            string reffer = "http://www.renzhe.org/forum.php";

            string html = new xkHttp().httpPost(purl, pdata, ref Login_Base.member.cookies, reffer, Encoding.UTF8);

            if (html.Contains("非常感谢,您的主题已发布"))
            {
                Login_Base.member.userMoney--;
                EchoHelper.Echo("上传日志成功!金币-1", "忍者X2日志系统", EchoHelper.EchoType.任务信息);
            }
            else
            {
                FilesHelper.WriteFile(Application.StartupPath + @"\Log\未知标识\【忍者X2日志】发布没有找到标志_" + DateTime.Now.Millisecond.ToString() + ".html", html, Encoding.UTF8);
                EchoHelper.Echo("跳过上传日志:随机抽取未选中。", "忍者X2日志系统", EchoHelper.EchoType.普通信息);
            }
        }
Exemplo n.º 4
0
        public static DateTime getDomainExpired(string domain)
        {
            if (domain.Contains("http://"))
            {
                domain = new Uri(domain.Trim()).Host.Replace("www.", "");
            }
            else
            {
                domain = domain.Trim().Replace("www.", "");
            }
            int l = domain.Split('.').Length;

            if (l > 2)
            {
                domain = domain.Split('.')[l - 2] + "." + domain.Split('.')[l - 1];
            }
            DateTime         re      = DateTime.Now.AddDays(-1);
            CookieCollection cookies = new CookieCollection();
            string           html    = new xkHttp().httpGET("http://tool.chinaz.com/DomainDel/?wd=" + domain, ref cookies);

            //循环5次,去抓取域名信息
            int i = 0;

            while (html.Contains("没有查询到相应的信息."))
            {
                html = new xkHttp().httpGET("http://tool.chinaz.com/DomainDel/?wd=" + domain, ref cookies);
                i++;
                if (i > 10)
                {
                    break;
                }
            }
            if (html.Contains("域名到期时间"))
            {
                string   edate = RegexHelper.getHtmlRegexText(html, "{域名到期时间</td><td class=\"deltd1\">(.*?)</td></tr>}");
                DateTime dt    = new DateTime(Convert.ToInt32(edate.Split('-')[0]), Convert.ToInt32(edate.Split('-')[1]), Convert.ToInt32(edate.Split('-')[2]));
                re = dt;
            }

            return(re);
        }
Exemplo n.º 5
0
        /// <summary>
        ///  站点收录信息
        /// </summary>
        /// <param name="_engine"></param>
        /// <returns></returns>
        public static int getBaiduNum(EnumSearchEngine _engine, string url)
        {
            //EchoHelper.Echo("网站【" + url + "】的收录查询中,请稍后...", "", EchoHelper.EchoType.普通信息);
            string regStart = "找到相关结果数";
            string regEnd   = "个";
            string siteUrl  = "http://www.baidu.com/s?wd=site%3A" + url;

            CookieCollection cookies = new CookieCollection();
            string           html    = new xkHttp().httpGET(siteUrl, ref cookies, siteUrl);
            string           Result  = StringHelper.GetMetaString(html, regStart, regEnd, true);
            int re = 9999;

            try {
                re = Convert.ToInt32(Result);
            } catch {
                re = 0;
            }
            if (html.Contains("没有找到与"))
            {
                re = 0;
            }
            return(re);
        }
Exemplo n.º 6
0
        private bool ValidateUser(ref ModelMember member)
        {
            member.IS_X_PostKing = false;

            //验证是否具有发帖权限
            string testpostUrl = "http://www.renzhe.org/forum.php?mod=post&action=newthread&fid=36";

            string html = new xkHttp().httpGET(testpostUrl, ref member.cookies);

            if (html.Contains("发表帖子 - 忍者X2站群 -  忍者软件 -  RenZhe.org!"))
            {
                EchoHelper.Echo("恭喜您,权限核对成功,您已被授权使用忍者X2站群!", "用户验证", EchoHelper.EchoType.任务信息);
                member.strMessage    = "恭喜您,权限核对成功,您已被授权使用忍者X2站群!";
                member.IS_X_PostKing = true;
            }
            else if (html.Contains("抱歉,您需要设置自己的头像后才能进行本操作"))
            {
                EchoHelper.Echo("请完善您的(基本资料、头像),即在论坛上发个帖子激活一下。授权论坛:www.renzhe.org!", "用户验证", EchoHelper.EchoType.错误信息);
                member.strMessage = "请完善您的(基本资料、头像),即在论坛上发个帖子激活一下。授权论坛:www.renzhe.org!";
            }
            else if (html.Contains("请先绑定手机号码"))
            {
                EchoHelper.Echo("请先绑定手机号码,授权论坛:www.renzhe.org!", "用户验证", EchoHelper.EchoType.错误信息);
                member.strMessage = "请先绑定手机号码,授权论坛:www.renzhe.org!";
            }
            else if (html.Contains("<s>商业授权用户</s>"))
            {
                EchoHelper.Echo("您的账户已过期,请到论坛充值续费!", "用户验证", EchoHelper.EchoType.错误信息);
                member.strMessage = "您的账户已过期,请到论坛充值续费!";
            }
            else if (html.Contains("超时"))
            {
                EchoHelper.Echo("链接服务超时!", "用户验证", EchoHelper.EchoType.错误信息);
                member.strMessage = "链接服务超时!";
            }
            else if (html.Contains("没有权限在该版块发帖"))
            {
                EchoHelper.Echo("用户登录验证失败,请重新登录!", "用户验证", EchoHelper.EchoType.错误信息);
                member.strMessage = "用户登录验证失败,请重新登录!";
            }
            else if (html.Contains("无法解析此远程名称"))
            {
                EchoHelper.Echo("域名解析出现问题,请检查您的网络设置!", "用户验证", EchoHelper.EchoType.错误信息);
                member.strMessage = "域名解析出现问题,请检查您的网络设置!";
            }
            else
            {
                EchoHelper.Echo("验证失败,原因未知!", "用户验证", EchoHelper.EchoType.错误信息);
                member.strMessage = "验证失败,原因未知!";
            }

            if (member.group.Contains("商业授权用户"))
            {
                member.IS_X_WordPressBuild = true;
            }
            else
            {
                member.IS_X_WordPressBuild = false;
            }
            return(member.IS_X_PostKing);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 验证用户,通过网络
        /// </summary>
        /// <param name="netname"></param>
        /// <param name="netpass"></param>
        /// <param name="hdinfo"></param>
        /// <returns></returns>
        protected ModelMember getUser(string netname, string netpass, string hdinfo)
        {
#if DEBUG
            member.netname             = "调试模式";
            member.group               = "商业授权用户";
            member.sitenum             = 9999;
            member.IS_X_WordPressBuild = true;
            member.IS_X_PostKing       = true;
            member.userMoney           = 9999;
            return(Login_Base.member);
#endif
            string           path    = Application.StartupPath + "\\Config\\RenZheMember.txt";
            string           html    = "";
            DbTools          db      = new DbTools();
            CookieCollection cookies = new CookieCollection();

            try {
                object obj = db.Read(path, "VCDS");
                if (obj != null)
                {
                    member = (ModelMember)obj;
                }

                EchoHelper.Echo("连接【忍者软件】用户服务端,进行通信。此过程稍慢,请稍候...", "系统登录", EchoHelper.EchoType.任务信息);

                //发现有不符的情况,将进行登录验证。
                if (member.logintime.Date < DateTime.Now.Date || member.netpass != netpass || member.netname != netname || member.hdinfo != HardWare.getHardCode())
                {
                    string purl  = "http://www.renzhe.org/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1";
                    string pdata = "fastloginfield=username&username="******"&password="******"&quickforward=yes&handlekey=ls";
                    html = new xkHttp().httpPost(purl, pdata, ref cookies, purl, Encoding.GetEncoding("utf-8"));

                    if (html.Contains(">window.location.href='"))
                    {
                        wait.ShowMsg("4/10 您的账户、密码验证成功!");
                        EchoHelper.Echo("论坛账户、密码验证成功!", "系统登录", EchoHelper.EchoType.任务信息);
                        purl = "http://www.renzhe.org/home.php?mod=spacecp&ac=credit";
                        html = new xkHttp().httpGET(purl, ref cookies);
                        if (html.Contains("[ 点击这里返回上一页 ]"))
                        {
                            EchoHelper.Echo("忍者服务端维护,暂时关闭,请稍后再试...", "系统登录", EchoHelper.EchoType.错误信息);
                            return(member);
                        }
                        if (html.Contains("您需要先登录才能继续本操作"))
                        {
                            EchoHelper.Echo("您的账号异常,请手工登录论坛检查账户问题!", "系统登录", EchoHelper.EchoType.错误信息);
                            return(member);
                        }
                        if (html.Contains("抱歉,您的 IP 地址不在被允许,或您的账号被禁用,无法访问本站点"))
                        {
                            EchoHelper.Echo("抱歉,您的 IP 地址不在被允许,或您的账号被禁用,无法访问本站点!", "系统登录", EchoHelper.EchoType.错误信息);
                            return(member);
                        }

                        wait.ShowMsg("5/10 您的用户基本信息,获取成功!");
                        EchoHelper.Echo("您的用户基本信息,获取成功!", "系统登录", EchoHelper.EchoType.任务信息);
                        member.UID           = RegexHelper.getHtmlRegexText(html, "{discuz_uid = '(.*?)'}");
                        member.netname       = RegexHelper.getHtmlRegexText(html, "{title=\"访问我的空间\">(.*?)</a>}");
                        member.sitenum       = Convert.ToInt32(RegexHelper.getHtmlRegexText(html, "{站点数:</em>(.*?) </li>}"));
                        member.group         = RegexHelper.getHtmlRegexText(html, "{showUpgradeinfo\\)\">(.*?)</a>}");
                        member.userMoney     = Convert.ToInt32(RegexHelper.getHtmlRegexText(html, "{金币:</em>(.*?)  &nbsp;}"));
                        member.formhash      = RegexHelper.getHtmlRegexText(html, "{formhash=(.*?)\">退出</a>}");
                        member.cookies       = cookies;
                        member.netpass       = netpass;
                        member.logintime     = DateTime.Now;
                        member.hdinfo        = HardWare.getHardCode();
                        member.IS_X_PostKing = true;
                        EchoHelper.Echo("链接服务端,判断应用授权状态...", "系统登录", EchoHelper.EchoType.任务信息);
                        wait.ShowMsg("6/10 链接服务端,判断应用授权状态!");
                    }
                    else
                    {
                        wait.ShowMsg("用户验证失败...");
                        string result = "未知,请重试,登录论坛联系管理员。www.renzhe.org";
                        if (html.Contains("登录失败"))
                        {
                            result = "请核对您的用户名密码!登录论坛联系管理员。www.renzhe.org";
                        }
                        if (html.Contains("showWindow('login', 'member.php?mod=logging&action="))
                        {
                            result = "发现安全问题,清除您的安全问题后,再尝试!www.renzhe.org";
                        }
                        if (html.Contains("密码错误次数过多"))
                        {
                            result = "密码错误次数过多,稍后再试!登录论坛联系管理员。www.renzhe.org";
                        }
                        if (html.Contains("无法解析此远程名称"))
                        {
                            result = "无法解析www.renzhe.org,请检查您的网络,稍后再试";
                        }

                        member.IS_X_PostKing       = false;
                        member.IS_X_WordPressBuild = false;

                        EchoHelper.Echo("登录失败:" + result, "系统登录", EchoHelper.EchoType.错误信息);
                        return(member);
                    }
                }
                else
                {
                    wait.ShowMsg("7/10 发现本地密钥,进行快捷登录...");
                    EchoHelper.Echo("发现本地登录密钥文件,进行验证,请稍后...", "系统登录", EchoHelper.EchoType.任务信息);
                }

#if !DEBUG
                //向服务端提交member序列化的类,然后验证是否为登录成功的状态。
                ValidateUser(ref member);
#else
                //ValidateUser(ref member);
#endif

                ini.up("登录账户密码", "INFO", member.netname);
                if (member.IS_X_PostKing == false)
                {
                    member.logintime = DateTime.Now.AddDays(-111);
                    FilesHelper.DeleteFile(path);
                }
                else
                {
                    wait.ShowMsg("8/10 恭喜,您的密钥经服务端验证成功!");
                    EchoHelper.Echo("恭喜,您的本地密钥,经服务端验证成功,通信一切正常!", "系统登录", EchoHelper.EchoType.任务信息);
                }
            } catch (Exception ex) {
                FilesHelper.DeleteFile(path);
                EchoHelper.Echo("与服务端通信失败!" + ex.Message, "系统登录", EchoHelper.EchoType.异常信息);
            } finally {
                if (member.group.Contains("商业"))
                {
                    member.IS_X_WordPressBuild = true;
                }

                if (member.IS_X_PostKing == true)
                {
                    wait.ShowMsg("9/10 密钥已保存,下次可快捷登录!");
                    Thread.Sleep(1200);
                    EchoHelper.Echo("您的本地密钥已保存,下次可快捷登录!", "系统登录", EchoHelper.EchoType.任务信息);
                    db.Save(path, "VCDS", member);
                }
            }
            return(Login_Base.member);
        }