Untitled

 avatar
user_2299906
plain_text
2 years ago
10 kB
13
Indexable
public class SimCodeApi
    { 
        public string Site { set; get; }
        public string API { set; get; }
        public string appId { set; get; } = "1001"; //facebook id chothuesimcode
        public string Phone { set; get; }
        public string IDCode { set; get; }
        public string Code { set; get; }
        public int timeout { set; get; }
        RequestHTTP request = new RequestHTTP();

        public SimCodeApi(string site , string api,int time)
        {
            Site = site;
            API = api;
            timeout = time;
            switch (Site)
            {
                case "Chothuesimcode.com":
                    GetPhoneChothueSimCode();
                    break;
                case "Otp282.com":
                    GetPhoneOTP282();
                    break;
                case "Winmail.shop":
                    GetPhoneWinmailshop();
                    break;
                case "Tempsms.co":
                    GetPhoneTempsms();
                    break;
                //Viotp.com
                case "Sim24.cc":
                    GetPhoneSim24CC();
                    break;
                case "Viotp.com":
                    GetPhoneViotp();
                    break;
            }

        }
        void GetPhoneViotp()
        {
            appId = "7";
            int count = 3;
            while (string.IsNullOrEmpty(Phone) && count > 0)
            {
                string html = request.Get($"https://api.viotp.com/request/getv2?token={API}&serviceId={appId}").Result;
                if (!string.IsNullOrEmpty(html)) Phone = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"phone_number\":\"(\\d+)").Groups[1].Value;
                if (!string.IsNullOrEmpty(html)) IDCode = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"request_id\":\"(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Phone) && count > 0)
                    Task.Delay(3000).Wait();
                count--;
            }
        }
        void GetPhoneSim24CC()
        {
            appId = "facebook";
            int count = 3;
            while (string.IsNullOrEmpty(Phone) && count > 0)
            {
                string html = request.Get($"https://sim24.cc/api?action=number&service={appId}&apikey={API}").Result;
                if (!string.IsNullOrEmpty(html)) Phone = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"numberno84\":\"(\\d+)").Groups[1].Value;
                if (!string.IsNullOrEmpty(html)) IDCode = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"id\":\"(.*?)\"").Groups[1].Value;
                if(string.IsNullOrEmpty(Phone) && count > 0)
                Task.Delay(3000).Wait();
                count--;
            }
        }
        void GetPhoneOTP282()
        {
            appId = "1";
            int count = 3;
            while(string.IsNullOrEmpty(Phone)&&count>0)
            {
                string html = request.Get($"https://otp282.com/api/createRequestOTP/{API}/service_id/{appId}").Result;
                if (!string.IsNullOrEmpty(html)) Phone = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"phone\":\"[+]84(\\d+)").Groups[1].Value;
                if (!string.IsNullOrEmpty(html)) IDCode = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"request_id\":\"(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Phone) && count > 0)
                    Task.Delay(3000).Wait();
                count--;
            }
        }
        void GetPhoneTempsms()
        {
            appId = "13";
            string html = request.Get($"https://api.tempsms.co/create?api_key={API}&service_id={appId}").Result;
            if (!string.IsNullOrEmpty(html))
            {
                IDCode = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"request_id\":(\\d+)").Groups[1].Value;
                html = request.Get($"https://api.tempsms.co/detail?api_key={API}&request_id={IDCode}").Result;
                if(!string.IsNullOrEmpty(html))
                Phone = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"phone\":\"(\\d+)").Groups[1].Value;

            }

            //if (!string.IsNullOrEmpty(html)) IDCode = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"Id\":(\\d+)").Groups[1].Value;

        }
        void GetCodeTempsms()
        {
            int solan = 0;
            while (string.IsNullOrEmpty(Code) && solan < timeout)
            {
                string html = request.Get($"https://api.tempsms.co/detail?api_key={API}&request_id={IDCode}").Result;
                if (!string.IsNullOrEmpty(html)) Code = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"otp\":\"(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Code)) Task.Delay(3000).Wait();
                solan = solan + 4;       
            }

        }
        void GetPhoneWinmailshop()
        {
            appId = "facebook";
            int count = 3;
            while (string.IsNullOrEmpty(Phone) && count > 0)
            {
                string html = request.Get($"https://api.winmail.shop/phone/rent?clientId={API}&serviceId={appId}").Result;
                if (!string.IsNullOrEmpty(html)) Phone = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"phone\":\"(\\d+)").Groups[1].Value;
                if (!string.IsNullOrEmpty(html)) IDCode = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"phoneId\":\"(.*?)\"").Groups[1].Value;
                if (string.IsNullOrEmpty(Phone) && count > 0)
                    Task.Delay(3000).Wait();
                count--;
            }

        }
        void GetPhoneChothueSimCode()
        {
            appId = "1001";
            List<string> nhamang = new List<string>(){ "Viettel", "Mobi", "Vina" };
            int count = 3;
            while (string.IsNullOrEmpty(Phone) && count > 0)
            {
                string html = request.Get($"https://chothuesimcode.com/api?act=number&apik={API}&appId={appId}&carrier={nhamang.GetRandom()}").Result;
                if (!string.IsNullOrEmpty(html)) Phone = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"Number\":\"(\\d+)").Groups[1].Value;
                if (!string.IsNullOrEmpty(html)) IDCode = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"Id\":(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Phone) && count > 0)
                    Task.Delay(3000).Wait();
                count--;
            }

        }
        void GetCodeChothueSimCode()
        {
            int solan = 0;
            while (string.IsNullOrEmpty(Code) && solan < timeout)
            {
                string html = request.Get($"https://chothuesimcode.com/api?act=code&apik={API}&id={IDCode}").Result;
                if (!string.IsNullOrEmpty(html)) Code = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"Code\":\"(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Code)) Task.Delay(3000).Wait();
                solan = solan + 4;
            }

        }
        void GetCodeOTP282()
        {
            int solan = 0;
            while (string.IsNullOrEmpty(Code) && solan <timeout)
            {
                string html = request.Get($"https://otp282.com/api/getOTPCode/{API}/request_id/{IDCode}").Result;
                if (!string.IsNullOrEmpty(html)) Code = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"otpcode\":(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Code)) Task.Delay(3000).Wait();
                solan = solan + 4;
            }

        }
        void GetCodeWinmailShop()
        {
            int solan = 0;
            while (string.IsNullOrEmpty(Code) && solan < timeout)
            {
                string html = request.Get($"https://api.winmail.shop/phone/code?clientId={API}&phoneId={IDCode}").Result;
                if (!string.IsNullOrEmpty(html)) Code = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"code\":\"(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Code)) Task.Delay(6000).Wait();
                solan = solan + 6;
            }

        }
        void GetCodeSim24cc()
        {
            int solan = 0;
            while (string.IsNullOrEmpty(Code) && solan < timeout)
            {
                string html = request.Get($"https://sim24.cc/api?action=code&id={IDCode}&apikey={API}").Result;
                if (!string.IsNullOrEmpty(html)) Code = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"otp\":\"(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Code)) Task.Delay(3000).Wait();
                solan = solan + 4;
            }

        }
        void GetCodeViotp()
        {
            int solan = 0;
            while (string.IsNullOrEmpty(Code) && solan < timeout)
            {
                string html = request.Get($"https://api.viotp.com/session/getv2?requestId={IDCode}&token={API}").Result;
                if (!string.IsNullOrEmpty(html)) Code = Regex.Match(html.Replace("\r", "").Replace("\n", "").Replace(" ", ""), "\"Code\":\"(\\d+)").Groups[1].Value;
                if (string.IsNullOrEmpty(Code)) Task.Delay(3000).Wait();
                solan = solan + 4;
            }

        }
        public string GetCode()
        {
            switch (Site)
            {
                case "Chothuesimcode.com":
                    GetCodeChothueSimCode();
                    break;
                case "Otp282.com":
                    GetCodeOTP282();
                    break;
                case "Winmail.shop":
                    GetCodeWinmailShop();
                    break;
                case "Tempsms.co":
                    GetCodeTempsms();
                    break;
                case "Sim24.cc":
                    GetCodeSim24cc();
                    break;
                case "Viotp.com":
                    GetCodeViotp();
                    break;
            }
            return Code;
        }

    }
Editor is loading...