示例#1
0
        private bool Reg_SendEamil(string email, string vCode, out string username, out string pwd)
        {
            username = email.Split('@')[0];
            pwd      = DateTime.Now.ToString("HHmmss") + username;
            StringBuilder postData = new StringBuilder();

            postData.Append("fromUrl=http%3A%2F%2Fwww.csdn.net%2F&userName="******"&email=" + Encode.UrlEncode(email));
            postData.Append("&password="******"&confirmpassword="******"&validateCode=" + vCode + "&agree=on");
            HttpHelpers helper = new HttpHelpers();                                                    //发起请求对象
            HttpItems   items  = new HttpItems();                                                      //请求设置对象
            HttpResults hr     = new HttpResults();                                                    //请求结果

            items.URL       = "http://passport.csdn.net/account/register?action=saveUser&isFrom=true"; //设置请求地址
            items.Postdata  = postData.ToString();
            items.Method    = "Post";
            items.Container = cc;       //自动处理Cookie时,每次提交时对cc赋值即可
            hr = helper.GetHtml(items); //发起请求并得到结果
            if (hr.Html.Contains("请在24小时内点击邮件中的链接继续完成注册"))
            {
                return(true);
            }
            return(false);
        }
示例#2
0
        /// <summary>
        /// 获取Product详情页html
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public static HttpResults GetProductHTML(string productId)
        {
            HttpHelpers httpHelpers = new HttpHelpers();
            HttpItems   httpItems   = new HttpItems();

            httpItems.UserAgent = "PostmanRuntime/7.26.5";
            httpItems.Cookie    = @"search=%7B%22usage%22%3A%7B%22dailyCount%22%3A1%2C%22lastRequest%22%3A%222020-11-06T09%3A53%3A57.109Z%22%7D%2C%22version%22%3A1%7D; ai_user=SLNMH|2020-11-06T09:53:57.109Z; ai_session=scCXs|1604656437109|1604656437109; ak_bmsc=0EC8C5810D00709FB93F4C60975BC7D317D536F367500000361DA55FB82BD84F~plwLAMyVqgM0bsdVzFfB6qlODAu0e32lU47q3P7vq3FZz076hP2jCgpExGVWyeMRRbPanjMUXohzuX8TvW+C44BMmzgLtnKznOWNxrN0hMpZkMbwCD+ITPirQLMKFta2a2c9ltk9maXhB11eKqWMylHDjeZMg76vdX3UfVjm8YvEZeZ3tGcfLndL9k41qky2QBjJcMct5hq1dgH9PGQkvr58iNKQuBrU274UgDLcWMYm4=; bm_sz=5B7C9B8E2A96BB2C294CC28FE6A48EA8~YAAQ8zbVF8LwCJV1AQAARBv6nAkb9HEyp4mY40+2ypccTcHMkrGuzOLbP7b/QawLNpGIr0/o88W3Xw3o7W/zQiDJxwYfOSDonepfixLMeCDFebCbjEeg6nIhbKvUKxEXbSKadvZy/5FfYGVe1MqcV9giBX+Y2KLlP/cEhtNplcPIxabFhQ+Zn0bYZxLJfCkhDQ==; _abck=EEAAC7EA1D0AD7EEBFC7B078DAA55A46~-1~YAAQ8zbVF8PwCJV1AQAARRv6nARRpfMbB5kDg6ZZb1pAzuGvd/jp72GGLlljN0m4YbM5YfusqBtW3o1aKj3M3FjIl461ly26xE9ImrE7nDd1CSj95s3PjMf1a+s6JxTa2FQkmLDTqWsKjmTppuLbSeI2xdymwNvVCIr8d2dkQdEoUMnOS8jwHshcpjh8egviczqK+38xm9S1rjGRBkgv2dJQUEuCJJgyv2EwcdWjbW2U2A9ITDIzhGk78GsF1FxxpQF9qhdRXWSvSj+rJyCdoNrH3FTfniedpqPj7+ZB5VRDuE3XcAG3a1nXRQ==~-1~-1~-1; TS017613a9=01460246b66b40620aa30ff6dfb4c861d3f8e1f4b1aa9297148d2269a25c502a0d9633e12bdfc06ea02b5c0a85be34def4669934bc; TS018060f7=01460246b6fc72b719b989a8523ecd16befaad164d0af65dc89ff7ff6e6d04e70509534f6b47a437b4e012069f69b0531e61df1fb2; bm_mi=75F3C83C7A94A12C0C9C413BFFE8078E~yzQFqC2PlSbdoHPZ2pqapMuYyuTZeHc3OyOnvCkv+GMAoCPeWrHtUc6UTdkb5nYm97zfcVa7CPXEQo7uSwl8jgQ0EcYALhQGEQJPufNoo9dYphfy0DT3HTpwc4bPJTqzjEwhXIXFsU5jzKrQsz81oh3yDaGTJdIfkMh4l3ahy+M/xWEquJpSz8LF/UJ6qHDaR5NXbwacVtLRZc4zYj4acpRBX7watLpDTJW7yCutNUBx2Xi9q7Jq9OsPemWsFiNF+5oA1h6DUPoTRsxfWrJ0U0I444aIOrLZMKEzv0kXBOE=; bm_sv=60B0A9C8ADBAA4D454AF67EEAE53EB4F~g1judWgfKn91VPRQ/6aCgsrnEo2eUPRk5NTi9fQcaeleiSlA+oGKonD9pT5zjVdb4pmwiMipl5kJaHsOW099yy+xOjdks4wd4IFmQs9S4MdhnjjmENE35PVkQ+LxkZjnEtyiI3xvPpYQWln+5qtuvrDzDPCPRvhpmtPYLdmuugk=";
            httpItems.Accept    = "*/*";
            httpItems.Header.Add("Accept-Encoding", "gzip, deflate, br");
            httpItems.Header.Add("Connection", "keep-alive");
            httpItems.Url = $"https://www.digikey.com/en/products/detail/{new Random().Next(1, 1000)}/{new Random().Next(1, 1000)}/" + productId;
            Console.WriteLine(httpItems.Url);
            var result = httpHelpers.GetHtml(httpItems);

            if (result.StatusCode != HttpStatusCode.OK)
            {
                Log.Error("productId:" + productId + "---" + result.StatusCode);
            }
            else
            {
                Console.WriteLine("==== ProductCrawler success === " + httpItems.Url);
            }
            result.ID = productId.ToString();
            return(result);
        }
        static string StrCookie = "";                  //设置初始Cookie值

        /// <summary>

        /// 执行HttpCodeCreate

        /// </summary>

        public static string GetCarData()
        {
            string res = string.Empty;                                                       //请求结果,请求类型不是图片时有效

            string url = "http://car.autohome.com.cn/javascript/NewSpecCompare.js?20131010"; //请求地址

            items = new HttpItems();                                                         //每次重新初始化请求对象

            items.URL = url;                                                                 //设置请求地址

            //items.Referer = "http://car.autohome.com.cn/price/brand-35.html";//设置请求来源
            items.Referer = "https://car.autohome.com.cn/price/series-3891.html";                                                              //设置请求来源

            items.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36"; //设置UserAgent

            items.Cookie = StrCookie;                                                                                                          //设置字符串方式提交cookie

            items.Allowautoredirect = true;                                                                                                    //设置自动跳转(True为允许跳转) 如需获取跳转后URL 请使用 hr.RedirectUrl

            items.ContentType = "application/x-www-form-urlencoded";                                                                           //内容类型

            hr = helper.GetHtml(items, ref StrCookie);                                                                                         //提交请求

            res = hr.Html;                                                                                                                     //具体结果
            res = res.Split('=')[1];
            int x = res.LastIndexOf(";", res.Length);                                                                                          //lastindexof是从最后开始取.indexof才是从前面开始

            res = res.Substring(0, x);
            return(res.Trim());//返回具体结果
        }
