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
 

who@mi

Новичок
Регистрация
14.10.2018
Сообщения
10
Благодарностей
2
Баллы
3
Ok, i've figured it out by myself now, if anybody need help with this just ask or send pm
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 218
Благодарностей
5 843
Баллы
113
Audio captcha should be sent as multipart in http request.
 

toan

Пользователь
Регистрация
15.09.2018
Сообщения
48
Благодарностей
0
Баллы
6

who@mi

Новичок
Регистрация
14.10.2018
Сообщения
10
Благодарностей
2
Баллы
3
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.
 

toan

Пользователь
Регистрация
15.09.2018
Сообщения
48
Благодарностей
0
Баллы
6
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
 

who@mi

Новичок
Регистрация
14.10.2018
Сообщения
10
Благодарностей
2
Баллы
3
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

toan

Пользователь
Регистрация
15.09.2018
Сообщения
48
Благодарностей
0
Баллы
6
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
 

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