Пример #1
0
        public static void Worker(string[] args)
        {
            //#if PUBLIC_BUILD
            if (!Globals.IsValid())
                return;
            //#endif

            if (args[0] == "activatemail" && args.Length != 4)
            {
                ConsoleLog.WriteLine("activatemail pop_server login password");
                return;
            }
            if (args[0] == "activatelist" && args.Length != 2)
            {
                ConsoleLog.WriteLine("activatelist mailboxes_file");
                return;
            }

            NickNameAndPasswordGenerator gen = new NickNameAndPasswordGenerator("", 0);
            List<string> mailBoxes = null;
            if (args[0] == "activatemail")
            {
                mailBoxes = new List<string>();
                mailBoxes.Add(args[1] + ';' + args[2] + ';' + args[3] + ";xxx");
            }
            if (args[0] == "activatelist")
            {
                mailBoxes = gen.GetMailListBoxs(args[1]);
            }

            foreach (var mailbox in mailBoxes)
            {
                mailclient = new Pop3.Pop3Client();
                messagesToDelete = new List<Pop3Message>();
                messNumber = 0;
                messCount = 0;
                ConsoleLog.WriteLine("Connecting to " + mailbox.Split(';')[0]);
                mailclient.Connect(mailbox.Split(';')[0], mailbox.Split(';')[1], mailbox.Split(';')[2]);
                ConsoleLog.WriteLine("Logged in. Retrieving message list...");
                List<Pop3Message> messages = mailclient.List();
                mailclient.Retrieve(messages);

                int poolsize = Globals.threadCount;
                if ((args[0] == "activatelist") || (Globals.BotConfig.useTOR))
                    poolsize = 1;

                try
                {
                    messCount = messages.Count;
                    NerZul.Core.Utils.Bicycles.ThreadPool.ExecInPool(ActivateProc, messages, poolsize, true, Globals.ShowDlg);

                    if (args[0] == "activatelist")
                    {
                        gen.FixBoxAct(mailbox.Split(';')[3]);
                    }
                }
                catch (System.Exception e)
                {
                    ConsoleLog.WriteLine("Activate mail error: " + e.Message);
                }

                ConsoleLog.WriteLine("Deleteing processed messages...");
                mailclient.Delete(messagesToDelete);
                ConsoleLog.WriteLine("Disconnecting...");
                mailclient.Disconnect();
                ConsoleLog.WriteLine("Finished");

                messagesToDelete.Clear();
            }
        }
Пример #2
0
        public static void RegisterProc()
        {
            //#if PUBLIC_BUILD
            if (!Globals.IsValid())
                return;
            //#endif

            string Response = "";

            NerZul.Core.Utils.NickNameAndPasswordGenerator generator = null;

            if (nameType == NameType.Manual)
                generator = new NerZul.Core.Utils.NickNameAndPasswordGenerator("");
            if (nameType == NameType.Dictionary)
                generator = new NerZul.Core.Utils.NickNameAndPasswordGenerator("dic.txt");
            if (nameType == NameType.Web)
                generator = new NerZul.Core.Utils.NickNameAndPasswordGenerator(Globals.webNickURL, 1);

            while (true)
            {
                string NickName = "";
                if (nameType == NameType.Manual)
                {
                    lock (lockable)
                    {
                        Console.WriteLine("Enter the name for a new bot: ");
                        NickName = Console.ReadLine();
                    }
                }
                else NickName = generator.GenerateNick();
                string Password = generator.GeneratePassword();
                string Mail = "";
                if (regType == RegType.GMail)
                    Mail = generator.GenerateGMail(mail_parameter);
                if (regType == RegType.Domain)
                    Mail = generator.GenerateDomain(NickName, mail_parameter);
                if (regType == RegType.MailList)
                    Mail = generator.GenerateMailList(mail_parameter);
                ConsoleLog.WriteLine("Mail: " + Mail);
                RegResult regResult = RegResult.UnknownFail;
                try
                {
                    regResult = RegisterBot(
                        NickName,
                        Password,
                        Mail,
                        192,
                        out Response);
                }
                catch (Exception e)
                {
                    ConsoleLog.WriteLine("Exception! " + e.Message);
                };
                if (regResult == RegResult.Success)
                {
                    ConsoleLog.WriteLine(count.ToString() + ": " + NickName + " ready");

                    if (regType == RegType.MailList)
                    {
                        generator.FixBoxReg(Mail);
                    }

                    if (activate)
                    {
                        try
                        {
                            ActivateMail.Worker(new string[] { "activatemail", popServer, mailLogin, mailPassword });
                        }
                        catch (Exception e)
                        {
                            ConsoleLog.WriteLine("Activation failed. Error: " + e.Message);
                        }
                    }

                    WriteToDB(NickName, Password, Mail);
                    if (delay > 0)
                        System.Threading.Thread.Sleep(delay * 1000);
                }
                else
                {
                    ConsoleLog.WriteLine(count.ToString() + ": " + NickName + " registration failed. " + regResult.ToString());
                    //ConsoleLog.WriteLine(count.ToString() + ": " + NickName + " registration failed", "RegisterLog.txt");
                    //ConsoleLog.WriteLine(Response, "RegisterLog.txt");

                    if ((regResult == RegResult.EmailExist) && (regType == RegType.MailList))
                    {
                        generator.FixBoxReg(Mail);
                    }
                }
            }
        }