Exemple #1
0
        private string GetAnswer(string key)
        {
            using (var client = new WebClient())
            {
                client.DownloadFile($"https://ext.captcha.yandex.net/image?key={key}", "captcha.jpg");
            }

            Rucaptcha.Key = "80772be92ec6b923a46970078c3ec829";
            var cap = Rucaptcha.Recognize("captcha.jpg");

            return(cap);
        }
Exemple #2
0
        public string Auth(long captcha_sid, string captcha_key, string pass, string log, int i, VkApi vk, string capkey)
        {
            try
            {
                ulong    appId = 2685278;      // указываем id приложения
                string   email = log;          // email для авторизации
                string   passa = pass;         // пароль для авторизации
                Settings scope = Settings.All; // уровень доступа к данным

                if (captcha_sid != 0 && captcha_key != "")
                {
                    DateTime dy      = DateTime.Now;
                    string   Textzy  = string.Format("{0:t}", dy);
                    string   Timey   = Textzy.ToString();
                    Action   actiony = () =>
                    {
                        richTextBoxAccz.Text += "\n[" + Timey + "] Капча решена. Текущий баланс на рукапче: " + Rucaptcha.Balance() + " руб.\n";
                    };
                    Invoke(actiony);

                    vk.Authorize(new ApiAuthParams
                    {
                        ApplicationId = appId,
                        Login         = email,
                        Password      = passa,
                        Settings      = scope,
                        CaptchaSid    = captcha_sid,
                        CaptchaKey    = captcha_key
                    });
                }
                else
                {
                    CountOfGr = 0;
                    vk.Authorize(new ApiAuthParams
                    {
                        ApplicationId = appId,
                        Login         = email,
                        Password      = passa,
                        Settings      = scope,
                    });
                }

                if (Convert.ToInt32(i + 1) == 2)
                {
                    DateTime d      = DateTime.Now;
                    string   Textz  = string.Format("{0:t}", d);
                    string   Time   = Textz.ToString();
                    Action   action = () =>
                    {
                        richTextBoxAccz.Text += "\n[" + Time + "] Выполнен вход во " + Convert.ToInt32(i + 1) + " аккаунт, с логином: " + log + ".\n";
                    };
                    Invoke(action);
                }
                else
                {
                    DateTime d      = DateTime.Now;
                    string   Textz  = string.Format("{0:t}", d);
                    string   Time   = Textz.ToString();
                    Action   action = () =>
                    {
                        richTextBoxAccz.Text += "\n[" + Time + "] Выполнен вход в " + Convert.ToInt32(i + 1) + " аккаунт, с логином: " + log + ".\n";
                    };
                    Invoke(action);
                }
                return("ok");
            }
            catch (VkNet.Exception.CaptchaNeededException cEx)
            {
                DateTime d      = DateTime.Now;
                string   Textz  = string.Format("{0:t}", d);
                string   Time   = Textz.ToString();
                Action   action = () =>
                {
                    richTextBoxAccz.Text += "\n[" + Time + "] Попалась капча.\n";
                };
                //рагад, получение капча кей
                Rucaptcha.Key = capkey;
                long   captcha_sida = cEx.Sid;
                string captcha_url  = cEx.Img.ToString();
                string captchaPath  = Rucaptcha.Download_Captcha(captcha_url);
                string captcha_keya = Rucaptcha.Recognize(captchaPath);
                Auth(captcha_sida, captcha_keya, pass, log, i, vk, capkey);
                return("bad");
            }
        }
