Esempio n. 1
0
        public override string GetNumber()
        {
            try
            {
                var answer =
                    GetResponse("http://simsms.org/priemnik.php?" +
                                $"metod=get_number&country=ru&service={ViberKey}&id=1&apikey={ApiKey}");
                if (Regex.Match(answer, "(?<=response\":\").*?(?=\")").Value != "1")
                {
                    return(null);
                }

                var tzid   = new Regex("(?<=id\":).*?(?=,)").Match(answer).Value;
                var number = new Regex("(?<=number\":\").*?(?=\")").Match(answer).Value;
                if (string.IsNullOrWhiteSpace(number))
                {
                    throw new Exception($"{nameof(SimSms)} {nameof(GetNumber)} Переменная {number} пуста");
                }
                if (TzidNumbers.ContainsKey(number))
                {
                    TzidNumbers[number] = tzid;
                }
                else
                {
                    TzidNumbers.Add(number, tzid);
                }
                return(number);
            }
            catch (Exception e)
            {
                Lgr?.Wl($"{nameof(SimSms)} {nameof(GetNumber)} {e}");
                return(null);
            }
        }
Esempio n. 2
0
        public override string GetCodeSms(string numer, long timer = 600000)
        {
            try
            {
                var url = "http://simsms.org/priemnik.php?" +
                          $"metod=get_sms&country=ru&service={ViberKey}&id={TzidNumbers[numer]}&apikey={ApiKey}";
                var answer = GetResponse(url);

                var sw = Stopwatch.StartNew();
                while (Regex.Match(answer, "(?<=response\":\").*?(?=\")").Value != "1" &&
                       (sw.ElapsedMilliseconds < timer))
                {
                    if (Regex.Match(answer, "(?<=response\":\").*?(?=\")").Value != "2")
                    {
                        return(null);
                    }
                    Thread.Sleep(20000);
                    answer = GetResponse(url);
                }
                sw.Stop();
                return(new Regex("(?<=sms\":\").*?(?=\")").Match(answer).Value);
            }catch (Exception e)
            {
                Lgr?.Wl($"{nameof(SimSms)} {nameof(GetCodeSms)} {e}");
                return(null);
            }
        }
Esempio n. 3
0
        public override string GetCodeSms(string number, long timer = 600000)
        {
            try
            {
                string url = "http://sms-activate.ru/stubs/handler_api.php?" +
                             $"api_key={ApiKey}&action=setStatus&status=1&id={TzidNumbers[number]}";
                GetResponse(url);

                Stopwatch sw = Stopwatch.StartNew();
                url = "http://sms-activate.ru/stubs/handler_api.php?&" +
                      $"id={TzidNumbers[number]}&api_key={ApiKey}&action=getStatus";
                string answer = GetResponse(url);

                while (!answer.Contains("STATUS_OK") && (sw.ElapsedMilliseconds < timer))
                {
                    if (answer != "STATUS_WAIT_CODE")
                    {
                        return(null);
                    }
                    Thread.Sleep(10500);
                    answer = GetResponse(url);
                }
                return(new Regex("(?<=STATUS_OK:).*").Match(answer).Value);
            }
            catch (Exception e)
            {
                Lgr?.Wl($"{nameof(SmsActivate)} {nameof(GetCodeSms)} {e}");
                return(null);
            }
        }
 public override string GetCodeSms(string number, long timer = 600000)
 {
     try
     {
         Stopwatch sw  = Stopwatch.StartNew();
         string    url = "http://onlinesim.ru/api/getState.php?" +
                         $"tzid={TzidNumbers[number]}&message_to_code=1&apikey={ApiKey}";
         string answer = GetResponse(url);
         while (Regex.Match(answer, "(?<=response\":\").*?(?=\")").Value != "TZ_NUM_ANSWER" &&
                (sw.ElapsedMilliseconds < timer))
         {
             if (Regex.Match(answer, "(?<=response\":\").*?(?=\")").Value != "TZ_NUM_WAIT")
             {
                 return(null);
             }
             Thread.Sleep(10500);
             answer = GetResponse(url);
         }
         sw.Stop();
         GetResponse("http://onlinesim.ru/api/setOperationOk.php?" +
                     $"tzid={TzidNumbers[number]}&apikey={ApiKey}");
         return(new Regex("(?<=\"msg\":\").*?(?=\")").Match(answer).Value);
     }
     catch (Exception e)
     {
         Lgr?.Wl($"{nameof(OnlineSim)} {nameof(GetCodeSms)} {e}");
         return(null);
     }
 }
