i have a problem using C# to search on tor.
This is my code:
some question are commented in the code
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(geckodriver);
service.FirefoxBinaryPath = torPath;
service.BrowserCommunicationPort = 2828;
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\\
var options = new FirefoxOptions();
options.SetPreference("network.proxy.type", 1);
options.SetPreference("network.proxy.socks", "127.0.0.1");
options.SetPreference("network.proxy.socks_port", 9153);
options.AcceptInsecureCertificates = true;
options.AddArgument("--proxy-server=socks5://127.0.0.1:9153");
//vvvvvvvvvvvvvvvvvv-or-^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\
//(I tried these two options and neither worked(not at the same time obviously))
FirefoxProfile profile = new FirefoxProfile(profilePath);
profile.SetPreference("network.proxy.type", 1);
profile.SetPreference("network.proxy.socks", "127.0.0.1");
profile.SetPreference("network.proxy.socks_port", 9153);
profile.SetPreference("network.proxy.socks_remote_dns", false);
var options = new FirefoxOptions
{
Profile = null,
LogLevel = FirefoxDriverLogLevel.Trace
};
options.AddArguments("-profile", profilePath);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\
FirefoxDriver driver;//(what's the difference between this two?)
//??IWebDriver driver??\\ (what's the difference between this two?)
try{driver = new FirefoxDriver(service, options);}
catch (Exception e)
{
MessageBox.Show(e.Message, "Exception");
//driver.Quit();(I don't know why this command doesn't work here)
return false;
}
driver.Navigate().GoToUrl("http://" + link)
//Close the browser when finished
driver.Quit();
I hope someone can help me, i can't see where is the error. In Tor, this is the configuration:
-allowed ports:9153
-marionette enabled and configured to port 2828
The error is: "Cannot start the driver service on http://localhost:(random port)/"