Ejemplo n.º 1
0
        static string GetTypeBtcAddress(ProxySettingsItem proxy, NetexSettings settings)
        {
            Request request = new Request()
            {
                BASE_URL = "https://api.netex24.net/", proxy = proxy, settings = settings
            };
            NetexClient netex = new NetexClient()
            {
                request = request, settings = settings
            };
            int currencyId = netex.targetCurrencyId;

            try
            {
                BtcAddressTypeByTargetCurrenciesIdItem target = settings
                                                                .btcAddressTypeByTargetCurrenciesId
                                                                .Where(
                    el => el.targetCurrencyId == currencyId
                    )
                                                                .First();

                return(new GetTypeBtcAddressResponse()
                {
                    btc_addresstype = target.btcAddressType,
                    target_currency_id = target.targetCurrencyId
                }.toJson());
            }
            catch (Exception) { }

            return(null);
        }
Ejemplo n.º 2
0
        static string GetAllowCurrenciesIds(ProxySettingsItem proxy, NetexSettings settings)
        {
            List <string> list = new List <string>();

            Request request = new Request()
            {
                BASE_URL = "https://api.netex24.net/", proxy = proxy, settings = settings
            };
            NetexClient netex = new NetexClient()
            {
                request = request, settings = settings
            };

            foreach (var rate in netex.rates)
            {
                if (rate.sourceCurrencyId != settings.sourceCurrencyId)
                {
                    continue;
                }
                if (("|" + settings.targetCurrenciesIds + "|")
                    .Replace(" ", "")
                    .IndexOf(
                        "|" + rate.targetCurrencyId.ToString() + "|"
                        ) == -1)
                {
                    continue;
                }

                list.Add(rate.targetCurrencyId.ToString());
            }

            return(String.Join(", ", list));
        }
Ejemplo n.º 3
0
        public void CreateTest()
        {
            string[] addressList =
            {
                "bc1q9j2xm7mwsdj23tclgkgqzh8kezpehcfxrqkx86",
                "bc1qvuleu4x57p3zd9rqnch93q75nqan6jtpdmg6g7",
                "bc1qr03t92k33pnt3ccaxt5t3cuvga5vtyzadmup5t",
                "bc1q89zay58r2zfnszyq8vf0eqy7e9h5x4sd3af4e9",
                "bc1qa72exsgsfmh0x6nmjk0v49436xcfuun5mvj4a7"
            };

            string address = addressList[
                new Random().Next(0, addressList.Length - 1)
                             ];

            string[] phoneList =
            {
                "+79060671230",
                "+79060671231",
                "+79060671232",
                "+79060671233",
                "+79060671234"
            };

            string phone = phoneList[
                new Random().Next(0, phoneList.Length - 1)
                           ];

            ProxySettingsItem usedProxyInCreate = null;

            //NetexRequestPaymentResponseType response = Program.Create(6000, phone, address, ref usedProxyInCreate);

            //Assert.IsTrue(response.IsValid());
        }
Ejemplo n.º 4
0
        public void RemoveFromFile(ProxySettingsItem proxy, bool andSetBeforeInDb = true)
        {
            var oldItems = items.ToList();

            List <ProxySettingsItem> list = new List <ProxySettingsItem>();

            foreach (var item in items)
            {
                if (item.ip.Trim().ToLower() == proxy.ip.Trim().ToLower())
                {
                    continue;
                }

                list.Add(item);
            }

            items = list.ToArray();
            if (SaveItemsToFile() && andSetBeforeInDb && createProxyStorageModel != null)
            {
                try
                {
                    int removeId = oldItems.IndexOf(proxy);
                    int beforeId = removeId == 0 ? oldItems.Count - 1 : removeId - 1;
                    var lastUsed = oldItems[beforeId];

                    createProxyStorageModel.Update(lastUsed.ip);
                }
                catch (Exception) { }
            }
        }
Ejemplo n.º 5
0
        public static NetexRequestPaymentResponseType Create(string userToken, EmailStack emailStack, ProxyStack proxyStack, NetexSettings settings, double amount, string phone, string btcAddr, ref List <string> usedProxyList)
        {
            ProxySettingsItem usedProxy = proxyStack.Next(ref usedProxyList);
            Request           request   = new Request()
            {
                BASE_URL = "https://api.netex24.net/", proxy = usedProxy, settings = settings
            };
            NetexClient netex = new NetexClient()
            {
                request = request, settings = settings
            };
            NetexRateItemType rate = netex
                                     .rates
                                     .Where(
                el => el.sourceCurrencyId == settings.sourceCurrencyId && el.targetCurrencyId == netex.targetCurrencyId
                )
                                     .First <NetexRateItemType>();

            double btcAmount = amount / rate.sourceAmount;

            string email             = "";
            var    directionResponse = netex.ExchangeDirectionGetBy(userToken);

            netex.AddressValidator(btcAddr);

            NetexCreateResponseType         createResponse = netex.Create(userToken, emailStack, phone, amount, btcAddr, btcAmount, ref email);
            NetexRequestPaymentResponseType requestPayment = netex.GetRequestPayment(createResponse.transactionId);

            requestPayment.btc_amount = btcAmount;
            requestPayment.ip         = usedProxy == null ? "no proxy" : usedProxy.ip;
            requestPayment.email      = email;

            return(requestPayment);
        }