Exemple #3
0
        public string Message(string[] lines2, int k, long captcha_sid, string captcha_key, bool prove, long id, string texta, VkApi vk, string capkey, string text4, bool check1, string[] lines3, decimal num1)
        {
            try

            {
                if (check1 == true && text4 != "" && num1 == 1)
                {
                    secondVowelP = (new Regex(@"^photo[0-9]{4,13}_[0-9]{4,13}$").IsMatch(lines3[l]));
                    secondVowelM = (new Regex(@"^photo[0-9]{4,13}_[0-9]{4,13}$").IsMatch(lines3[l]));

                    if (!(lines3.Length >= 1) && (!secondVowelM || !secondVowelP)) //добавить проверку на ID Регулярным выражением
                    {
                        DateTime dy      = DateTime.Now;
                        string   Textzy  = string.Format("{0:t}", dy);
                        string   Timey   = Textzy.ToString();
                        Action   actiony = () =>
                        {
                            richTextBoxAccz.Text += "\n[" + Timey + "] Картинка не размещена, введен неверный формат.\n";
                        };
                        Invoke(actiony);
                    }
                    else
                    {
                        lines3[l] = lines3[l].Replace(" ", "");
                        var  ph     = lines3[l].Replace("photo", "");
                        var  zasada = ph.Split('_');
                        long pervuy = long.Parse(zasada[0]);
                        long vtoroy = long.Parse(zasada[1]);

                        if (captcha_sid != 0 && captcha_key != "")
                        {
                            DateTime dy      = DateTime.Now;
                            string   Textzy  = string.Format("{0:t}", dy);
                            string   Timey   = Textzy.ToString();
                            Action   actiony = () =>
                            {
                                richTextBoxAccz.Text += "\n[" + Timey + "] Капча решена. Текущий баланс на рукапче: " + Rucaptcha.Balance() + " руб.\n";
                            };
                            Invoke(actiony);

                            var attachment = new List <MediaAttachment>();
                            var media      = new Photo();
                            media.OwnerId = pervuy;
                            media.Id      = vtoroy;
                            attachment.Add(media);

                            var post = vk.Wall.Post(new WallPostParams
                            {
                                OwnerId     = -id,
                                FromGroup   = prove,
                                Message     = texta,
                                Attachments = attachment,
                                CaptchaSid  = captcha_sid,
                                CaptchaKey  = captcha_key
                            });
                            l++;
                        }
                        else
                        {
                            var attachment = new List <MediaAttachment>();
                            var media      = new Photo();
                            media.OwnerId = pervuy;
                            media.Id      = vtoroy;
                            attachment.Add(media);

                            var post = vk.Wall.Post(new WallPostParams
                            {
                                OwnerId     = -id,
                                FromGroup   = prove,
                                Message     = texta,
                                Attachments = attachment
                            });
                            l++;
                        }
                    }
                }


                else if (check1 == true && text4 != "" && num1 == 2 && lines3.Length >= 2)
                {
                    secondVowelP = (new Regex(@"^photo[0-9]{4,13}_[0-9]{4,13}$").IsMatch(lines3[l]));
                    secondVowelM = (new Regex(@"^photo-[0-9]{4,13}_[0-9]{4,13}$").IsMatch(lines3[l]));

                    if (!secondVowelM || !secondVowelP) //добавить проверку на ID егулярным выражением
                    {
                        DateTime dy      = DateTime.Now;
                        string   Textzy  = string.Format("{0:t}", dy);
                        string   Timey   = Textzy.ToString();
                        Action   actiony = () =>
                        {
                            richTextBoxAccz.Text += "\n[" + Timey + "] Картинка не размещена, введен неверный формат.\n";
                        };
                        Invoke(actiony);
                    }
                    else
                    {
                        string pha;
                        lines3[l] = lines3[l].Replace(" ", "");
                        var  ph     = lines3[l].Replace("photo", "");
                        var  zasada = ph.Split('_');
                        long pervuy = long.Parse(zasada[0]);
                        long vtoroy = long.Parse(zasada[1]);
                        if (l == lines3.Length - 1)
                        {
                            lines3[0] = lines3[0].Replace(" ", "");
                            pha       = lines3[0].Replace("photo", "");
                        }
                        else
                        {
                            lines3[Convert.ToInt32(l + 1)] = lines3[Convert.ToInt32(l + 1)].Replace(" ", "");
                            pha = lines3[Convert.ToInt32(l + 1)].Replace("photo", "");
                        }
                        var  zasada2 = pha.Split('_');
                        long pervuy2 = long.Parse(zasada2[0]);
                        long vtoroy2 = long.Parse(zasada2[1]);


                        if (captcha_sid != 0 && captcha_key != "")
                        {
                            DateTime dy      = DateTime.Now;
                            string   Textzy  = string.Format("{0:t}", dy);
                            string   Timey   = Textzy.ToString();
                            Action   actiony = () =>
                            {
                                richTextBoxAccz.Text += "\n[" + Timey + "] Капча решена. Текущий баланс на рукапче: " + Rucaptcha.Balance() + " руб.\n";
                            };
                            Invoke(actiony);

                            var attachment = new List <MediaAttachment>();
                            var media      = new Photo();
                            media.OwnerId = pervuy;
                            media.Id      = vtoroy;
                            attachment.Add(media);

                            var media2 = new Photo();
                            media2.OwnerId = pervuy2;
                            media2.Id      = vtoroy2;
                            attachment.Add(media2);

                            var post = vk.Wall.Post(new WallPostParams
                            {
                                OwnerId     = -id,
                                FromGroup   = prove,
                                Message     = texta,
                                Attachments = attachment,
                                CaptchaSid  = captcha_sid,
                                CaptchaKey  = captcha_key
                            });
                            l += 2;
                        }
                        else
                        {
                            var attachment = new List <MediaAttachment>();
                            var media      = new Photo();
                            media.OwnerId = pervuy;
                            media.Id      = vtoroy;
                            attachment.Add(media);

                            var media2 = new Photo();
                            media2.OwnerId = pervuy2;
                            media2.Id      = vtoroy2;
                            attachment.Add(media2);

                            var post = vk.Wall.Post(new WallPostParams
                            {
                                OwnerId     = -id,
                                FromGroup   = prove,
                                Message     = texta,
                                Attachments = attachment
                            });

                            l += 2;
                        }
                    }
                }

                else
                {
                    if (captcha_sid != 0 && captcha_key != "")
                    {
                        DateTime dy      = DateTime.Now;
                        string   Textzy  = string.Format("{0:t}", dy);
                        string   Timey   = Textzy.ToString();
                        Action   actiony = () =>
                        {
                            richTextBoxAccz.Text += "\n[" + Timey + "] Капча решена. Текущий баланс на рукапче: " + Rucaptcha.Balance() + " руб.\n";
                        };
                        Invoke(actiony);


                        var post = vk.Wall.Post(new WallPostParams
                        {
                            OwnerId    = -id,
                            FromGroup  = prove,
                            Message    = texta,
                            CaptchaSid = captcha_sid,
                            CaptchaKey = captcha_key
                        });
                    }
                    else
                    {
                        var post = vk.Wall.Post(new WallPostParams
                        {
                            OwnerId   = -id,
                            FromGroup = prove,
                            Message   = texta
                        });
                    }
                }


                CountOfGr++;
                DateTime di      = DateTime.Now;
                string   Textza  = string.Format("{0:t}", di);
                string   Timea   = Textza.ToString();
                Action   action2 = () =>
                {
                    richTextBoxAccz.Text += "\n[" + Timea + "] Оставлена запись в сообществе: " + lines2[k].Replace("https://", "") + ".\n";
                };
                Invoke(action2);
                if (!(lines2.Length == CountOfGr))
                {
                    DateTime diz      = DateTime.Now;
                    string   Textzaza = string.Format("{0:t}", diz);
                    string   Timeaza  = Textzaza.ToString();
                    Action   actionza = () =>
                    {
                        var numa = numericUpDown2.Value.ToString();
                        if (numa[numa.Length - 1] == '1')
                        {
                            richTextBoxAccz.Text += "\n[" + Timeaza + "] Пауза: " + numericUpDown2.Value + " секунду.\n";
                        }
                        else if (numa[numa.Length - 1] == '2' || numa[numa.Length - 1] == '3' || numa[numa.Length - 1] == '4')
                        {
                            richTextBoxAccz.Text += "\n[" + Timeaza + "] Пауза: " + numericUpDown2.Value + " секунды.\n";
                        }
                        else if (numa[numa.Length - 1] == '0' || numa[numa.Length - 1] == '5' || numa[numa.Length - 1] == '6' || numa[numa.Length - 1] == '7' || numa[numa.Length - 1] == '8' || numa[numa.Length - 1] == '9')
                        {
                            richTextBoxAccz.Text += "\n[" + Timeaza + "] Пауза: " + numericUpDown2.Value + " секунд.\n";
                        }
                    };
                    Invoke(actionza);

                    for (int tima = 1; tima <= numericUpDown2.Value; tima++)
                    {
                        if (!thread_stop)
                        {
                            Thread.Sleep(Convert.ToInt32(1000));
                        }
                        else if (thread_stop)
                        {
                            break;
                        }
                    }
                }
            }
            catch (VkNet.Exception.CaptchaNeededException cEx)
            {
                DateTime di      = DateTime.Now;
                string   Textza  = string.Format("{0:t}", di);
                string   Timea   = Textza.ToString();
                Action   action3 = () =>
                {
                    richTextBoxAccz.Text += "\n[" + Timea + "] Попалась капча.\n";
                };
                Invoke(action3);

                Rucaptcha.Key = capkey;
                long   captcha_sida = cEx.Sid;
                string captcha_url  = cEx.Img.ToString();
                string captchaPath  = Rucaptcha.Download_Captcha(captcha_url);
                string captcha_keya = Rucaptcha.Recognize(captchaPath);
                Message(lines2, k, captcha_sida, captcha_keya, prove, id, texta, vk, capkey, text4, check1, lines3, num1);
            }
            catch (Exception eX)
            {
                MessageBox.Show(eX.ToString());
                DateTime di      = DateTime.Now;
                string   Textza  = string.Format("{0:t}", di);
                string   Timea   = Textza.ToString();
                Action   action3 = () =>
                {
                    richTextBoxAccz.Text += "\n[" + Timea + "] Не получилось оставить запись в сообществе: " + lines2[k] + ", возможно, закрыта стена или выбран пункт \"Публикация от имени сообщества\", не имея прав в группе.\n";
                };
                Invoke(action3);
            }


            if (num1 == 1)
            {
                if (l >= lines3.Length - 1)
                {
                    l = 0;
                }
            }
            else if (num1 == 2)
            {
                if (l >= lines3.Length)
                {
                    l = 0;
                }
            }

            return("good");
        }