Ejemplo n.º 1
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.º 2
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.º 3
0
 public static void PushProxy(object proxy)
 {
     ProxyStack.Push(proxy);
 }
Ejemplo n.º 4
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.º 5
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.º 6
0
        static void Main(string[] args)
        {
            //args = new string[] {
            //    "--create",
            //    "5000",
            //    "+79062532468",
            //    "3DVobv7Pf5TVWdy7fykuSdWscy3kTS4MvV"
            //};
            //args = new string[] { "--gettypebtcaddress" };

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
            ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;

            NetexSettings settings = new NetexSettings();

            settings.CreateIfNotExists();
            settings.LoadSettings();

            string USER_TOKEN = Guid.NewGuid().ToString();

            DB             db        = new DB();
            StorageModelDB storageDB = new StorageModelDB()
            {
                db = db
            }.MigrateUp();
            StorageModelREG storageREG = new StorageModelREG();

            EmailStorageModelDB emailStorageModel = new EmailStorageModelDB()
            {
                storageDB = storageDB
            };
            EmailStack emailStack = new EmailStack()
            {
                allowEmails = settings.allowEmails, emailStorageModel = emailStorageModel
            };
            EmailSender emailSender = new EmailSender()
            {
                settings = settings.email
            };

            //proxy list create
            const string           FILE_CREATE_PROXY       = "ProxyListForCreate.json";
            ProxyStorageModelMixed createProxyStorageModel = new ProxyStorageModelMixed(settings.registerKeyPrefix, settings.dbKeyPrefix, FILE_CREATE_PROXY)
            {
                storageDB = storageDB, storageREG = storageREG
            };
            ProxySettings createProxySettings = new ProxySettings(FILE_CREATE_PROXY)
            {
                createProxyStorageModel = createProxyStorageModel
            }.LoadSettings();
            ProxyStack createProxyStack = new ProxyStack()
            {
                settings = settings, emailSender = emailSender, proxySettings = createProxySettings, proxyStorageModel = createProxyStorageModel
            };

            //proxy list rate
            const string           FILE_RATE_PROXY       = "ProxyListForRate.json";
            ProxySettings          rateProxySettings     = new ProxySettings(FILE_RATE_PROXY).LoadSettings();
            ProxyStorageModelMixed rateProxyStorageModel = new ProxyStorageModelMixed(settings.registerKeyPrefix, settings.dbKeyPrefix, FILE_RATE_PROXY)
            {
                storageDB = storageDB, storageREG = storageREG
            };
            ProxyStack rateProxyStack = new ProxyStack()
            {
                settings = settings, emailSender = emailSender, proxySettings = rateProxySettings, proxyStorageModel = rateProxyStorageModel
            };

            //proxy list type addr
            const string           FILE_TYPEADDR_PROXY       = "ProxyListForGetTypeAddr.json";
            ProxySettings          typeaddrProxySettings     = new ProxySettings(FILE_TYPEADDR_PROXY).LoadSettings();
            ProxyStorageModelMixed typeaddrProxyStorageModel = new ProxyStorageModelMixed(settings.registerKeyPrefix, settings.dbKeyPrefix, FILE_TYPEADDR_PROXY)
            {
                storageDB = storageDB, storageREG = storageREG
            };
            ProxyStack typeaddrProxyStack = new ProxyStack()
            {
                settings = settings, emailSender = emailSender, proxySettings = typeaddrProxySettings, proxyStorageModel = typeaddrProxyStorageModel
            };

            try
            {
                if (args.Length == 0)
                {
                    Console.WriteLine(CheckCapcha(createProxyStack, settings));

                    Console.WriteLine("\n==========================================\n");
                    Console.WriteLine("Check proxy " + FILE_TYPEADDR_PROXY + ":");
                    CheckAllProxy(typeaddrProxyStack, typeaddrProxySettings, settings);

                    Console.WriteLine("\n==========================================\n");
                    Console.WriteLine("Check proxy " + FILE_CREATE_PROXY + ":");
                    CheckAllProxy(createProxyStack, createProxySettings, settings);

                    Console.ReadKey();
                    return;
                }

                //первым делом установи доступную валюту
                switch (args[ACTION_ID])
                {
                case "--rate":
                    Console.WriteLine(Rate(rateProxyStack.First(), settings));
                    break;

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

                    string phone   = PhoneHelper.PhoneReplacer(args[2]);
                    string btcAddr = args[3];

                    List <string> usedProxyList = new List <string>();
                    int           cntTry        = settings.maxTryReCreate;
                    do
                    {
                        try
                        {
                            NetexRequestPaymentResponseType response = Create(USER_TOKEN, emailStack, createProxyStack, settings, amount, phone, btcAddr, ref usedProxyList);
                            response.used_proxy_list = usedProxyList.ToArray();
                            Console.WriteLine(response.toJson());

                            if (WRITE_DEBUG)
                            {
                                Console.ReadKey();
                            }

                            return;
                        }
                        catch (Exception) { }
                    } while (--cntTry > 0);
                    break;

                case "--gettypebtcaddress":
                    if (typeaddrProxyStack.proxySettings.items.Count() == 0)
                    {
                        Console.WriteLine(
                            new GetTypeBtcAddressResponse()
                        {
                            btc_addresstype    = "",
                            target_currency_id = 106
                        }.toJson()
                            );

                        if (WRITE_DEBUG)
                        {
                            Console.ReadKey();
                        }
                        return;
                    }

                    Console.WriteLine(GetTypeBtcAddress(typeaddrProxyStack.First(), settings));
                    if (WRITE_DEBUG)
                    {
                        Console.ReadKey();
                    }
                    break;

                case "--getallowcurrenciesids":
                    Console.WriteLine(GetAllowCurrenciesIds(typeaddrProxyStack.First(), settings));

                    if (WRITE_DEBUG)
                    {
                        Console.ReadKey();
                    }
                    break;

                case "--checkallproxy":
                    CheckAllProxy(createProxyStack, createProxySettings, settings);

                    if (WRITE_DEBUG)
                    {
                        Console.ReadKey();
                    }
                    break;

                default:
                    if (args[ACTION_ID].Substring(args[ACTION_ID].Length - 4).Trim().ToLower() == ".txt")
                    {
                        AddNexProxy(args[ACTION_ID], createProxySettings);
                    }
                    break;
                }
            }
            catch (Exception ex) {
                if (TEST)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Ejemplo n.º 7
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.º 8
0
        /// <summary>
        ///     Method call wrapper that calls aspects and the intercepted method.
        /// </summary>
        /// <param name="actualMethodInvokerClosure">Intercepted method call wrapped in an interceptor's closure.</param>
        protected void ExecuteMainSequence(Action actualMethodInvokerClosure)
        {
            if (this.isUsed)
            {
                throw new Exception("Same instance of the call interceptor cannot be used more than once.");
            }

            this.isUsed = true;

            this.ReturnedValue            = null;
            this.MethodExecutionException = null;
            this.MethodWasCalled          = false;

            try
            {
#if DEBUG
                if (ProxyStack.Any())
                {
                    Debug.Assert(ProxyStack.Peek() != this);
                }
#endif
                ProxyStack.Push(this);

                try
                {
                    this.CheckForRequiredAspects();

                    this.Step_2_BeforeTryingMethodExec();

                    this.MethodWasCalled = true;

                    try
                    {
                        if (this.CancelInterceptedMethodCall)
                        {
                            // Returned result came from cache.
                            if (this.InterceptedMedthodCallFailed)
                            {
                                // Return cached exception.
                                this.Step_4_Optional_AfterCatchingMethodExecException();
                                throw this.MethodExecutionException;
                            }
                        }
                        else
                        {
                            // Retry loop
                            for (this.AttemptsMade = 1;; this.AttemptsMade++)
                            {
                                try
                                {
                                    actualMethodInvokerClosure.Invoke(); // Step 3 (post-call returned result massaging) is called inside this closure.

                                    this.Step_4_Optional_AfterSuccessfulCallCompletion();

                                    if (this.ShouldRetryCall)
                                    {
                                        this.ShouldRetryCall = false;
                                    }
                                    else
                                    {
                                        break; // success - break retry loop.
                                    }
                                }
                                catch (Exception ex)
                                {
                                    this.MethodExecutionException = ex;
                                    this.Step_4_Optional_AfterCatchingMethodExecException();

                                    if (this.ShouldRetryCall)
                                    {
                                        this.MethodExecutionException = null;
                                        this.ShouldRetryCall          = false;
                                    }
                                    else
                                    {
                                        // No more call attempts - break the retry loop.
                                        if (ex == this.MethodExecutionException)
                                        {
                                            throw;
                                        }

                                        throw this.MethodExecutionException;
                                    }
                                }
                            } // retry loop
                        }
                    }
                    finally
                    {
                        this.Step_5_FinallyAfterMethodExecution();
                    }
                }
                finally
                {
                    // Cleanup phase.
                    if (this.instanceCleanerFunc != null)
                    {
                        try
                        {
                            this.instanceCleanerFunc.Invoke(this.AugmentedClassInstance);
                            this.Step_6_Optional_AfterInstanceCleanup();
                        }
                        finally
                        {
                            if (this.AugmentedClassInstance is IInterceptionContext)
                            {
                                (this.AugmentedClassInstance as IInterceptionContext).Proxy = null;
                            }
                        }
                    }

                    this.Step_7_AfterEverythingSaidAndDone();
                }
            }
            finally
            {
                Proxy top = ProxyStack.Pop();
                Debug.Assert(top == this);
            }
        }