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

Problem with getting the Outlook captcha in C#

Discussion in 'Black Hat SEO' started by epicus2011, Jul 30, 2014.

  1. epicus2011

    epicus2011 Newbie

    Jan 15, 2014
    Likes Received:

    I'm currently working on an Outlook mass e-mail account creator.
    It's looking good so far, except for a small problem: I'm trying to get the captcha, and it always returns a different one.

    Note: The following code is all in c# and might be confusing for anybody who doesn't code in c#.

    Here's the process I use to get the captcha:

    1. Get the CAPTCHA image src from the HTML document
    I'm temporarily using a WebBrowser control in C# because it's easy to work with.
    This step is not a problem:

    HtmlElementCollection images = document.GetElementsByTagName("img");
    HtmlElement captchaElement = images[5];
    String captchaSrc = captchaElement.GetAttribute("src");
    I first get every image in the document, and I know that the captcha image is the 6th image in the document, so I get the source of that image.
    I can't show an example URL because draconian rules here don't allow me to post links yet (what's the point of a forum, really?).

    Anyway, let's continue...

    2. Because Outlook blocks you from accessing the captcha URL above, we need to apply some tricks
    We need to get the query object fID from the URL above and pass it to another URL that then displays some javascript code and contains a value to the actual URL:

    WebClient wc = new WebClient();
    NameValueCollection parsedQuery = HttpUtility.ParseQueryString(captchaSrc);
    String fID = parsedQuery["fid"];
    //had to change this because otherwise i cant post in the forum
    String requestURL = String.Format("--Here would be the URL--?fID={0}", fID);
    String captchaJavascript = wc.DownloadString(requestURL);
    First, I create a WebClient that will then download the source that contains the actual Captcha link. Before I can do that, I need to get the fID from the original captcha that Outlook blocks. I use the Utility for that and parse the query. This all works fine.

    Then, I format the new request. The URL for requestURL is different because that is the internal URL that Outlook uses to check the Captcha. Using String.Format, I attach the fID query we got from the original URL and then download the javascript in the last line.

    3. Getting the actual CAPTCHA url from the downloaded source
    Outlook stores the URL to the actual Captcha in the freaking javascript source. Using some quick hacks (not feeling like using RegEx), I parse the javascript value "imageurl" from the js:

    int firstCharacter = captchaJavascript.IndexOf("imageurl:'");
    String approxURL = captchaJavascript.Substring(firstCharacter + 10, 250);
    String[] splitURL = approxURL.Split('\'');
    String captchaURL = splitURL[0];
    First, I search the javascript for the keyword imageurl: and then remove anything around the URL by 250 characters. I then split the code by the character
    and get the first item from that split array. Ta-Da! We should have the captcha URL!

    ... however, it doesn't work. For some reason, it worked in the browser yesterday and now it doesn't work at all. The final captcha URL returns a completely different captcha.

    Does any hotmail bot developer have any experience working with the captcha? Cracking it won't be a problem, but finding it is.

    Any help is really appreciated.
    • Thanks Thanks x 1