示例#4
0
        public void forlog(string cookie, string name, string pwd)
        {
            string url = string.Format("http://reg.email.163.com/unireg/call.do?cmd=register.formLog");

            string[] data =
            {
                string.Format("opt=write_field&flow=main&field=name&result=done&uid={0}%40163.com&timecost={1}&level=info", name,                   new Random().Next(4000, 10000).ToString()),
                string.Format("opt=write_field&flow=main&field=pwd&result=done&strength=2&timecost={0}&level=info",         new Random().Next(4000,     10000).ToString()),
                string.Format("opt=write_field&flow=main&field=cfmPwd&result=done&timecost={0}&level=info",                 new Random().Next(4000,     10000).ToString()),
                string.Format("opt=write_field&flow=main&field=vcode&result=done&timecost={0}&level=info",                  new Random().Next(4000,     10000).ToString()),
            };
            string postdata = "";
            //"opt=write_field&flow=main&field=name&result=done&uid=kljdiel%40163.com&timecost=4460&level=info";
            //opt=write_field&flow=main&field=pwd&result=done&strength=2&timecost=2927&level=info
            //opt=write_field&flow=main&field=cfmPwd&result=done&timecost=2967&level=info
            //opt=write_field&flow=main&field=vcode&result=done&timecost=4920&level=info
            int index = 0;

            while (index < data.Length)
            {
                postdata = data[index];
                index++;

                items = new HttpItems()
                {
                    URL     = url,
                    Cookie  = Cookies,
                    ProxyIp = Proxy
                };
                hr = helper.GetHtml(items, ref Cookies);
                //Cookies +=  HttpHelpers.GetSmallCookie(hr.Cookie);
                string reHtml = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");
            }
            //reHtml = reHtml.Trim();
        }