Esempio n. 5
0
        public override string GetCodeSms(string number, long timer = 600000)
        {
            try
            {
                var url    = "http://api.sms-reg.com/setReady.php?" + $"tzid={TzidNumbers[number]}&apikey={ApiKey}";
                var answer = GetResponse(url);

                if (new Regex("(?<=response\":\").*?(?=\")").Match(answer).Value != "1")
                {
                    return(null);
                }

                url    = "http://api.sms-reg.com/getState.php?" + $"tzid={TzidNumbers[number]}&apikey={ApiKey}";
                answer = GetResponse(url);

                var sw = Stopwatch.StartNew();
                while (!answer.Contains("TZ_NUM_ANSWER") && (sw.ElapsedMilliseconds < timer))
                {
                    if (Regex.Match(answer, "(?<=response\":\").*?(?=\")").Value != "TZ_NUM_WAIT")
                    {
                        return(null);
                    }
                    Thread.Sleep(10500);
                    answer = GetResponse(url);
                }
                sw.Stop();
                return(new Regex("(?<=msg\":\").*?(?=\")").Match(answer).Value);
            }
            catch (Exception e)
            {
                Lgr?.Wl($"{nameof(SmsReg)} {nameof(GetCodeSms)} {e}");
                return(null);
            }
        }
        public override string GetNumber()
        {
            try
            {
                var url    = "http://onlinesim.ru/api/getNum.php?" + $"service={ViberKey}&apikey={ApiKey}";
                var answer = GetResponse(url);

                if (Regex.Match(answer, "(?<=response\":\").*?(?=\")").Value != "1")
                {
                    return(null);
                }
                var tzid = Regex.Match(answer, "(?<=\"tzid\":).*?(?=})").Value;

                url    = "http://onlinesim.ru/api/getState.php?" + $"tzid={tzid}&apikey={ApiKey}";
                answer = GetResponse(url);
                var sw = Stopwatch.StartNew();
                while (Regex.Match(answer, "(?<=\"response\":\").*?(?=\")").Value != "1" &&
                       (sw.ElapsedMilliseconds < 60000))
                {
                    if (answer.Contains("TZ_INPOOL"))
                    {
                        Thread.Sleep(10500);
                        answer = GetResponse(url);
                        continue;
                    }
                    if (!answer.Contains("TZ_NUM_WAIT"))
                    {
                        return(null);
                    }
                    var number = new Regex("(?<=number\":\").*?(?=\")").Match(answer).Value;
                    if (string.IsNullOrWhiteSpace(number))
                    {
                        throw new Exception($"{nameof(OnlineSim)} {nameof(GetNumber)} Переменная {number} пуста");
                    }
                    if (TzidNumbers.ContainsKey(number))
                    {
                        TzidNumbers[number] = tzid;
                    }
                    else
                    {
                        TzidNumbers.Add(number, tzid);
                    }
                    return(number);
                }
                sw.Stop();
                return(null);
            }
            catch (Exception e)
            {
                Lgr?.Wl($"{nameof(OnlineSim)} {nameof(GetNumber)} {e}");
                return(null);
            }
        }
