C# MultiThreaded MultiProxy Support browser?

ilPatrino

Junior Member
Joined
Sep 6, 2011
Messages
133
Reaction score
15
I've been doing lots of botting recently & I am now in need of a web browser that supports multiple proxies(You can open multiple browsers & assign a different proxy to each). I'm already using Watin and it's awesome but it can only accept one proxy at a time so cannot be multithreaded. Any of you guys know of a C# library that can do this?
 
The short answer is, you can't.

As far as I'm aware you can't use multiple web browsers on multiple. The web browser control is an ActiveX component that can only work on a singular threaded application. The work around to this would probably be to spawn each browser instance off as it's own process and use a named pipe server to communicate to each instance (more hassle than it's worth for what you're trying to do).

The proxy that the web browser control is using comes from the registry, for the internet explorer settings. You will have to derive your own browser object and handle the connection yourself.

But to be honest with you, you are FAR better off using HttpWebRequest.
 
Last edited:
I'm not sure if it's possible, but may I ask, why would you want to? A web browser in c# is very clunky and takes up a lot of ram and bandwidth. Much better just to use httpwebrequests, they are much faster and you can easily create multiple threads with them.
 
Maybe with another web browser component, like Chrome (eg. delphi chromium embedded component).
I have not tried.

Beny
 
No.

check out some of my past posts about this for more detail.
 
I would use httpwebrequest but the registration processes on most websites are using ajax nowadays and its a pain in the ass to make it work using httpwebrequest
 
I would use httpwebrequest but the registration processes on most websites are using ajax nowadays and its a pain in the ass to make it work using httpwebrequest

It's easier than you think.

Just add the header "X-Requested-With: XMLHttpRequest"
 
but let's say for example there's a captcha that's being generated by the use of ajax, taking a value from the page, then making the call & receiving the captcha, what would you do?
 
but let's say for example there's a captcha that's being generated by the use of ajax, taking a value from the page, then making the call & receiving the captcha, what would you do?

Look at your fiddler trace, note what order the requests are in. If they are sending data thats generated from the page you need to either A: scrape that data and send it in your requests, B: mimic whatever function is generating it.
 
at the end of the day be it normal requests, json, ajax, or whatever it all follows a standard request/response model and can be spoofed. it's just a matter of diligent packet logging and replication.
 
It is possible to manually specify a proxy setting for each instance of the internet explorer process. This way, it is possible to have multiple browser windows, each using their own unique proxy. You must use the DLL urlmon.dll.
 
the best choice is HttpWebRequest :)
WebBrowser Control is not for multi thread purposes , or deep tasks in web.
 
HttpWebRequest/HttpWebResponse have bugs, but are better than the browser.
There are some things that will be very hard to achieve with the above classes, for example some websites generate complex strings with java script for example registering an yahoo account. I have an utility class that extends WebClient, it handles the HttpWebRequest/HttpWebResponse logic, but it is easier to work with.
Code:
sing System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;


namespace Utility
{
    public class WebClientEx : WebClient
    {
        static WebClientEx()
        {
            ServicePointManager.Expect100Continue = false;
            ServicePointManager.ServerCertificateValidationCallback = (RemoteCertificateValidationCallback)((object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) => true);
            ServicePointManager.DefaultConnectionLimit = 1000;
        }


        public WebClientEx()
            : base()
        {
            this.AllowAutoRedirect = true;
            this.Cookies = new CookieContainer();
        }


        protected override WebRequest GetWebRequest(Uri address)
        {
            HttpWebRequest request = base.GetWebRequest(address) as HttpWebRequest;
            if (request.Method == "POST")
            {
                request.ContentType = "application/x-www-form-urlencoded";
            }
            request.AutomaticDecompression = DecompressionMethods.GZip;
            request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12";
            request.CookieContainer = this.Cookies;
            request.AllowAutoRedirect = this.AllowAutoRedirect;
            request.Timeout = 10000;
            return request;
        }


        public bool AllowAutoRedirect { get; set; }
        public CookieContainer Cookies { get; set; }
    }
}
More functionallity can be added too, the only problem is handling multipart/form-data.
 
Last edited:
The thing with httpwebrequest sometimes is that you need variables from javascript functions. This is especially problematic when creating a bot to create accounts so a web browser based bot would be better. I'm sure that a multithreaded & multi proxy browser is possible as zennoposter is doing this.
 
The thing with httpwebrequest sometimes is that you need variables from javascript functions. This is especially problematic when creating a bot to create accounts so a web browser based bot would be better. I'm sure that a multithreaded & multi proxy browser is possible as zennoposter is doing this.

Zennoposter's browser is not multithreaded, for each 'thread' they start a new process which has the browser control. Then the new process communicates with zennoposter via WCF to share the required automation data. They recently switched to https://bitbucket.org/geckofx/geckofx-8.0/ it seems though, so play around with that. Or http://awesomium.com/ is a possibility too(ubot uses it)
 
So they sell a library witch has webkit statically linked. This is against webkit's LGPL license if they don't provide the source code or the binary files that allows you to link the library with webkit yourself.
I would not throw money at this.

Well it's free unless you make over $100k in a year. :)
 
Back
Top