예제 #1
0
파일: Form1.cs 프로젝트: lang315/lazada
        void RunJOB(Account account, string port, string userAgent)
        {
            HttpRequest request    = new HttpRequest();
            var         configXNet = new ConfigXNet();

            configXNet.AddUserAgent(ref request, userAgent);
            var login = new LoginAccount();

            if (login.IsSuccessful(ref request, account))
            {
                foreach (var item in _listLinkProducts)
                {
                    string linkProduct = item;
                    if (linkProduct.Contains("?"))
                    {
                        linkProduct = linkProduct.Split('?')[0];
                    }
                    var product  = new Product(linkProduct);
                    var interact = new InteractProduct(product);
                    interact.ViewProduct(ref request, linkProduct);
                    interact.AddToWishList(ref request);
                }
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: lang315/lazada
        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;
            }
        }