1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Register bot - Captcha problem

Discussion in 'C, C++, C#' started by honeydew3, Sep 10, 2016.

  1. honeydew3

    honeydew3 Newbie

    Joined:
    Sep 10, 2016
    Messages:
    1
    Likes Received:
    0
    Gender:
    Male
    Hi,
    I am making a bot to register on website. About 1 year ago I bought a bot which was working properly. Couple months ago few new security things appeared wchich made bot useless. After that I started to learn programming to make my own application.

    First security:
    1 ip adress - 3 registraction possible
    Allright, I have VPN.

    Second security:
    If I enter a site and go to register field, fill everything and then change my ip - I cant register. I dont know if it is common thing, or not. I have to have same ip on single session to register.

    Third security:
    Captcha.
    Well, they added few more characters (website is not in english), so I cant use any captcha solvers.


    But thats how I tried to overcome these above:

    I've got a code from bot which I bought and tried to recode. I managed that site does not changed much. But, the captcha its different. It seems to change after every request. Even If I obtain captcha with cookies and use the same cookies to send POST data to register it does not working. I mean request is well built (I think so), but captcha code I submited seems to be wrong.

    After that I created bot with webBrowsers. At first I wanted to have 30 webBrowsers in single c# app. Just fill every captcha, click a button and let app do the work (it would change ip after 3 submits automatically - VPN api).

    But unfortunelly I have to have the same ip on single session to be able to register.

    So.. I deleted 27 webBrowsers; 3 left. Then I saw something weird. Everytime when I starts registering (3 webBrowsers at once) only last webBrowser register succesfully. There is an error "wrong captcha" on first two. So I discovered, that when I try to register 3 accounts from 3 webBrowsers at once It does not work. Seems like only the last captcha loaded for my session is valid:

    When I opened 3 new tab in Google Chrome (register site) the first two said that captcha was wrong. In last tab captcha was valid.

    When I opened register website: 1 in Google Chrome and 1 in Firefox there was valid captcha in both.

    That means captcha is assigned to my session (or cookies). But.. Why I can use Chrome+Firefox, but I cant use 2x webBrowsers? 2 sepaThere webBrowsers should contains different cookies and be recognized as 2 separate session..

    What has to be said, tere is also no problem to register 3 account one by one (I wanted to use 30 webBrowsers insted of 1, because registering one by one is sooo slow).

    Let me show you the code. To use 3 webBrowsers at once I used foreach. Here's code:

    Button1 - Navigation:

    Code:
                foreach (var c in this.Controls.OfType<WebBrowser>())
                {
                    c.Navigate("example.com");
                }

    Button2 - submit data and obtain captcha image:
    Code:
                foreach (var c in this.Controls.OfType<WebBrowser>())
                {
    
                    HtmlElement email = c.Document.GetElementById("register[email]");
                    HtmlElement nick = c.Document.GetElementById("register[nick]");
                    HtmlElement password = c.Document.GetElementById("register[password]");
                    HtmlElement repeat_password = c.Document.GetElementById("register[repeat_password]);
    
                    email.SetAttribute("value", "" + mailsArray[numberBrowser] + "");
                    nick.SetAttribute("value", "" + nicksArray[numberBrowser] + "");
                    password.SetAttribute("value", "ExamplePassword!");
                    repeat_password.SetAttribute("value", "ExamplePassword");
    
                    Getmg(c);   //obtain captcha image
                    object o = Clipboard.GetDataObject().GetData("Bitmap"); //Captcha image sits in clipboard
                    pictureBoxs[numberBrowser + 1].Image = (Image)o;
    
                    numberBrowser++;
                }
    Button3 - Submit captcha:
    Code:
                foreach (var c in this.Controls.OfType<WebBrowser>())
                {
                    HtmlElement captcha = c.Document.GetElementById("captcha_code");
    
                    captcha.SetAttribute("value", "" + textBoxs[numberCaptcha].Text + "");
                    numberCaptcha++;
                }    
    Button4 - Click "register"
    Code:
                foreach (var c in this.Controls.OfType<WebBrowser>())
                {
                    c.Document.GetElementById("submit").InvokeMember("Click");
                }    


    Sooo? What should I do?

    - I cant use super fast webrequest, because In some way I cant (my programming skills are not good enough) generate valid captcha.

    - I cant use 30 webBrowsers to increase registering speed, because I can't change ip during session

    - I cant use even 3 webBrowsers, because in some way they are not recognized like Chrome + Firefox. They are not isolated from each other.

    Do you have any idea what could I do?



    I also would like to show you Fiddler requests:

    1. Get register page:
    Code:
    GET http://example.com/register.html HTTP/1.1
    Host: example.com
    Connection: keep-alive
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: **-**,**;q=0.8,en-US;q=0.6,en;q=0.4
    2. Get captcha image:
    Code:
    GET http://example.com/captcha/captcha.jpg?6075259 HTTP/1.1
    Host: example.com
    Connection: keep-alive
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36
    Accept: image/webp,image/*,*/*;q=0.8
    Referer: http://example.com/register.html
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: **-**,**;q=0.8,en-US;q=0.6,en;q=0.4
    Cookie: PHPSESSID=aabsj1gmki20b1am6jfmp26vqhgi45m5

    3. Post register:
    Code:
    POST http://example.com/register.html HTTP/1.1
    Host: example.com
    Connection: keep-alive
    Content-Length: 407
    Cache-Control: max-age=0
    Origin: http://example.com
    Upgrade-Insecure-Requests: 1
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36
    Content-Type: application/x-www-form-urlencoded
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    Referer: http://example.com/register.html
    Accept-Encoding: gzip, deflate
    Accept-Language: **-**,**;q=0.8,en-US;q=0.6,en;q=0.4
    Cookie: PHPSESSID=aabsj1gmki20b1am6jfmp26vqhgi45m5; __gfp_64b=WesbzIfvttqKGf4skZz1yIY12p8BSF2bruF2QVBEZsn.d7; example_ubi=201609101337401638120006; examplezuo_ticket=C2E372688D195908AFCE9B28E404413E0100C4FF119DC34FC7619C2069E8DFDE63490000000000000000D407DD37000000; example_cid=ca9c9c3b5caa456ef451023d68e1d233; ea_uuid=201609101337400254300327; example_cinf=2; _ga=GA1.2.839674745.1473507475; _gat=1
    
    register%5Bemail%5D=sdanjadsjnkasdd%40gmail.com&register%5Bnick%5D=adshadsjasd&register%5Bpassword%5D=Pass123456!&register%5Brepeat_password%5D=Pass123456!&captcha_code=Tk%C5%BAFN%C4%87H&register%5Brules_accepted%5D=1&register%5Bpromo_email_accepted%5D=1&register%5Brules_changed%5D=1&_ws=1920x1080x24&_p=ee6f620109c2a0086626d4bd45b99bf2&_f=d41d8cd98f00b204e9800998ecf8427e&_c=2354c7629ef8b67f5aade98a1d0a3d71
    And WebForms view of post's register
    [​IMG]
     
  2. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,928
    Likes Received:
    1,944
    Home Page:
    Potentially an issue with the character encoding on the socket side?

    As far as I am aware WebBrowser users IE cookies so if you are running 3 at the same time the last 1 to load the page will have the correct cookie set for the captcha & the previous 2 WebBrowser windows will also be using that same captcha cookie.

    I am guessing that after getting the image that you are saving it to your HD & viewing it that way & not loading another captcha image direct from the captcha URL to display?