使用Firefox配置文件和tor守护程序不起作用 [英] using the Firefox Profile and the tor daemon doesn't work
本文介绍了使用Firefox配置文件和tor守护程序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Tor浏览器绕过审查,但是使用Firefox Profile和Tor守护程序不起作用.这是我的代码:
I want to use tor browser to bypass censorship but using the Firefox Profile and the tor daemon doesn't work. here's my code:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
import os
torexe = os.popen(r'C:\Users\fathollahy\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe')
profile = FirefoxProfile(r'C:\Users\fathollahy\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default')
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
profile.set_preference("network.proxy.socks_remote_dns", False)
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile= profile, executable_path=r'geckodriver.exe')
driver.get("http://check.torproject.org")
浏览器快照: 无效
,普通网站无法打开,只能加载. 我从此处获得了代码.
and normal sites don't open and just loading. I got the code from here.
推荐答案
实际上,您应该将sock_port更改为9150.
Actually, You should change the sock_port to 9150.
这篇关于使用Firefox配置文件和tor守护程序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文