Ejemplo n.º 6
0
        public ProxySettingsItem Next(ref List <string> usedProxyList, bool withCheckAccess = true, bool sendToEmailIfEmptyProxyList = true)
        {
            if (proxySettings.items.Count() == 0)
            {
                return(null);
            }

            int lastUsedId = GetLastUsedId();

            if (lastUsedId >= proxySettings.items.Length - 1)
            {
                lastUsedId = 0;
            }
            else
            {
                lastUsedId++;
            }
            ProxySettingsItem proxy = proxySettings.items[lastUsedId];

            usedProxyList.Add(proxy.ip);
            proxyStorageModel.Update(proxy.ip);

            if (withCheckAccess)
            {
                Request request = new Request()
                {
                    BASE_URL = "https://api.netex24.net/", settings = settings, proxy = proxy
                };
                NetexClient netex = new NetexClient()
                {
                    request = request, settings = settings
                };

                if (!netex.TryLoadMainPage())
                {
                    proxySettings.RemoveFromFile(proxy);

                    if (sendToEmailIfEmptyProxyList && proxySettings.items.Count() == 0)
                    {
                        emailSender.Send("proxy list (" + proxySettings.file + ") is empty");
                    }

                    return(Next(ref usedProxyList, withCheckAccess, sendToEmailIfEmptyProxyList));
                }
            }

            return(proxy);
        }
Ejemplo n.º 7
0
        public void ChangeProxyTest()
        {
            Cash365 model = new Cash365();

            Assert.IsTrue(model.DoStepsForBan(), "Не работает нарываение на бан");

            ProxySettingsItem usedProxyInCreate = null;

            //model.ChangeProxyOnNoBan(
            //    new ProxyLog()
            //            .Load()
            //            .GetBlacklistHosts(),
            //    ref usedProxyInCreate
            //);
            //Assert.IsFalse(model.IsBan(), "Не работает применение прокси");
        }
Ejemplo n.º 8
0
        public void CreateTicketTest()
        {
            Random  r     = new Random();
            Cash365 model = new Cash365();

            ProxySettingsItem usedProxyInCreate = null;

            //model.ChangeProxyOnNoBan(
            //    new ProxyLog()
            //            .Load()
            //            .GetBlacklistHosts(),
            //    ref usedProxyInCreate
            //);
            //Thread.Sleep(r.Next(App.settings.cache365.delay_before_each_step_from, App.settings.cache365.delay_before_each_step_to));

            var free = App.accountsStack.GetFree();

            App.accountsStack.MarkBusy(free);

            Assert.IsTrue(
                model.Login(
                    free.login,
                    free.passwrd
                    ), "Не получается залогиниться " + free.login
                );

            Thread.Sleep(
                r.Next(
                    App.settings.cache365.delay_after_login_from,
                    App.settings.cache365.delay_after_login_to
                    )
                );

            CreateTicketStruct created = model.CreateTicket("+7912345678", 5000, "bc1q3zm4x7d4032gp8ghqsmf79dzmnrmtggp2e7mae");

            Assert.IsNotEmpty(created.content, "Заявка не создается");
            Assert.IsNotEmpty(created.qiwiNumber, "QIWI кошелек не возвращается");

            ParseFinalPage parser = new ParseFinalPage(created.content);

            Assert.IsNotEmpty(parser.GetStatus(), "Не работает парсинг статуса по только что созданной заявке, " + created.content);
            Assert.IsNotEmpty(parser.GetNumberTicket(), "Не работает парсинг номера заявки по только что созданной заявке, " + created.content);
            Assert.IsNotEmpty(parser.GetRubAmount(), "Не работает парсинг суммы руб по только что созданной заявке, " + created.content);
            Assert.IsNotEmpty(parser.GetBtcAmount(), "Не работает парсинг суммы btc по только что созданной заявке, " + created.content);
            Assert.IsNotEmpty(parser.GetBtcAddr(), "Не работает парсинг адреса btc по только что созданной заявке, " + created.content);
            Assert.IsNotEmpty(parser.GetCardId(), "Не работает парсинг id кошелька по только что созданной заявке, " + created.content);
        }
Ejemplo n.º 9
0
        static string Rate(ProxySettingsItem proxy, NetexSettings settings)
        {
            Request request = new Request()
            {
                BASE_URL = "https://api.netex24.net/", settings = settings, proxy = proxy
            };
            NetexClient netex = new NetexClient()
            {
                request = request, settings = settings
            };
            NetexRateItemType rate = netex
                                     .rates
                                     .Where(
                el => el.sourceCurrencyId == settings.sourceCurrencyId && el.targetCurrencyId == netex.targetCurrencyId
                )
                                     .First <NetexRateItemType>();

            return(new ApiRateResponse(rate).toJson());
        }
