SolveMedia audio via HTTP request

who@mi

Новичок
Регистрация
14.10.2018
Сообщения
10
Реакции
2
Баллы
3
Hi,

can someone explain how to make a http request to send Solvemedia audio captchas to capmonster? I checked all avalaible captcha services and couldn't find a API which supports audio captchas...

Thanks
 
Ok, i've figured it out by myself now, if anybody need help with this just ask or send pm
 
Audio captcha should be sent as multipart in http request.
 
Sure,
i use the 2captcha API for all my captchas, so i explain it on this API. The HTTP POST request for SolveMedia Audio is nearly like the one from normal TextCaptcha:

[YOURCAPMONSTER_IP_AND_PORT]in.php?key=[ANY_KEY_YOU_USE]&method=base64&body=[BASE64_ENCRYPTED_MP3_BYTES]&CapMonsterModule=ZennoLab.AudioSolveMedia
=> RESPONDS: OK|[ID] or ERROR
=> with ID make HTTP GET REQUEST to [YOURCAPMONSTER_IP_AND_PORT]res.php?key=[ANY_KEY_YOU_USE]&action=get&id=[ID]
=> RESPONDS: OK|[CAPTCHA_SOLUTION]

- Of course you can make this request to the original url 2.captcha.com instead of the CM ip:port, i just prefer the call over ip-address
- Maybe its possible to make it with multipart in HTTP request, for me it only works with base64 mp3-data, because multipart throws error 'empty audio' or like that, so i recommend base64 method

So, i hope this helps you to get it work.If you need more help just tell me, i will do my best. I can give example in C# and PHP/HTML, too.
 
Sure,
i use the 2captcha API for all my captchas, so i explain it on this API. The HTTP POST request for SolveMedia Audio is nearly like the one from normal TextCaptcha:

[YOURCAPMONSTER_IP_AND_PORT]in.php?key=[ANY_KEY_YOU_USE]&method=base64&body=[BASE64_ENCRYPTED_MP3_BYTES]&CapMonsterModule=ZennoLab.AudioSolveMedia
=> RESPONDS: OK|[ID] or ERROR
=> with ID make HTTP GET REQUEST to [YOURCAPMONSTER_IP_AND_PORT]res.php?key=[ANY_KEY_YOU_USE]&action=get&id=[ID]
=> RESPONDS: OK|[CAPTCHA_SOLUTION]

- Of course you can make this request to the original url 2.captcha.com instead of the CM ip:port, i just prefer the call over ip-address
- Maybe its possible to make it with multipart in HTTP request, for me it only works with base64 mp3-data, because multipart throws error 'empty audio' or like that, so i recommend base64 method

So, i hope this helps you to get it work.If you need more help just tell me, i will do my best. I can give example in C# and PHP/HTML, too.
i try it before too. but it return empty audio. it is great if you can give me C# sample.
thank a lot and have a nice weekend
 
Hello, sorry was very busy last weekend. I think the error "empty audio" is because the AudioSolveMediaModule expects BASE64 encrypted Data, but not sure about that. Here is C# example how you can base64 encrypt the Data in a way the PHP Script on the CM Site can decrypt it. With this method i have no problems to solve but the code example is really Quick 'n'Dirty, so modify it that it fits you needs ;-)

Код:
Развернуть Свернуть Копировать
        private void SendSolvemediaAudio(string FileNameOfMp3)
        {
            try
            {
                string base64 = Convert.ToBase64String(File.ReadAllBytes(FileNameOfMp3));
                 //Encode the '+' char, which C# Adds, so Data can be decrypted by PHP
                base64 = base64.Replace("+", "%2B");

                ServicePointManager.Expect100Continue = false;
                var request = (HttpWebRequest)WebRequest.Create("http://[CAPMONSTER_IP_PORT]/in.php");


                var postData = "key=[YOURKEY]&CapMonsterModule=ZennoLab.AudioSolveMedia&method=base64&body=" + base64;
                var data = Encoding.ASCII.GetBytes(postData);

                request.Method = "POST";

                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;

                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                var response = (HttpWebResponse)request.GetResponse();

                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

                //  GET
                if (responseString.Contains("OK|"))
                {
                    string id = responseString.Substring(3);

                   //Get the Result with id...
                
                }
                else
                {
                   //ErrorHandling
                }
            }
            catch (Exception ex)
            {
                //ErrorHandling

            }
        }


I hope i could help you little bit with this. Have a nice day
 
  • Спасибо
Реакции: toan
Hello, sorry was very busy last weekend. I think the error "empty audio" is because the AudioSolveMediaModule expects BASE64 encrypted Data, but not sure about that. Here is C# example how you can base64 encrypt the Data in a way the PHP Script on the CM Site can decrypt it. With this method i have no problems to solve but the code example is really Quick 'n'Dirty, so modify it that it fits you needs ;-)

Код:
Развернуть Свернуть Копировать
        private void SendSolvemediaAudio(string FileNameOfMp3)
        {
            try
            {
                string base64 = Convert.ToBase64String(File.ReadAllBytes(FileNameOfMp3));
                 //Encode the '+' char, which C# Adds, so Data can be decrypted by PHP
                base64 = base64.Replace("+", "%2B");

                ServicePointManager.Expect100Continue = false;
                var request = (HttpWebRequest)WebRequest.Create("http://[CAPMONSTER_IP_PORT]/in.php");


                var postData = "key=[YOURKEY]&CapMonsterModule=ZennoLab.AudioSolveMedia&method=base64&body=" + base64;
                var data = Encoding.ASCII.GetBytes(postData);

                request.Method = "POST";

                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;

                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }

                var response = (HttpWebResponse)request.GetResponse();

                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

                //  GET
                if (responseString.Contains("OK|"))
                {
                    string id = responseString.Substring(3);

                   //Get the Result with id...
               
                }
                else
                {
                   //ErrorHandling
                }
            }
            catch (Exception ex)
            {
                //ErrorHandling

            }
        }


I hope i could help you little bit with this. Have a nice day

thanks a lot. it great
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)