示例#5
0
        public static string ConvertUrl(string _pdata)
        {
            /*
             * Cookie常用的几种处理方式:
             * new XJHTTP().UpdateCookie("旧Cookie", "请求后的Cookie");//合并Cookie,将cookie2与cookie1合并更新 返回字符串类型Cookie
             * new XJHTTP().StringToCookie("网站Domain", "字符串Cookie内容");//将文字Cookie转换为CookieContainer 对象
             * new XJHTTP().CookieTostring("CookieContainer 对象");//将 CookieContainer 对象转换为字符串类型
             * new XJHTTP().GetAllCookie("CookieContainer 对象");//得到CookieContainer中的所有Cookie对象集合,返回List<Cookie>
             * new XJHTTP().GetCookieByWininet("网站Url");//从Wininet 中获取字符串Cookie 可获取IE与Webbrowser控件中的Cookie
             * new XJHTTP().GetAllCookieByHttpItems("请求设置对象");//从请求设置对象中获取Cookie集合,返回List<Cookie>
             * new XJHTTP().ClearCookie("需要处理的字符串Cookie");//清理string类型Cookie.剔除无用项返回结果为null时遇见错误.
             * new XJHTTP().SetIeCookie("设置Cookie的URL", "需要设置的Cookie");//可设置IE/Webbrowser控件Cookie
             * new XJHTTP().CleanAll();//清除IE/Webbrowser所有内容 (注意,调用本方法需要管理员权限运行) CleanHistory();清空历史记录  CleanCookie(); 清空Cookie CleanTempFiles(); 清空临时文件
             */
            string url   = "dwz.cn/create.php";                               //请求地址
            string res   = string.Empty;                                      //请求结果,请求类型不是图片时有效
            string pdata = "url=" + _pdata;                                   //提交数据(必须项)

            System.Net.CookieContainer cc = new System.Net.CookieContainer(); //自动处理Cookie对象
            HttpHelpers helper            = new HttpHelpers();                //发起请求对象
            HttpItems   items             = new HttpItems();                  //请求设置对象
            HttpResults hr = new HttpResults();                               //请求结果

            items.URL       = url;                                            //设置请求地址
            items.Container = cc;                                             //自动处理Cookie时,每次提交时对cc赋值即可
            items.Postdata  = pdata;                                          //提交的数据
            items.Method    = "Post";                                         //设置请求类型为Post方式(默认为Get方式)
            hr  = helper.GetHtml(items);                                      //发起请求并得到结果
            res = hr.Html;                                                    //得到请求结果
            return(res);
        }
示例#6
0
        public string GetVcode()
        {
            while (true)
            {
                antiIndex = AntiHelper.LoadCdsFromFile(System.Environment.CurrentDirectory + "\\csdn.cds", "csdn20160126");
                string      url    = "http://passport.csdn.net/ajax/verifyhandler.ashx?rand=" + DateTime.Now.ToString("yyyyMMddHHmmss"); //请求地址
                string      res    = string.Empty;                                                                                       //请求结果,请求类型不是图片时有效
                HttpHelpers helper = new HttpHelpers();                                                                                  //发起请求对象
                HttpItems   items  = new HttpItems();                                                                                    //请求设置对象
                HttpResults hr     = new HttpResults();                                                                                  //请求结果
                items.URL        = url;                                                                                                  //设置请求地址
                items.Container  = cc;                                                                                                   //自动处理Cookie时,每次提交时对cc赋值即可
                items.ResultType = ResultType.Byte;                                                                                      //设置请求返回值类型为Byte
                StringBuilder vCodeResult = new StringBuilder('\0', 256);
                hr = helper.GetHtml(items);
                byte[] img = hr.ResultByte;
                if (AntiHelper.GetVcodeFromBuffer(antiIndex, img, img.Length, vCodeResult))
                {
                    items           = new HttpItems();
                    items.URL       = "http://passport.csdn.net/account/register?action=validateCode&validateCode=" + vCodeResult;
                    items.Container = cc;       //自动处理Cookie时,每次提交时对cc赋值即可
                    hr = helper.GetHtml(items); //发起请求并得到结果
                    if (!hr.Html.Contains("false"))
                    {
                        return(vCodeResult.ToString());
                    }
                }

                Thread.Sleep(1000);
            }
        }
示例#7
0
        /// <summary>
        /// 平台登录
        /// </summary>
        /// <param name="apiId">账号API</param>
        /// <param name="pswd">账号密码</param>
        /// <returns></returns>
        public static bool Login(string apiId, string pswd)
        {
            var       result = string.Empty;
            HttpItems item   = new HttpItems
            {
                URL = $"http://api.ndd001.com/do.php?action=loginIn&name={apiId}&password={pswd}"
            };

            try
            {
                result = new HttpHelpers().GetHtml(item).Html;
#if DEBUG
                Console.WriteLine($"{nameof(Login)} result:{result}");
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine($"{nameof(Login)} ex :{ ex.Message}");
#endif
            }

            if (result.Contains("1|"))
            {
                GlobalToken = result.Replace("1|", "");
                return(true);
            }
            return(false);
        }
