public string HttpGet(string action, int timeout = 0) { var request = (HttpWebRequest)WebRequest.Create(BASE_URL + action); if (timeout != 0) { request.Timeout = timeout; } request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; if (proxy != null) { request.Proxy = proxy.CreateProxyClient(); } var response = (HttpWebResponse)request.GetResponse(); return(new StreamReader(response.GetResponseStream()).ReadToEnd()); }
static Cache365RequestPaymentResponseType Create(double amount, string phone, string btcAddr, ProxySettingsItem proxy) { Random r = new Random(); Cash365 model = new Cash365(); if (proxy != null) { model.httpRequest.Proxy = proxy.CreateProxyClient(); } if (App.settings.cache365.accounts.Count() > 0) { var free = App.accountsStack.GetFree(); App.accountsStack.MarkBusy(free); bool isLogin = model.Login(free.login, free.passwrd); if (!isLogin) { throw new Exception("can`t login " + free.login); } Thread.Sleep( r.Next( App.settings.cache365.delay_after_login_from, App.settings.cache365.delay_after_login_to ) ); } string email = GenerateEmail(phone); App.actionsLog.Append(new ActionDataItem(phone, "GenerateEmail: " + email)); CreateTicketStruct created = model.CreateTicket(phone, amount, btcAddr, email); App.actionsLog.Append(new ActionDataItem(phone, "completed create ticket, try parse final page")); ParseFinalPage parser = new ParseFinalPage(created.content); var finalPage = new Cache365RequestPaymentResponseType() { account = created.qiwiNumber, btc_amount = parser.GetBtcAmount(), comment = parser.GetNumberTicket(), ip = proxy == null ? "" : proxy.ip, email = email }; App.actionsLog.Append(new ActionDataItem(phone, "Final page: " + finalPage.toJson())); return(finalPage); }
public bool CheckIsBanForever(ProxySettingsItem proxy, bool removeFromProxyJSON = true) { Leaf.xNet.HttpRequest http = new Leaf.xNet.HttpRequest(); http.UserAgentRandomize(); http.Proxy = proxy.CreateProxyClient(); bool isBan = false; try { http.ConnectTimeout = 3000; isBan = Helper.IsBanForever(http.Get(BASE_URL)); } catch (Exception ex) { isBan = true; } try { if (isBan && removeFromProxyJSON) { App.settings.proxy.Remove(proxy.ip, proxy.port); } } catch (Exception ex) { } return(isBan); }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("no args"); return; } Settings settings = new Settings() { data = SettingsData.Load(), proxyItems = ProxySettings.Load() }; DB db = new DB(); StorageModel storageModel = new StorageModel(db).MigrateUp(); EmailStorageModel emailStorageModel = new EmailStorageModel(storageModel); EmailStack emailStack = new EmailStack(emailStorageModel, settings.data.allowEmails); ProxyStorageModel proxyStorageModel = new ProxyStorageModel(storageModel); ProxySettingsItem proxy = null; KonvertImDriver driver = new KonvertImDriver(); switch (args[ACTION_ID]) { case "--create": for (int nTry = 0; nTry < settings.data.cntTryOnFault; nTry++) { try { if (settings.proxyItems != null) { ProxyStack proxyStack = new ProxyStack(settings.proxyItems, proxyStorageModel); while (--MAX_CNT_CHECK_PROXY > 0) { try { var tester = new KonvertImDriver(); proxy = proxyStack.Next(); tester.httpRequest.Proxy = proxy.CreateProxyClient(); if (tester.CheckIsWork()) { break; } else { proxy = null; } } catch (Exception) { } } } if (proxy != null) { driver.httpRequest.Proxy = proxy.CreateProxyClient(); } driver.LoadMainPage(); double amountRUB = MoneyHelper.ToDouble(args[1]); double amountBTC = amountRUB * (driver.GetRate() / 5000); string phone = PhoneHelper.PhoneReplacer(args[2]); string addressBTC = args[3]; string email = new String(phone.Where(Char.IsDigit).ToArray()) + emailStack.Next(); driver.Create(amountRUB, amountBTC, phone, addressBTC, email); string orderId; CreateResponseType response = driver.ParseFinalPage(out orderId); response.btc_amount = amountBTC.ToString(); response.email = KonvertImDriver.TICKET_URL.Replace("{order}", orderId); response.ip = proxy == null ? "local" : proxy.ip; if (!response.IsValid()) { throw new Exception(); } Console.Write(response.toJson()); return; } catch (Exception) { } } break; } }
static void Main(string[] args) { //args = "--create 5500 +79062614762 3DQjZmcaiCJ9sKCkLk1QZ9CdLv5btKzrHb".Split(' '); try { Settings settings = new Settings() { data = SettingsData.Load(), proxyItems = ProxySettings.Load() }; DB db = new DB(); StorageModel storageModel = new StorageModel(db).MigrateUp(); EmailStorageModel emailStorageModel = new EmailStorageModel(storageModel); EmailStack emailStack = new EmailStack(emailStorageModel, settings.data.allowEmails); ProxyStorageModel proxyStorageModel = new ProxyStorageModel(storageModel); ProxySettingsItem proxy = null; MineExchangeDriver driver = new MineExchangeDriver(); if (args.Length == 0) { Console.WriteLine("no args"); return; } switch (args[ACTION_ID]) { case "--rate": (double, double)rateList = driver.GetRate(); Console.WriteLine(new RateResponseType() { rate = rateList.Item1, balance = rateList.Item2 } .toJson()); break; case "--create": for (int nTry = 0; nTry < settings.data.cntTryOnFault; nTry++) { try { if (settings.proxyItems != null) { ProxyStack proxyStack = new ProxyStack(settings.proxyItems, proxyStorageModel); while (--MAX_CNT_CHECK_PROXY > 0) { try { var tester = new MineExchangeDriver(); proxy = proxyStack.Next(); tester.httpRequest.Proxy = proxy.CreateProxyClient(); if (tester.CheckIsWork()) { break; } else { proxy = null; } } catch (Exception) { } } } if (proxy != null) { driver.httpRequest.Proxy = proxy.CreateProxyClient(); } double amountRUB = MoneyHelper.ToDouble(args[1]); string phone = PhoneHelper.PhoneReplacer(args[2]); string addressBTC = args[3]; string email = new String( phone.Where(Char.IsDigit).ToArray() ) + emailStack.Next(); var urlCreate = driver.GetUrlForCreate(email, amountRUB, phone.Replace(" ", "").Replace("+", ""), addressBTC); double amountBTC = 0; var urlFianlPage = driver.GetUrlFinalPage(urlCreate, out amountBTC); var recvisits = driver.GetRecvisitsOnFinalPage(urlFianlPage); RequestPaymentResponseType response = new RequestPaymentResponseType() { account = PhoneHelper.PhoneReplacer(recvisits.extra_account), comment = recvisits.extra_comment, email = email, btc_amount = amountBTC, ip = proxy == null ? "local" : proxy.ip }; if (!response.IsValid()) { throw new Exception(); } Console.WriteLine(response.toJson()); return; } catch (Exception) { } } break; } } catch (Exception) { } }