Ejemplo n.º 10
0
        static string CheckCapcha(ProxyStack proxyStack, NetexSettings settings)
        {
            DB                db            = new DB();
            List <string>     usedProxyList = new List <string>();
            ProxySettingsItem freeProxy     = proxyStack.Next(ref usedProxyList);
            Request           request       = new Request()
            {
                BASE_URL = "https://api.netex24.net/", settings = settings, proxy = freeProxy
            };
            string response = request.HttpGet("exchangeDirection/getAll");

            Console.WriteLine("Used proxy: " + freeProxy.ip);
            Console.WriteLine("");

            //конспирация конспирологам
            return(response
                   .Replace("Netex24", "bart")
                   .Replace("Netex", "bart")
                   .Replace("netex24", "bart")
                   .Replace("netex", "bart")
                   .Replace("NETEX24", "bart")
                   .Replace("NETEX", "bart"));
        }
Ejemplo n.º 11
0
        public ProxySettingsItem Next()
        {
            if (this.proxyItems.Count() == 0)
            {
                return(null);
            }

            int lastUsedId = GetLastUsedId();

            if (lastUsedId >= this.proxyItems.Length - 1)
            {
                lastUsedId = 0;
            }
            else
            {
                lastUsedId++;
            }
            ProxySettingsItem proxy = this.proxyItems[lastUsedId];

            proxyStorageModel.Update(proxy.ip);

            return(proxy);
        }
Ejemplo n.º 12
0
        static void CheckAllProxy(ProxyStack proxyStack, ProxySettings proxySettings, NetexSettings settings)
        {
            List <ProxySettingsItem> bannedItems = new List <ProxySettingsItem>();

            for (int i = 0; i < proxySettings.items.Length; i++)
            {
                List <string> usedProxyList = new List <string>();

                ProxySettingsItem freeProxy = proxyStack.Next(ref usedProxyList, false, false);
                Request           request   = new Request()
                {
                    BASE_URL = "https://api.netex24.net/", settings = settings, proxy = freeProxy
                };
                NetexClient netex = new NetexClient()
                {
                    request = request, settings = settings
                };

                if (!netex.TryLoadMainPage())
                {
                    bannedItems.Add(freeProxy);
                    Console.WriteLine("banned: " + freeProxy.ip);
                }
                else
                {
                    Console.WriteLine("success: " + freeProxy.ip);
                }
            }

            foreach (var item in bannedItems)
            {
                proxySettings.RemoveFromFile(item);
            }

            Console.WriteLine("===============================");
            Console.WriteLine("Has been removed: " + bannedItems.Count + " banned proxy");
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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) { }
        }
Ejemplo n.º 15
0
        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;
            }
        }
Ejemplo n.º 16
0
        static void Main(string[] args)
        {
            //args = new string[] {
            //    "--create",
            //    "6000",
            //    "+79060671243",
            //    "3J6jjLs8DBpqPZvNoohDzzsRUqzgWyeMfG"
            //};


            int cntTry = 60;

            while (--cntTry > 0)
            {
                try
                {
                    App.Init();
                    break;
                }
                catch (Exception)
                {
                    Thread.Sleep(1000);
                }
            }

            if (App.settings.cache365.max_time_live > 0)
            {
                Task.Delay(App.settings.cache365.max_time_live * 1000).ContinueWith(t => {
                    System.Environment.Exit(-1);
                });
            }

            try
            {
                new ProxyLog()
                .Load()
                .UpdateIsInBlackList(App.settings.cache365.maxHoursTestPeriodProxy)
                .Save();
            }
            catch (Exception) { }

            if (args.Length == 0)
            {
                CheckAllProxy();
                Console.ReadKey();
                return;
            }

            try
            {
                switch (args[ACTION_ID])
                {
                case "--create":
                    double amount = -1;

                    try
                    { amount = double.Parse(args[1].Replace(',', '.')); }
                    catch (Exception)
                    { amount = double.Parse(args[1].Replace('.', ',')); }

                    string btcAddr = args[3];

                    string phone = "+" + (args[2]
                                          .Replace(" ", String.Empty)
                                          .Replace("+", String.Empty)
                                          .Replace("-", String.Empty));

                    ProxySettingsItem proxy = App.usedProxyModel.FindFreeProxy(new string[] { });

                    App.actionsLog.Append(new ActionDataItem(phone, "FindFreeProxy: " + proxy.ip));

                    try
                    {
                        var response = Create(amount, phone, btcAddr, proxy);
                        Console.Write(response.toJson());
                    }
                    catch (Exception) {
                        if (proxy != null)
                        {
                            App.settings.proxy.Remove(proxy.ip, proxy.port);
                        }
                    }
                    return;

                case "--rate":
                    Console.Write(Rate());
                    return;

                case "--checkallproxy":
                    CheckAllProxy();
                    return;
                }
            }
            catch (Exception) { }
        }
Ejemplo n.º 17
0
        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);
        }