示例#8
0
文件: Form1.cs 项目: yqMac/regTool
        private void waitforIp(string ip)
        {
            bool retry = true;

            do
            {
                HttpItems items = new HttpItems();
                items.URL = @"http://www.ip138.com/ips1388.asp";
                //items.ProxyIp = ip;
                items.Cookie = " ";
                //items.ProxyIp = "";
                items.Timeout = 3000;
                HttpResults hr = new HttpHelpers().GetHtml(items);
                //string s = hr.StatusDescription;

                string reHtml = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "").Replace(" ", "");
                if (reHtml.Contains("您的IP地址是"))
                {
                    retry  = false;
                    reHtml = new XJHTTP().GetStringMid(reHtml, "您的IP地址是:[", "]");
                    //reHtml = new XJHTTP().GetStringMid(reHtml, "[", "");
                }
                else
                {
                    Tsleep(10);
                }
            }while (retry);
        }
示例#9
0
        public Image GetImage(string url)
        {
            /*
             * Cookie常用的几种处理方式:
             * new XJHTTP().UpdateCookie("旧Cookie", "请求后的Cookie");//合并Cookie,将cookie2与cookie1合并更新 返回字符串类型Cookie
             * new XJHTTP().StringToCookie("网站Domain", "字符串Cookie内容");//将文字Cookie转换为CookieContainer 对象
             * new XJHTTP().CookieTostring("CookieContainer 对象");//将 CookieContainer 对象转换为字符串类型
             * new XJHTTP().GetAllCookie("CookieContainer 对象");//得到CookieContainer中的所有Cookie对象集合,返回List<Cookie>
             * new XJHTTP().GetCookieByWininet("网站Url");//从Wininet 中获取字符串Cookie 可获取IE与Webbrowser控件中的Cookie
             * new XJHTTP().GetAllCookieByHttpItems("请求设置对象");//从请求设置对象中获取Cookie集合,返回List<Cookie>
             * new XJHTTP().ClearCookie("需要处理的字符串Cookie");//清理string类型Cookie.剔除无用项返回结果为null时遇见错误.
             * new XJHTTP().SetIeCookie("设置Cookie的URL", "需要设置的Cookie");//可设置IE/Webbrowser控件Cookie
             * new XJHTTP().CleanAll();//清除IE/Webbrowser所有内容 (注意,调用本方法需要管理员权限运行) CleanHistory();清空历史记录  CleanCookie(); 清空Cookie CleanTempFiles(); 清空临时文件
             */
            //string url = "http://img.ithome.com/images/v2.1/noavatar.png";//请求地址
            string      res    = string.Empty;            //请求结果,请求类型不是图片时有效
            HttpHelpers helper = new HttpHelpers();       //发起请求对象
            HttpItems   items  = new HttpItems();         //请求设置对象
            HttpResults hr     = new HttpResults();       //请求结果

            items.URL        = url;                       //设置请求地址
            items.ResultType = ResultType.Byte;           //设置请求返回值类型为Byte
            return(helper.GetImg(helper.GetHtml(items))); //picImage图像控件Name
            //return null;
        }
示例#10
0
        /// <summary>
        /// 获取收到的短信
        /// </summary>
        /// <returns>成功返回true,可用CurMsg获取</returns>
        public bool GetMessAge()
        {
            var       result = string.Empty;
            HttpItems item   = new HttpItems
            {
                URL = "http://api.ndd001.com/do.php?action=getMessage&sid=" + proJetId + "&phone=" + CurPhone + "&token=" + GlobalToken
            };

            try
            {
                result = new HttpHelpers().GetHtml(item).Html;
#if DEBUG
                Console.WriteLine($"{nameof(GetMessAge)} result:{result}");
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine($"{nameof(GetMessAge)} result:{ex.Message}");
#endif
            }
            var mList = Regex.Matches(result, "本次验证码为: (\\d+),请");
            if (mList.Count > 0)
            {
                CurMsg = mList[0].Groups[1].Value;
#if DEBUG
                Console.WriteLine($"CurMsg :{CurMsg}");
#endif
                return(true);
            }
            return(false);
        }
示例#11
0
        /// <summary>
        /// 获取手机号
        /// </summary>
        /// <returns>成功返回true,可用CurPhone获取</returns>
        public bool GetPhone()
        {
            var       result = string.Empty;
            HttpItems item   = new HttpItems
            {
                URL = "http://api.ndd001.com/do.php?action=getPhone&sid=" + proJetId + "&token=" + GlobalToken
            };

            try
            {
                result = new HttpHelpers().GetHtml(item).Html;
#if DEBUG
                Console.WriteLine($"{nameof(GetPhone)} result:{result}");
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine($"{nameof(GetPhone)} result:{ex.Message}");
#endif
            }
            if (result.Contains("1|"))
            {
                this.CurPhone = result.Replace("1|", "");
                return(true);
            }
            return(false);
        }
示例#12
0
        private void btnGet_Click(object sender, EventArgs e)
        {
            Random r = new Random();

            //初始化Cookie变量
            cc   = new System.Net.CookieContainer();
            item = new HttpItems();
            //get 主页
            item.URL       = "http://www.mp4ba.com";
            item.Cookie    = "__cfduid=123456789; search_state=1463675467;";
            item.UseUnsafe = true;
            hr             = http.GetHtml(item);

            string cookie = hr.Cookie;
            XJHTTP xjhttp = new XJHTTP();

            cc = xjhttp.AddCookieToContainer(cc, cookie);
            //get 验证码
            picurl         += r.NextDouble();
            item.URL        = picurl;
            item.Referer    = BaseUrl;
            item.ResultType = ResultType.Byte; //设置返回值类型
            hr = http.GetHtml(item);

            pic.Image = http.GetImg(hr);
        }