Esempio n. 7
0
        public override string GetNumber()
        {
            try
            {
                string url = "http://sms-activate.ru/stubs/handler_api.php?" +
                             $"api_key={ApiKey}&action=getNumber&service={ViberKey}";
                string answer = GetResponse(url);
                switch (answer)
                {
                case "NO_NUMBERS":
                    return(null);

                case "NO_BALANCE":
                    return(null);

                case "BAD_ACTION":
                    return(null);

                case "BAD_SERVICE":
                    return(null);

                case "BAD_KEY":
                    return(null);

                case "ERROR_SQL":
                    return(null);
                }
                var    tzid   = Regex.Match(answer, "(?<=ACCESS_NUMBER:).*?(?=:)").Value;
                string number = Regex.Match(answer, "(?<=\\d:).*").Value;
                if (string.IsNullOrWhiteSpace(number))
                {
                    throw new Exception($"{nameof(SmsActivate)} {nameof(GetNumber)} Переменная {number} пуста");
                }
                if (TzidNumbers.ContainsKey(number))
                {
                    TzidNumbers[number] = tzid;
                }
                else
                {
                    TzidNumbers.Add(number, tzid);
                }
                return(number);
            }
            catch (Exception e)
            {
                Lgr?.Wl($"{nameof(SmsActivate)} {nameof(GetNumber)} {e}");
                return(null);
            }
        }
Esempio n. 8
0
        public override string GetCodeSms(string number, long timer = 600000)
        {
            try
            {
                string url = "http://smslike.ru/index.php?mode=api" +
                             $"&apikey={ApiKey}&action=setready&tz={TzidNumbers[number]}";
                var answer = GetResponse(url);

                if (!answer.Contains("OK_READY"))
                {
                    return(null);
                }

                url = "http://smslike.ru/index.php?mode=api" +
                      $"&apikey={ApiKey}&action=getstate&tz={TzidNumbers[number]}";
                answer = GetResponse(url);

                Stopwatch sw = Stopwatch.StartNew();
                while (!answer.Contains("TZ_NUM_ANSWER") && (sw.ElapsedMilliseconds < timer))
                {
                    if (!answer.Contains("TZ_NUM_WAIT"))
                    {
                        return(null);
                    }
                    Thread.Sleep(10000);
                    answer = GetResponse(url);
                }
                sw.Stop();
                if (answer.Contains("TZ_OVER_EMPTY"))
                {
                    return(null);
                }
                return(new Regex("(?<=TZ_NUM_ANSWER:).*").Match(answer).Value);
            }
            catch (Exception e)
            {
                Lgr?.Wl($"{nameof(SmsLike)} {nameof(GetCodeSms)} {e}");
                return(null);
            }
        }
Esempio n. 9
0
        public override string GetNumber()
        {
            try
            {
                string tzid;
                string url = "http://smslike.ru/index.php?mode=api" +
                             $"&apikey={ApiKey}&action=regnum&lc=0&s={ViberKey}";
                var answer = GetResponse(url);
                var check  = Regex.IsMatch(answer, "OK");
                switch (answer)
                {
                case "BEFORE_REQUEST_NEW_REPLY_COMPLE_REQUESTED_BEFORE":
                    return(null);

                case "ACTIVE_REQUESTS_LIMIT":
                    return(null);

                case "WARNING_LOW_BALANCE":
                    return(null);

                case "WARNING_NO_NUMS":
                    return(null);

                default:
                    if (check)
                    {
                        tzid = answer.Split(':')[1].Trim();
                    }
                    else
                    {
                        return(null);
                    }
                    break;
                }

                url    = "http://smslike.ru/index.php?mode=api" + $"&apikey={ApiKey}&action=getstate&tz={tzid}";
                answer = GetResponse(url);
                var sw = Stopwatch.StartNew();
                while (!answer.Contains("TZ_NUM_PREPARE") && (sw.ElapsedMilliseconds < 60000))
                {
                    if (answer != "TZ_NUM_WAIT_NUMBER")
                    {
                        return(null);
                    }
                    Thread.Sleep(10500);
                    answer = GetResponse(url);
                }
                sw.Stop();
                var number = Regex.Match(answer, "(?<=TZ_NUM_PREPARE:).*").Value;
                if (string.IsNullOrWhiteSpace(number))
                {
                    throw new Exception($"{nameof(SmsLike)} {nameof(GetNumber)} Переменная {number} пуста");
                }
                if (TzidNumbers.ContainsKey(number))
                {
                    TzidNumbers[number] = tzid;
                }
                else
                {
                    TzidNumbers.Add(number, tzid);
                }
                return(number);
            }
            catch (Exception e)
            {
                Lgr?.Wl($"{nameof(SmsLike)} {nameof(GetNumber)} {e}");
                return(null);
            }
        }