Exemplo n.º 1
0
        public WhatsAppSpammer()
        {
            InitializeComponent();
            DeviceControllers = new List <DeviceController.DeviceController>();
            devices           = new List <Device>();

            string advs = CommandExecutor.ExecuteCommandSync("emulator -list-avds");

            string[] adv = advs.Split('\n');
            foreach (var item in adv)
            {
                comboBoxAppium.Items.Add(item);
            }


            //com.whatsapp:id/eula_accept
            //com.whatsapp:id/registration_phone
            //com.whatsapp:id/registration_submit
            //com.whatsapp:id/registration_cc
            //android:id/button1
            //com.whatsapp:id/verify_sms_code_input


            smsRegistrator = new SmsActivate(
                Properties.Settings.Default["ApiKey"].ToString(),
                Properties.Settings.Default["Referal"].ToString(),
                Properties.Settings.Default["Country"].ToString());

            string response = ""; // ApiRequest.GetRequestSync("https://www.proxy-list.download/api/v1/get?type=http&country=RU");

            string[] adresses = response.Split('\n');
            Random   rand     = new Random();
            int      index    = rand.Next(0, adresses.Length);

            textBoxProxy.Text = adresses[index].Trim();

            DB.NumberBase.ToList <NumberBase.NumberBase>().ForEach(i =>
            {
                comboBoxAdCompanies.Items.Add(i.Name);
            });

            Logger.initLogger();
            //Logger.loggerForm.Show();
        }
Exemplo n.º 2
0
        public static async Task <bool> Registration(
            DeviceController.DeviceController deviceController,
            string emulatorImageName,
            string proxy,
            AppiumDevice appium,
            AbstractSmsRegistrator smsRegistrator,
            string nickname,
            string port
            )
        {
            bool banned     = false;
            int  iterations = 0;

            string command = "emulator @" + emulatorImageName;

            if (!proxy.IsNullOrEmpty())
            {
                command += " -http-proxy " + proxy;
                System.IO.File.AppendAllText("usedproxy.txt", proxy + "\n");
                System.IO.File.AppendAllText("usedproxy.txt", "\n");
            }
            command += " -wipe-data -no-snapshot-load";
            deviceController.Log("Emulator starting");
            Logger.log("Emulator starting");
            CommandExecutor.ExecuteCommandAsync(command);
            await Task.Delay(5000);

            /*Open contacts*/
            iterations = 0;
            while (iterations < 60)
            {
                try
                {
                    deviceController.Log("Running Contacts app");
                    Logger.log("Running Contacts app");
                    appium = new AppiumDevice(Apps.Contacts,
                                              Apps.ContatsActivity_Main,
                                              new Device(emulatorImageName),
                                              port
                                              );
                    ContactsScenario.GenerateVCard(deviceController);
                    break;
                }
                catch
                {
                    iterations++;
                    await Task.Delay(1000);
                }
            }
            /*Import Contacts*/
            iterations = 0;
            while (iterations < 60)
            {
                try
                {
                    deviceController.Log("Importing contacts");
                    Logger.log("Importing contacts");
                    ContactsScenario.ImportContacts(appium);
                    break;
                }
                catch
                {
                    iterations++;
                    await Task.Delay(500);
                }
            }

            /*Get number to activate*/
            string number = "";

            iterations = 0;
            while (iterations < 60)
            {
                try
                {
                    number = await smsRegistrator.GetNumber();

                    deviceController.Log("Recived number: " + number);
                    Logger.log("Recived number: " + number);
                    number = number.Remove(0, 1);
                    break;
                }
                catch
                {
                    iterations++;
                    if (iterations > 10)
                    {
                        throw new Exception("Sms registrator error");
                    }
                    await Task.Delay(2000);
                }
            }

            Random random = new Random();

            iterations = 0;
            while (iterations < 60)
            {
                try
                {
                    deviceController.Log("Registration started");
                    Logger.log("Registration started");
                    appium = new AppiumDevice(Apps.WhatsApp,
                                              Apps.WhatsAppActivity_Eula,
                                              new Device(emulatorImageName),
                                              port);
                    banned = await WhatsAppScenario.Registration(appium, number, "7");

                    if (banned)
                    {
                        deviceController.Log("Number is banned");
                        Logger.log("Number is banned");
                        appium.CloseApp();
                        smsRegistrator.SetStatus("7" + number, "10");
                        smsRegistrator.SetStatus("7" + number, "-1");
                        iterations = 0;
                        while (iterations < 60)
                        {
                            try
                            {
                                number = await smsRegistrator.GetNumber();

                                deviceController.Log("Waiting for code");
                                Logger.log("Waiting for code");
                                number = number.Remove(0, 1);
                                break;
                            }
                            catch
                            {
                                iterations++;
                                await Task.Delay(5000);
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                catch
                {
                    iterations++;
                    await Task.Delay(2000);
                }
            }

            smsRegistrator.PhoneReady("7" + number);

            iterations = 0;
            while (iterations < 1200)
            {
                try
                {
                    string code = await smsRegistrator.GetCode("7" + number);

                    if (code != "STATUS_WAIT_CODE")
                    {
                        WhatsAppScenario.VerifyCode(appium, code);
                        break;
                    }
                    else
                    {
                        iterations++;
                        await Task.Delay(1000);
                    }
                }
                catch
                {
                    iterations++;
                    await Task.Delay(1000);
                }
            }

            smsRegistrator.SetStatus("7" + number, "6");

            iterations = 0;
            while (iterations < 60)
            {
                try
                {
                    WhatsAppScenario.WriteName(appium, nickname);
                    break;
                }
                catch
                {
                    iterations++;
                    await Task.Delay(500);
                }
            }
            deviceController.Log("Registration finished");
            return(banned);
        }