示例#13
0
        System.Net.CookieContainer cc = new System.Net.CookieContainer();//自动处理Cookie对象


        #region 获取一个邮箱地址

        /// <summary>
        /// 获取一个邮箱地址
        /// </summary>
        /// <returns></returns>
        public string GetEmail()
        {
            string url = "https://10minutemail.net/"; //请求地址
            string res = string.Empty;                //请求结果,请求类型不是图片时有效

            HttpHelpers helper = new HttpHelpers();   //发起请求对象
            HttpItems   items  = new HttpItems();     //请求设置对象
            HttpResults hr     = new HttpResults();   //请求结果

            items.URL       = url;                    //设置请求地址
            items.Container = cc;                     //自动处理Cookie时,每次提交时对cc赋值即可
            hr  = helper.GetHtml(items);              //发起请求并得到结果
            res = hr.Html;                            //得到请求结果
            Regex           reg = new Regex("data-clipboard-text=\"(.*?)\"><i class=\"fa");
            MatchCollection mc  = reg.Matches(res);

            //string GroupsResult = string.Empty;
            for (int i = 0; i < mc.Count; i++)
            {
                GroupCollection gc = mc[i].Groups; //得到所有分组
                for (int j = 1; j < gc.Count; j++) //多分组 匹配的原始文本不要
                {
                    string temp = gc[j].Value;
                    if (!string.IsNullOrEmpty(temp))
                    {
                        //GroupsResult += string.Format("Groups 【{0}】   Values 【{1}】", (j).ToString(), temp); //获取结果
                        return(temp);
                    }
                }
            }
            return(string.Empty);
        }
示例#14
0
文件: UpLoadIMG.cs 项目: uvbs/ZhaoBi
        /// <summary>
        /// 识别证件正面
        /// </summary>
        /// <param name="mid"></param>
        /// <returns></returns>
        private (string name, string cardid) Ocr(string mid)
        {
            HttpItems item = new HttpItems
            {
                URL         = "https://pcapi.licai.cn/api/Certification/Ocr",
                Method      = "POST",
                ContentType = "application/x-www-form-urlencoded;",
                Referer     = "https://www.zhaobi.com/",
                UserAgent   = UpLoadIMG.USERAGENT,
                Postdata    = $"mid={mid}"
            };

            item.Header.Add("Authorization", $"Bearer {_authorization}");
            item.Header.Add("FZM-USER-IP", _userIp);
            item.Header.Add("FZM-REQUEST-OS", "web");
            var result = new HttpHelpers().GetHtml(item).Html;

#if DEBUG
            Console.WriteLine($"{nameof(Ocr)} result: {result}");
#endif
            var json = JsonConvert.DeserializeAnonymousType(result, new
            {
                data = new
                {
                    address  = "",
                    birthday = "",
                    cardid   = "",
                    name     = "",
                    nation   = "",
                    provider = "",
                    sex      = "",
                }
            });
            return(json.data.name, json.data.cardid);
        }
示例#15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="longurl">长链接</param>
        public static string GetShort(string longurl)
        {
            /*
             * Cookie常用的几种处理方式:
             * new XJHTTP().UpdateCookie("旧Cookie", "请求后的Cookie");//合并Cookie,将cookie2与cookie1合并更新 返回字符串类型Cookie
             * new XJHTTP().StringToCookie("网站Domain", "字符串Cookie内容");//将文字Cookie转换为CookieContainer 对象
             * new XJHTTP().CookieTostring("CookieContainer 对象");//将 CookieContainer 对象转换为字符串类型
             * new XJHTTP().GetAllCookie("CookieContainer 对象");//得到CookieContainer中的所有Cookie对象集合,返回List<Cookie>
             * new XJHTTP().GetCookieByWininet("网站Url");//从Wininet 中获取字符串Cookie 可获取IE与Webbrowser控件中的Cookie
             * new XJHTTP().GetAllCookieByHttpItems("请求设置对象");//从请求设置对象中获取Cookie集合,返回List<Cookie>
             * new XJHTTP().ClearCookie("需要处理的字符串Cookie");//清理string类型Cookie.剔除无用项返回结果为null时遇见错误.
             * new XJHTTP().SetIeCookie("设置Cookie的URL", "需要设置的Cookie");//可设置IE/Webbrowser控件Cookie
             * new XJHTTP().CleanAll();//清除IE/Webbrowser所有内容 (注意,调用本方法需要管理员权限运行) CleanHistory();清空历史记录  CleanCookie(); 清空Cookie CleanTempFiles(); 清空临时文件
             */
            string url = "http://api.t.sina.com.cn/short_url/shorten.json?source=4257120060&url_long=" + Encode.UrlEncode(longurl); //请求地址
            string res = string.Empty;                                                                                              //请求结果,请求类型不是图片时有效

            System.Net.CookieContainer cc = new System.Net.CookieContainer();                                                       //自动处理Cookie对象
            HttpHelpers helper            = new HttpHelpers();                                                                      //发起请求对象
            HttpItems   items             = new HttpItems();                                                                        //请求设置对象
            HttpResults hr = new HttpResults();                                                                                     //请求结果

            items.URL       = url;                                                                                                  //设置请求地址
            items.Container = cc;                                                                                                   //自动处理Cookie时,每次提交时对cc赋值即可
            hr  = helper.GetHtml(items);                                                                                            //发起请求并得到结果
            res = hr.Html;                                                                                                          //得到请求结果
            return(res);
        }
