Example #1
0
        //bool Login(Account account, ref HttpRequest request, string port, string useAgent)
        //{

        //    SettingsRequest(ref request, useAgent);

        //    string html = request.Get("https://www.lazada.vn/customer/account/login/").ToString();
        //    var info = new ProductInfo(html);
        //    request.AddParam("FORM_TOKEN", info.FormToken());
        //    request.AddParam("referer", "https://www.lazada.vn/");
        //    request.AddParam("LoginForm[email]", account.Email);
        //    request.AddParam("LoginForm[password]", account.Password);
        //    Thread.Sleep(THREAD_SLEEP_FAST);
        //    html = request.Post("https://www.lazada.vn/customer/account/login/").ToString();
        //    html = request.Get("https://www.lazada.vn/customer/account/").ToString();
        //    if (html.Contains("Quản lý tài khoản"))
        //        return true;
        //    return false;

        //}

        void JobRegister(Account account, string port, string userAgent)
        {
            HttpRequest request    = new HttpRequest();
            var         configXNet = new ConfigXNet();

            configXNet.AddUserAgent(ref request, userAgent);

            try
            {
                using (var client = new SshClient(account.IP, 22, account.UsernameIP, account.PasswordIP))
                {
                    // timeout 30s
                    client.ConnectionInfo.Timeout = TimeSpan.FromSeconds(25);
                    client.ErrorOccurred         += (se, ev) => { };
                    client.KeepAliveInterval      = TimeSpan.FromSeconds(60);
                    client.Connect();

                    if (client.IsConnected)
                    {
                        var forwarder = new ForwardedPortDynamic("127.0.0.1", Convert.ToUInt32(port));
                        forwarder.Exception += (se, ev) => { };
                        client.AddForwardedPort(forwarder);

                        forwarder.Start();
                        request.Proxy = HttpProxyClient.Parse(ProxyType.Socks5, "127.0.0.1:" + port);

                        var register = new RegisterAccount();

                        if (register.IsSuccessful(ref request, account))
                        {
                            lock (_randomAccountObj)
                            {
                                _randomAccount--;
                                var export = new ExportResult();
                                export.FileResult(_fileResultPath, account);
                                rtxtResult.Text += account.Email + " | " + account.Password + Environment.NewLine;
                            }

                            InteractProducts(ref request, account);

                            //Debug.WriteLine(account.Email, "Xong");
                        }
                        else
                        {
                            //Debug.WriteLine(account.Email, "Lỗi");
                            var export = new ExportResult();
                            lock (_fileErrorObj)
                                export.FileResult(_fileErrorPath, account);
                        }
                    }
                    else
                    {
                        //Debug.WriteLine(account.Email, "Lỗi SSH");
                        var export = new ExportResult();
                        lock (_fileErrorObj)
                            export.FileResult(_fileErrorPath, account);
                    }
                }
            }
            catch
            {
                //Debug.WriteLine(account.Email, "Lỗi SSH");
                var export = new ExportResult();
                lock (_fileErrorObj)
                    export.FileResult(_fileErrorPath, account);
            }
        }
