tor

General SOCKS server failure when switching identity using stem

守給你的承諾、 提交于 2019-11-27 03:39:51
问题 I have Tor running on a remote server (Ubuntu) on port 9150 with the control port on 9151. I've confirmed both are running via netstat -ant. Here is my code which is eliciting the SOCKS5Error: 0x01: General SOCKS server failure error. import socks import socket socks.set_default_proxy(socks.SOCKS5, server_ip, 9150) socket.socket = socks.socksocket I can make requests from any library and successfully get responses back with a tor ip address. However the following is what causes the error:

Python urllib over TOR? [duplicate]

爷,独闯天下 提交于 2019-11-27 00:42:48
This question already has an answer here: How to route urllib requests through the TOR network? [duplicate] 3 answers Sample code: #!/usr/bin/python import socks import socket import urllib2 socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, "127.0.0.1", 9050, True) socket.socket = socks.socksocket print urllib2.urlopen("http://almien.co.uk/m/tools/net/ip/").read() TOR is running a SOCKS proxy on port 9050 (its default). The request goes through TOR, surfacing at an IP address other than my own. However, TOR console gives the warning: "Feb 28 22:44:26.233 [warn] Your application (using socks4 to

Scrapy with Privoxy and Tor: how to renew IP

烈酒焚心 提交于 2019-11-27 00:30:57
问题 I am dealing with Scrapy, Privoxy and Tor. I have all installed and properly working. But Tor connects with the same IP everytime, so I can easily be banned. Is it possible to tell Tor to reconnect each X seconds or connections? Thanks! EDIT about the configuration: For the user agent pool i did this: http://tangww.com/2013/06/UsingRandomAgent/ (I had to put a _ init _.py file as it is said in the comments), and for the Privoxy and Tor I followed http://www.andrewwatters.com/privoxy/ (I had

Make requests using Python over Tor

时光毁灭记忆、已成空白 提交于 2019-11-26 23:23:21
I want to make multiple GET requests using Tor to a webpage. I want to use a different ipaddress for each request. import socks import socket socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 9150) socket.socket = socks.socksocket import requests print (requests.get('http://icanhazip.com')).content Using this, I made one request. How can I change the ipaddress to make another? Here is the code you want to use (download the stem package using pip install stem ) from stem import Signal from stem.control import Controller with Controller.from_port(port = 9051) as controller: controller

Open tor browser with selenium

橙三吉。 提交于 2019-11-26 22:36:51
问题 Is it possible to make selenium use the TOR browser? Does anyone have any code they could copy-paste? 回答1: Don't use the TBB, just set the correct proxy settings in whatever browser you're using. In FF for example, like this: #set some privacy settings ff_prof.set_preference( "places.history.enabled", False ) ff_prof.set_preference( "privacy.clearOnShutdown.offlineApps", True ) ff_prof.set_preference( "privacy.clearOnShutdown.passwords", True ) ff_prof.set_preference( "privacy.clearOnShutdown

How to route urllib requests through the TOR network? [duplicate]

孤者浪人 提交于 2019-11-26 22:36:43
问题 This question already has answers here : How to make urllib2 requests through Tor in Python? (12 answers) Closed 3 years ago . How to route urllib requests through the TOR network? 回答1: This works for me (using urllib2, haven't tried urllib): def req(url): proxy_support = urllib2.ProxyHandler({"http" : "127.0.0.1:8118"}) opener = urllib2.build_opener(proxy_support) opener.addheaders = [('User-agent', 'Mozilla/5.0')] return opener.open(url).read() print req('http://google.com') 回答2: Tor works

How to change the Tor exit node programmatically to get a new IP?

巧了我就是萌 提交于 2019-11-26 22:32:31
问题 I have Tor running on my computer, and I need to change the Tor exit node every five minutes. For example, if I start using Tor via some exit node, then in 5 minutes I want Tor to change to an exit node with a different IP address. How can I do this? Tor, as far as I know, is listening to port 8051 on localhost. What commands can I send to this port to make Tor build a new chain, so that I can get another IP address? 回答1: (echo authenticate '""'; echo signal newnym; echo quit) | nc localhost

Using Selenium WebDriver with Tor

烈酒焚心 提交于 2019-11-26 15:54:48
问题 Because Tor Browser Bundle is just a patched version of Firefox, it seems that it should be possible to use a FirefoxDriver with Tor Browser. This is what I've tried so far: String torPath = "C:\\Users\\My User\\Desktop\\Tor Browser\\Start Tor Browser.exe"; String profilePath = "C:\\Users\\My User\\Desktop\\Tor Browser\\Data\\Browser\\profile.default"; FirefoxProfile profile = new FirefoxProfile(new File(profilePath)); FirefoxBinary binary = new FirefoxBinary(new File(torPath)); FirefoxDriver

How to connect to Tor browser using Python

徘徊边缘 提交于 2019-11-26 15:30:39
I am trying to connect to a Tor browser but get an error stating "proxyConnectFailure" any ideas I have tried multiple attempts to get into the basics of Tor browser to get it connected but all in vain if any could help life could be saved big time: from selenium import webdriver from selenium.webdriver.firefox.firefox_profile import FirefoxProfile from selenium.webdriver.firefox.firefox_binary import FirefoxBinary binary = FirefoxBinary(r"C:\Users\Admin\Desktop\Tor Browser\Browser\firefox.exe") profile = FirefoxProfile(r"C:\Users\Admin\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser

How can I connect to a Tor hidden service using cURL in PHP?

匆匆过客 提交于 2019-11-26 14:57:04
问题 I'm trying to connect to a Tor hidden service using the following PHP code: $url = 'http://jhiwjjlqpyawmpjx.onion/' $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_PROXY, "http://127.0.0.1:9050/"); curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); $output = curl_exec($ch); $curl_error = curl_error($ch); curl_close($ch); print_r($output); print_r($curl_error); When I run it, I get the following error: Couldn