/// <summary>
        /// Instagram Kod İsteme
        /// </summary>
        private async void Button_Insta_KodIste_Click(object sender, EventArgs e)
        {
            bool isEmail = false;

            if (radio_Insta_EpostaDogrulama.Checked)
            {
                isEmail = true;
            }

            try
            {
                // Yeni kod 60 saniyede bir geliyor
                if (isEmail)
                {
                    // Epostaya doğrulama kodu gönderme
                    var email = await InstaApi.RequestVerifyCodeToEmailForChallengeRequireAsync();

                    if (email.Succeeded)
                    {
                        label_Insta_SMSveEPOSTA.Text = $"Eposta adresine kod gönderildi:\n{email.Value.StepData.ContactPoint}";
                        BilgiMesaji("bilgi", $"Eposta adresine kod gönderildi:\n{email.Value.StepData.ContactPoint}", this.Text);

                        group_Insta_HesapDogrulama.Visible = false;
                        group_Insta_KodDogrulama.Dock      = DockStyle.Fill;
                        group_Insta_KodDogrulama.Visible   = true;
                    }
                    else
                    {
                        BilgiMesaji("hata", "Hata: " + email.Info.Message, this.Text, true);
                    }
                }
                else
                {
                    // Telefona doğrulama kodu gönderme
                    var phoneNumber = await InstaApi.RequestVerifyCodeToSMSForChallengeRequireAsync();

                    if (phoneNumber.Succeeded)
                    {
                        label_Insta_SMSveEPOSTA.Text = $"Telefona kod gönderildi:\n{phoneNumber.Value.StepData.ContactPoint}";
                        BilgiMesaji("bilgi", $"Telefona kod gönderildi:\n{phoneNumber.Value.StepData.ContactPoint}", this.Text);

                        group_Insta_HesapDogrulama.Visible = false;
                        group_Insta_KodDogrulama.Dock      = DockStyle.Fill;
                        group_Insta_KodDogrulama.Visible   = true;
                    }
                    else
                    {
                        BilgiMesaji("hata", "Hata: " + phoneNumber.Info.Message, this.Text, true);
                    }
                }
            }
            catch (Exception ex)
            {
                BilgiMesaji("hata", "Hata: " + ex.Message, this.Text, true);
            }
        }