示例#16
0
        /// <summary>
        /// Post
        /// </summary>
        /// <param name="Url"></param>
        /// <param name="Postdata"></param>
        /// <param name="Cookie"></param>
        /// <param name="ProxyIp"></param>
        /// <param name="ContentType"></param>
        /// <param name="Referer"></param>
        /// <returns></returns>
        public static HttpResults Nut_Post(String Url, String Postdata, String Cookie, String ProxyIp, String Referer = null, String ContentType = "application/x-www-form-urlencoded")
        {
            HttpHelpers helper = new HttpHelpers();                                                    //请求执行对象
            HttpItems   items;                                                                         //请求参数对象
            HttpResults hr = new HttpResults();                                                        //请求结果对象

            string res = string.Empty;                                                                 //请求结果,请求类型不是图片时有效
            string url = Url;                                                                          //请求地址

            items     = new HttpItems();                                                               //每次重新初始化请求对象
            items.URL = url;                                                                           //设置请求地址

            items.ProxyIp   = ProxyIp;                                                                 //设置代理
            items.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"; //设置UserAgent
            items.Referer   = Referer;
            Cookie          = new XJHTTP().UpdateCookie(Cookie, "");                                   //合并自定义Cookie, 注意!!!!! 仅在有需要合并Cookie的情况下 第一次给 " " 信息,其他类库会自动维护,不需要每次调用更新
            items.Cookie    = Cookie;                                                                  //设置字符串方式提交cookie

            items.Allowautoredirect = true;                                                            //设置自动跳转(True为允许跳转) 如需获取跳转后URL 请使用 hr.RedirectUrl
            items.ContentType       = ContentType;                                                     //内容类型
            items.Method            = "POST";                                                          //设置请求数据方式为Post
            items.Postdata          = Postdata;                                                        //Post提交的数据
            hr = helper.GetHtml(items, ref Cookie);                                                    //提交请求

            return(hr);                                                                                //返回具体结果
        }
示例#17
0
 private void button2_Click(object sender, EventArgs e)
 {
     //system("whoami");
     if (this.textBox1.Text == "")
     {
         MessageBox.Show("No Url");
     }
     else if (this.textBox2.Text == "")
     {
         MessageBox.Show("No Code");
     }
     else
     {
         HttpHelpers httpHelpers = new HttpHelpers();
         HttpItems   httpItems   = new HttpItems();
         HttpResults httpResults = new HttpResults();
         httpItems.URL         = this.textBox1.Text;
         httpItems.Timeout     = 5000;
         httpItems.Accept      = "*/*";
         httpItems.UserAgent   = "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)";
         httpItems.ContentType = "application/x-www-form-urlencoded";
         httpItems.Header.Add("Accept-Encoding", "gzip,deflate");
         httpItems.Header.Add("Accept-Charset", "cHJpbnQoIkEtWkBRQVFAMC05Lk9LIik7");
         httpItems.Method = "Get";
         httpResults      = httpHelpers.GetHtml(httpItems);
         if (httpResults.Html.Contains("A-Z@[email protected]"))
         {
             get_code();
         }
         else
         {
             MessageBox.Show("No Vul");
         }
     }
 }
示例#18
0
        /// <summary>
        /// 检查某用户名可否被注册
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        private bool CheckUserName(string username)
        {
            try
            {
                string url      = String.Format("http://reg.email.163.com/unireg/call.do?cmd=urs.checkName");
                string postdata = "name=" + username;
                items = new HttpItems()
                {
                    URL      = url,
                    Cookie   = Cookies,
                    Method   = "post",
                    Postdata = postdata,
                    IsAjax   = true
                };
                //items.Container = cc;
                // items.ProxyIp = proxy ;
                hr = helper.GetHtml(items, ref Cookies);
                //Cookies +=  HttpHelpers.GetSmallCookie(hr.Cookie);
                string reHtml = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");
                reHtml = reHtml.Trim();
                //Cookiesss += hr.Cookie;
                if (reHtml.Contains("OK"))
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
            }

            return(false);
        }