Example #2
0
        private void JobSettings()
        {
            btnStart.Enabled = false;

            if (chkOnlyLike.Checked)
            {
                _onlyLikeProduct = true;
            }
            else
            {
                _onlyLikeProduct = false;
            }

            if (chkRemoveProduct.Checked)
            {
                _removeProduct = true;
            }
            else
            {
                _removeProduct = false;
            }

            if (!SaveSetting())
            {
                btnStart.Enabled    = true;
                grpSettings.Enabled = true;
                btnStart.Text       = "Start";
                return;
            }

            if (_isRunning)
            {
                _isRunning    = false;
                btnStart.Text = "Waiting";
                return;
            }
            else
            {
                rtxtResult.Text = "";
            }

            _isRunning          = true;
            btnStart.Text       = "Stop";
            btnStart.Enabled    = true;
            grpSettings.Enabled = false;

            _randomAccountMin = Convert.ToInt32(nudMinAccount.Value);
            _randomAccountMax = Convert.ToInt32(nudMaxAccount.Value);
            _timeSleepMin     = Convert.ToInt32(nudTimeMin.Value);
            _timeSleepMax     = Convert.ToInt32(nudTimeMax.Value);
            _countThreads     = Convert.ToInt32(nudCountThreads.Value);

            if (!GenerateAccountQueue())
            {
                MessageBox.Show("Lỗi, file account đang mở!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnStart.Enabled    = true;
                grpSettings.Enabled = true;
                btnStart.Text       = "Start";
                return;
            }

            if (!GenerateListLinkProducts())
            {
                MessageBox.Show("Lỗi file Link sản phẩm!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnStart.Enabled    = true;
                grpSettings.Enabled = true;
                btnStart.Text       = "Start";
                return;
            }

            GenerateListUseAgent();
            GenerateListLinkRef();

            var export = new ExportResult();

            if (!_onlyLikeProduct)
            {
                _fileResultPath = "Register Result " + DateTime.Now.ToShortDateString().Replace(@"/", "") + ".xlsx";
                _fileErrorPath  = "Register Error " + DateTime.Now.ToShortDateString().Replace(@"/", "") + ".xlsx";
                export.CreateFile(_fileResultPath);
                export.CreateFile(_fileErrorPath);
            }
            else
            {
                _fileResultPath = "Login Result " + DateTime.Now.ToShortDateString().Replace(@"/", "") + ".xlsx";
                _fileErrorPath  = "Login Error " + DateTime.Now.ToShortDateString().Replace(@"/", "") + ".xlsx";
                export.CreateFile(_fileErrorPath);
            }

            _port          = 0;
            _randomAccount = 0;
        }
Example #3
0
        void JobLikeProduct(Account account, string port, string userAgent)
        {
            HttpRequest request    = new HttpRequest();
            var         configXNet = new ConfigXNet();

            configXNet.AddUserAgent(ref request, userAgent);

            try
            {
                using (var client = new SshClient(account.IP, 22, account.UsernameIP, account.PasswordIP))
                {
                    // timeout 30s
                    client.ConnectionInfo.Timeout = TimeSpan.FromSeconds(25);
                    client.ErrorOccurred         += (se, ev) => { };
                    client.KeepAliveInterval      = TimeSpan.FromSeconds(60);
                    client.Connect();

                    if (client.IsConnected)
                    {
                        var forwarder = new ForwardedPortDynamic("127.0.0.1", Convert.ToUInt32(port));
                        forwarder.Exception += (se, ev) => { };
                        client.AddForwardedPort(forwarder);

                        forwarder.Start();
                        request.Proxy = HttpProxyClient.Parse(ProxyType.Socks5, "127.0.0.1:" + port);

                        var login = new LoginAccount();

                        if (login.IsSuccessful(ref request, account))
                        {
                            if (_removeProduct)
                            {
                                var remove = new RemoveProduct();
                                remove.Remove(ref request);
                            }

                            lock (_fileResultObj)
                            {
                                _randomAccount--;
                                rtxtResult.Text += account.Email + " | " + account.Password + Environment.NewLine;
                            }

                            InteractProducts(ref request, account);
                        }
                        else
                        {
                            var export = new ExportResult();
                            lock (_fileErrorObj)
                            {
                                export.FileResult(_fileErrorPath, account);
                                rtxtResult.Text += account.Email + " | " + account.Password + " | Lỗi không đăng nhập được" + Environment.NewLine;
                            }
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch
            {
                var export = new ExportResult();
                lock (_fileErrorObj)
                {
                    export.FileResult(_fileErrorPath, account);
                    rtxtResult.Text += account.Email + " | " + account.Password + " | Lỗi không đăng nhập được" + Environment.NewLine;
                }
                return;
            }
        }