Exemplo n.º 2
0
        private async void sendChallengeCodeButton_Click(object sender, EventArgs e)
        {
            bool isEmail = false;

            if (emailChallengeRadio.Checked)
            {
                isEmail = true;
            }
            //if (RadioVerifyWithPhoneNumber.Checked)
            //    isEmail = false;

            try
            {
                // Note: every request to this endpoint is limited to 60 seconds
                if (isEmail)
                {
                    // Send verification code to email
                    var email = await instaApi.RequestVerifyCodeToEmailForChallengeRequireAsync();

                    if (email.Succeeded)
                    {
                        MessageBox.Show($"We sent verify code to this email:\n{email.Value.StepData.ContactPoint}");
                        smsEmailCodePanel.Enabled      = true;
                        smsEmailCodePanel.Visible      = true;
                        challengeRequiredPanel.Visible = false;
                        challengeRequiredPanel.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show(email.Info.Message, "ERR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    // Send verification code to phone number
                    var phoneNumber = await instaApi.RequestVerifyCodeToSMSForChallengeRequireAsync();

                    if (phoneNumber.Succeeded)
                    {
                        MessageBox.Show($"We sent verify code to this phone number(it's end with this):\n{phoneNumber.Value.StepData.ContactPoint}");
                        smsEmailCodePanel.Enabled      = true;
                        smsEmailCodePanel.Visible      = true;
                        challengeRequiredPanel.Visible = false;
                        challengeRequiredPanel.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show(phoneNumber.Info.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, "EX", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Exemplo n.º 3
0
        async void sendCode(IInstaApi api)
        {
            bool isEmail = true;

            try
            {
                if (isEmail)
                {
                    var email = await api.RequestVerifyCodeToEmailForChallengeRequireAsync();

                    panel1.Visible = true;
                    Size           = new Size(487, 397);
                    if (email.Succeeded)
                    {
                        MessageBox.Show("gönderildi");
                    }
                    else
                    {
                        listBox1.Items.Add("[" + DateTime.Now.ToString("HH:mm") + "]" + email.Info.Message);
                    }
                    label4.Text      = "Bir hata oluştu, loglara bakın.";
                    label4.ForeColor = Color.Red;
                }
                else
                {
                    var phoneNumber = await api.RequestVerifyCodeToSMSForChallengeRequireAsync();

                    if (phoneNumber.Succeeded)
                    {
                        MessageBox.Show("doğrulandı");
                        panel1.Visible = false;
                        Size           = new Size(487, 337);
                    }
                    else
                    {
                        listBox1.Items.Add("[" + DateTime.Now.ToString("HH:mm") + "]" + phoneNumber.Info.Message);
                    }
                    label4.Text      = "Bir hata oluştu, loglara bakın.";
                    label4.ForeColor = Color.Red;
                }
            }
            catch (Exception ex)
            {
                listBox1.Items.Add("[" + DateTime.Now.ToString("HH:mm") + "]" + ex.Message);
                label4.Text      = "Bir hata oluştu, loglara bakın.";
                label4.ForeColor = Color.Red;
            }
        }
Exemplo n.º 4
0
            public async void SendVerificationCode()
            {
                Log("***Send***Code***");
                try
                {
                    // Note: every request to this endpoint is limited to 60 seconds
                    if (isEmail)
                    {
                        Log("Email request to get code");
                        // send verification code to email
                        var email = await instaApi.RequestVerifyCodeToEmailForChallengeRequireAsync();

                        if (email.Succeeded)
                        {
                            Log("Email request is succeeded");
                            Log("We send code to this Email: " + email.Value.StepData.ContactPoint);
                            Adress.Text = "We send code to this Email: " + email.Value.StepData.ContactPoint;
                        }
                        else
                        {
                            Log("Fail email request to get code");
                        }
                    }
                    else
                    {
                        Log("Number request to get code");
                        // send verification code to phone number
                        var phoneNumber = await instaApi.RequestVerifyCodeToSMSForChallengeRequireAsync();

                        if (phoneNumber.Succeeded)
                        {
                            Log("Number request is succeeded");
                            Log("We send code to this number: " + phoneNumber.Value.StepData.ContactPoint);
                            Adress.Text = "We send code to this number: " + phoneNumber.Value.StepData.ContactPoint;
                        }
                        else
                        {
                            Log("Fail phone number request to get code");
                        }
                    }
                }
                catch (Exception ex) { Log("Catch Error!"); }
            }
        public async Task <IActionResult> ChallengeRequired(string sendCodeMethod)
        {
            bool isEmail = false;

            if (sendCodeMethod == "email")
            {
                isEmail = true;
            }

            if (isEmail)
            {
                var email = await api.RequestVerifyCodeToEmailForChallengeRequireAsync();

                if (email.Succeeded)
                {
                    ViewData["Message"] = $"کد تاییدیه به این ایمیل ارسال شد : {email.Value.StepData.ContactPoint}";
                    return(RedirectToAction("VerifyChallenge"));
                }
                else
                {
                    ViewData["ErrorMessage"] = email.Info.Message;
                }
            }
            else
            {
                var phoneNumber = await api.RequestVerifyCodeToSMSForChallengeRequireAsync();

                if (phoneNumber.Succeeded)
                {
                    ViewData["Message"] = $"کد تاییدیه به این شماره تلفن ارسال شد : {phoneNumber.Value.StepData.ContactPoint}";
                    return(RedirectToAction("VerifyChallenge"));
                }
                else
                {
                    ViewData["ErrorMessage"] = phoneNumber.Info.Message;
                }
            }

            return(View());
        }
Exemplo n.º 6
0
        async void sendCode(IInstaApi api)
        {
            bool isEmail = true;

            try
            {
                if (isEmail)
                {
                    var email = await api.RequestVerifyCodeToEmailForChallengeRequireAsync();

                    this.Size = new Size(429, 260);
                    if (email.Succeeded)
                    {
                        MessageBox.Show("gönderildi");
                    }
                    else
                    {
                        MessageBox.Show(email.Info.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    var phoneNumber = await api.RequestVerifyCodeToSMSForChallengeRequireAsync();

                    if (phoneNumber.Succeeded)
                    {
                        MessageBox.Show("doğrulandı");
                        this.Size = new Size(429, 200);
                    }
                    else
                    {
                        MessageBox.Show(phoneNumber.Info.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Exemplo n.º 7
0
        private async Task GetChallenge()
        {
            var currentUser = await InstaApi.LoginAsync();

            if (currentUser.Succeeded)
            {
                SaveSession();
            }
            else
            {
                if (currentUser.Value == InstaLoginResult.ChallengeRequired)
                {
                    var challenge = await InstaApi.GetChallengeRequireVerifyMethodAsync();

                    if (challenge.Succeeded)
                    {
                        if (challenge.Value.SubmitPhoneRequired)
                        {
                            Console.WriteLine("Please type a valid phone number(with country code).\r\ni.e: +989123456789");
                            string phoneNumber = Console.ReadLine();
                            if (!phoneNumber.StartsWith("+"))
                            {
                                phoneNumber = $"+{phoneNumber}";
                            }
                            var submitPhone = await InstaApi.SubmitPhoneNumberForChallengeRequireAsync(phoneNumber);

                            if (submitPhone.Succeeded)
                            {
                                try
                                {
                                    var phoneResult = await InstaApi.RequestVerifyCodeToSMSForChallengeRequireAsync();

                                    if (phoneResult.Succeeded)
                                    {
                                        Console.WriteLine("We sent verify code to this phone number(it's end with this):\n" + phoneResult.Value.StepData.ContactPoint);
                                        await VerifyData();
                                    }
                                    else
                                    {
                                        Console.WriteLine(phoneResult.Info.Message, "ERROR");
                                    }
                                }
                                catch (Exception)
                                {
                                    Console.WriteLine("Error while trying get challenge from phone number");
                                    throw;
                                }
                            }
                            else
                            {
                                Console.WriteLine("Error while trying get challenge from phone");
                            }
                        }
                        else
                        {
                            try
                            {
                                var email = await InstaApi.RequestVerifyCodeToEmailForChallengeRequireAsync();

                                if (email.Succeeded)
                                {
                                    Console.WriteLine($"We sent verify code to this email:\n{email.Value.StepData.ContactPoint}");
                                    await VerifyData();
                                }
                                else
                                {
                                    Console.WriteLine("Error while trying get challenge from email");
                                }
                            }
                            catch (Exception)
                            {
                                Console.WriteLine("Exception while trying get challenge from email");
                                throw;
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Error while trying get challenge");
                    }
                }
                else if (currentUser.Value == InstaLoginResult.TwoFactorRequired)
                {
                    await TwoFactorAuth();
                }
            }
        }
Exemplo n.º 8
0
        //  Deprecated //

        /*
         * private void RunChallenge()
         * {
         *  Console.WriteLine("Starting chalange auth...");
         *  if (proxydata.host!=null)
         *  {
         *      Console.WriteLine("Using proxy...");
         *      var p = new System.Diagnostics.Process();
         *      p.StartInfo.FileName = "ChallengeRequire.exe";
         *      p.StartInfo.Arguments = userSession.UserName +" " + userSession.Password +" "+ proxydata.host +" "+ proxydata.port +" "+ proxydata.username +" "+ proxydata.password;
         *      p.StartInfo.RedirectStandardOutput = true;
         *      p.StartInfo.UseShellExecute = false;
         *      p.StartInfo.CreateNoWindow = true;
         *      p.Start();
         *  }
         *  else
         *  {
         *      var p = new System.Diagnostics.Process();
         *      p.StartInfo.FileName = "ChallengeRequire.exe";
         *      p.StartInfo.Arguments = userSession.UserName + " " + userSession.Password;
         *      p.StartInfo.RedirectStandardOutput = true;
         *      p.StartInfo.UseShellExecute = false;
         *      p.StartInfo.CreateNoWindow = true;
         *      p.Start();
         *  }
         *  Console.WriteLine("Press 1 if challenge is created");
         *  Console.WriteLine("Press 2 to exit");
         *
         *  var key = Console.ReadLine();
         *  Console.WriteLine(Environment.NewLine);
         *  int answer = Convert.ToInt32(key);
         *  if (answer != 1)
         *  {
         *      Console.WriteLine("Error");
         *      return;
         *  }
         * }
         */

        private async Task GetChallenge()
        {
            var currentUser = await InstaApi.LoginAsync();

            if (currentUser.Succeeded)
            {
                SaveSession();
            }
            else
            {
                if (currentUser.Value == InstaLoginResult.ChallengeRequired)
                {
                    var challenge = await InstaApi.GetChallengeRequireVerifyMethodAsync();

                    if (challenge.Succeeded)
                    {
                        if (challenge.Value.SubmitPhoneRequired)
                        {
                            Console.WriteLine("Please type a valid phone number(with country code).\r\ni.e: +989123456789");
                            string phoneNumber = Console.ReadLine();
                            if (!phoneNumber.StartsWith("+"))
                            {
                                phoneNumber = $"+{phoneNumber}";
                            }
                            var submitPhone = await InstaApi.SubmitPhoneNumberForChallengeRequireAsync(phoneNumber);

                            if (submitPhone.Succeeded)
                            {
                                try
                                {
                                    var phoneResult = await InstaApi.RequestVerifyCodeToSMSForChallengeRequireAsync();

                                    if (phoneResult.Succeeded)
                                    {
                                        Console.WriteLine("We sent verify code to this phone number(it's end with this):\n" + phoneResult.Value.StepData.ContactPoint);
                                        await VerifyData();
                                    }
                                    else
                                    {
                                        Console.WriteLine(ErrorsContract.ACC_CH_PHONE_CONFIRM + phoneResult.Info.Message);
                                        ExceptionUtils.Throw(Error.E_CHALLENGE, ErrorsContract.ACC_CH_PHONE_CONFIRM + phoneResult.Info.Message);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ErrorsContract.ACC_CH_PHONE_ERROR + ex);
                                    ExceptionUtils.Throw(Error.E_CHALLENGE, ErrorsContract.ACC_CH_PHONE_ERROR + ex.Message);
                                }
                            }
                            else
                            {
                                Console.WriteLine(ErrorsContract.ACC_CH_PHONE_ERROR + submitPhone.Info.Message);
                                ExceptionUtils.Throw(Error.E_CHALLENGE, ErrorsContract.ACC_CH_PHONE_ERROR + submitPhone.Info.Message);
                            }
                        }
                        else
                        {
                            try
                            {
                                var email = await InstaApi.RequestVerifyCodeToEmailForChallengeRequireAsync();

                                if (email.Succeeded)
                                {
                                    Console.WriteLine($"We sent verify code to this email:\n{email.Value.StepData.ContactPoint}");
                                    await VerifyData();
                                }
                                else
                                {
                                    Console.WriteLine(ErrorsContract.ACC_CH_EMAIL_CONFIRM_CODE + email.Info.Message);
                                    ExceptionUtils.Throw(Error.E_CHALLENGE, ErrorsContract.ACC_CH_EMAIL_CONFIRM_CODE + email.Info.Message);
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ErrorsContract.ACC_CH_EMAIL_CONFIRM_EX + ex);
                                ExceptionUtils.Throw(Error.E_CHALLENGE, ErrorsContract.ACC_CH_EMAIL_CONFIRM_EX + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine(ErrorsContract.ACC_CH_EMAIL_CONFIRM_FAIL);
                        ExceptionUtils.Throw(Error.E_CHALLENGE, ErrorsContract.ACC_CH_EMAIL_CONFIRM_FAIL);
                    }
                }
                else if (currentUser.Value == InstaLoginResult.TwoFactorRequired)
                {
                    await TwoFactorAuth();
                }
            }
        }