示例#19
0
        public bool Login163(string user, string pwd)
        {
            Cookies = "";
            string url      = "";
            string postdata = "";
            string reHtml   = "";

            try
            {
                //获取浏览器标识JESSION等基础信息
                url   = string.Format("http://reg.163.com/click.jsp?click_in=Login&v={0}&click_count_spec=userLoginQuery&_ahref=&_at=", new XJHTTP().GetTimeByJs());
                items = new HttpItems()
                {
                    URL     = url,
                    Cookie  = Cookies,
                    Referer = string.Format("http://reg.163.com/UserLogin.do?errorType=460&errorUsername={0}@163.com", user)//"http://reg.163.com/UserLogin.do"
                };
                hr     = helper.GetHtml(items, ref Cookies);
                reHtml = hr.Html;


                //提交登录信息
                url      = string.Format("https://reg.163.com/logins.jsp");
                postdata = string.Format("type=1&product=urs&url=&url2=http%3A%2F%2Freg.163.com%2FUserLogin.do&username={0}%40163.com&password={1}", user, pwd);
                items    = new HttpItems()
                {
                    URL      = url,
                    Cookie   = Cookies,
                    Method   = "post",
                    Postdata = postdata,
                    Referer  = string.Format("http://reg.163.com/UserLogin.do?errorType=460&errorUsername={0}@163.com", user)
                };
                hr     = helper.GetHtml(items, ref Cookies);
                reHtml = hr.Html;

                //登录后面内容
                url   = string.Format("http://reg.163.com/Main.jsp?username={0}", user);
                items = new HttpItems()
                {
                    URL    = url,
                    Cookie = Cookies,
                };
                hr     = helper.GetHtml(items, ref Cookies);
                reHtml = hr.Html;

                if (reHtml.Contains("上次登录"))
                {
                    return(true);
                }
            }

            catch (Exception ex)
            {
            }


            return(false);
        }
示例#20
0
        /// <summary>
        /// 获取Product详情页html
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public static HttpResults ProductCategoryHTML()
        {
            HttpHelpers httpHelpers = new HttpHelpers();
            HttpItems   httpItems   = new HttpItems();

            httpItems.Url       = "https://www.digikey.com/en/products";
            httpItems.UserAgent = "PostmanRuntime/7.26.5";
            return(httpHelpers.GetHtml(httpItems));
        }
示例#21
0
文件: Form1.cs 项目: 2stack/bto
 private void button5_Click(object sender, EventArgs e)
 {
     //设置httpitem属性即可携带证书
     item         = new HttpItems();
     item.CerPath = AppDomain.CurrentDomain.BaseDirectory + "1.cer";
     item.CerPass = "******";
     item.URL     = "https://license.52cmg.cn/index.html";
     var i = new HttpHelpers().GetHtml(item);
 }
示例#22
0
        private void button8_Click(object sender, EventArgs e)
        {
            XJHTTP xj = new XJHTTP();

            item     = new HttpItems();
            item.URL = "www.msdn5.com";
            hr       = http.GetHtml(item);
            DateTime dt = xj.GetServerTime(hr);  //返回正常格式的时间
            //例如 Date:Sat, 14 Nov 2015 15:55:35 GMT   返回为正常的 2015-11-15 00:21:19 格式
        }
示例#23
0
        public static HttpResults Get(string url)
        {
            HttpHelpers http = new HttpHelpers();
            HttpItems   item = new HttpItems();

            item.Url = url;
            HttpResults hr = http.GetHtml(item);

            return(hr);
        }
示例#24
0
 public HttpCoreClient()
 {
     HttpClient = new HttpHelpers();
     Items      = new HttpItems
     {
         IsSetSecurityProtocolType = true,
         SecProtocolTypeEx         = SecurityProtocolTypeEx.Ssl3,
         Method = "GET"
     };
 }
示例#25
0
        /// <summary>
        /// 拉黑手机号
        /// </summary>
        public void AddBlack()
        {
            HttpItems item = new HttpItems();

            try
            {
                item.URL = "http://api.ndd001.com/do.php?action=addBlacklist&sid=" + proJetId + "&phone=" + CurPhone + "&token=" + GlobalToken;
                var result = new HttpHelpers().GetHtml(item).Html;
            }
            catch { }
        }
示例#26
0
        //TODO:写采集



        /// <summary>
        /// 访问网页
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public string GetHtml(string url)
        {
            System.Net.CookieContainer cc = new System.Net.CookieContainer(); //自动处理Cookie对象
            HttpHelpers helper            = new HttpHelpers();                //发起请求对象
            HttpItems   items             = new HttpItems();                  //请求设置对象
            HttpResults hr = new HttpResults();                               //请求结果

            items.URL       = url;                                            //设置请求地址
            items.Container = cc;                                             //自动处理Cookie时,每次提交时对cc赋值即可
            hr = helper.GetHtml(items);                                       //发起请求并得到结果
            return(hr.Html);                                                  //得到请求结果
        }
示例#27
0
        private string GetNewMail()
        {
            string url = "https://10minutemail.net/mailbox.ajax.php?_=" + DateTime.Now.ToString("yyyyMMddHHmmss");
            //请求地址
            string      res    = string.Empty;      //请求结果,请求类型不是图片时有效
            HttpHelpers helper = new HttpHelpers(); //发起请求对象
            HttpItems   items  = new HttpItems();   //请求设置对象
            HttpResults hr     = new HttpResults(); //请求结果

            items.URL       = url;                  //设置请求地址
            items.IsAjax    = true;
            items.Container = cc;                   //自动处理Cookie时,每次提交时对cc赋值即可
            hr  = helper.GetHtml(items);            //发起请求并得到结果
            res = hr.Html;                          //得到请求结果
            if (!res.Contains("CSDN"))
            {
                return(string.Empty);
            }
            Regex           reg          = new Regex("<a href=\"(.*?)\">");
            MatchCollection mc           = reg.Matches(res);
            List <string>   GroupsResult = new List <string>();

            for (int i = 0; i < mc.Count; i++)
            {
                GroupCollection gc = mc[i].Groups; //得到所有分组
                for (int j = 1; j < gc.Count; j++) //多分组 匹配的原始文本不要
                {
                    string temp = gc[j].Value;
                    if (!string.IsNullOrEmpty(temp))
                    {
                        GroupsResult.Add(temp); //获取结果
                    }
                }
            }
            foreach (var temp in GroupsResult)
            {
                if (!temp.Contains("welcome"))
                {
                    items.URL = "https://10minutemail.net/" + temp; //设置请求地址
                    //items.IsAjax = true;
                    items.Container = cc;                           //自动处理Cookie时,每次提交时对cc赋值即可
                    hr  = helper.GetHtml(items);                    //发起请求并得到结果
                    res = hr.Html;                                  //得到请求结果
                    if (res.Contains("感谢您注册CSDN社区"))
                    {
                        return(GetJiHuoHerf(res));
                    }
                    break;
                }
            }
            return(string.Empty);
        }
示例#28
0
        private void btnAsyncGet_Click(object sender, EventArgs e)
        {
            HttpHelpers http = new HttpHelpers();                                        //请求发起对象
            HttpItems   item = new HttpItems();                                          //请求设置对象

            System.Net.CookieContainer cc = new System.Net.CookieContainer();            //自动处理cookie对象
            item.URL       = "bbs.msdn5.com";                                            //请求地址
            item.Container = cc;                                                         //初始化cookie
            item.Timeout   = 3 * 5000;
            Action <HttpResults> ActionCallback = new Action <HttpResults>(GetCallBack); //完成后的回调地址

            http.AsyncGetHtml(item, ActionCallback);                                     //执行异步请求,结果在ActionCallback的回调函数(GetCallBack)中查看
        }
示例#29
0
 private void batchPool()
 {
     for (int i = 0; i < this.listView1.Items.Count; i++)
     {
         try
         {
             string      url         = this.listView1.Items[i].SubItems[1].Text;
             HttpHelpers httpHelpers = new HttpHelpers();
             HttpItems   httpItems   = new HttpItems();
             HttpResults httpResults = new HttpResults();
             httpItems.URL         = url;
             httpItems.Timeout     = 5000;
             httpItems.Accept      = "*/*";
             httpItems.UserAgent   = "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)";
             httpItems.ContentType = "application/x-www-form-urlencoded";
             httpItems.Header.Add("Accept-Encoding", "gzip,deflate");
             httpItems.Header.Add("Accept-Charset", "cHJpbnQoIkEtWkBRQVFAMC05Lk9LIik7");
             httpItems.Method = "Get";
             httpResults      = httpHelpers.GetHtml(httpItems);
             if (httpResults.Html.Contains("A-Z@[email protected]"))
             {
                 flag = "1";
                 //MessageBox.Show("Target Has Vul");
             }
             else
             {
                 flag = "0";
                 //MessageBox.Show("No Vul");
             }
         }
         catch { }
         finally
         {
             if (flag == "1")
             {
                 this.listView1.Items[i].ForeColor        = Color.DarkGray;
                 this.listView1.Items[i].SubItems[2].Text = "Has Vul";
                 this.listView1.Items[i].SubItems[3].Text = "1";
                 //MessageBox.Show("Target Has Vul");
             }
             else
             {
                 this.listView1.Items[i].ForeColor        = Color.DarkGray;
                 this.listView1.Items[i].SubItems[2].Text = "No Vul";
                 this.listView1.Items[i].SubItems[3].Text = "1";
                 //MessageBox.Show("No Vul");
             }
             Thread.Sleep(1);
         }
     }
 }
示例#30
0
        /// <summary>
        /// GET
        /// </summary>
        /// <param name="Url"></param>
        /// <param name="Cookie"></param>
        /// <returns></returns>
        public static HttpResults Nut_Get(String Url, String ProxyIp, String Cookie = null)
        {
            HttpHelpers http = new HttpHelpers();
            HttpItems   item = new HttpItems();

            item.ProxyIp   = ProxyIp;
            item.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko";
            item.Cookie    = Cookie;
            item.URL       = Url;
            item.Timeout   = 15000;
            var hr = http.GetHtml(item);

            return(hr);
        }