tor

General SOCKS server failure with python tor but working from tor browser

喜欢而已 提交于 2019-12-25 08:04:10
问题 I would like to use tor from python to automate requests. I made a test with a page to check IP and it works. I then pointed to the site I want to, and apparently they avoid a tor endpoint because (see stack trace below) - but it works from tor browser. Any better way to debug response of browser? (e.g. connection refused) Which things I am missing to query from python instead than from browser? I am trying with something like: socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 , "127.0.0.1", 9150

Request new identify from tor in javascript

落花浮王杯 提交于 2019-12-25 05:22:44
问题 In PHP you would do something like this: function tor_new_identity($tor_ip='127.0.0.1', $control_port='9051', $auth_code='') { $fp = @fsockopen($tor_ip, $control_port, $errno, $errstr, 30); if(!$fp) { return false; //can't connect to the control port } fputs($fp, "AUTHENTICATE $auth_code\r\n"); $response = fread($fp, 1024); list($code, $text) = explode(' ', $response, 2); if ($code != '250') return false; //authentication failed //send the request to for new identity fputs($fp, "signal NEWNYM

How to generate a tor service onion address from the public key in java?

久未见 提交于 2019-12-24 16:15:24
问题 I am trying to generate the onion address that is generated from a public key. If the following line is added to the code in a previous post, just after privateKeyEncoded String publicKeyEncoded = encoder.encodeToString(publicKey.getEncoded()); When I put the privateKeyEncoded into the /var/lib/tor/hidden_service/private_key , save the publicKeyEncoded and start the tor service, a new onion address is created. I am trying to get the same onion address as the tor service and from one created

How to initiate Tor Browser using Selenium and Python

浪尽此生 提交于 2019-12-24 16:07:32
问题 I m trying to open the webpage in Tor Browser using Python Code: # Start :Code For TOR Browser from selenium import webdriver from selenium.webdriver.firefox.firefox_profile import FirefoxProfile from selenium.webdriver.firefox.firefox_binary import FirefoxBinary from selenium.webdriver.common.desired_capabilities import DesiredCapabilities # path to TOR binary binary = FirefoxBinary(r'C:\\Tor Browser\\Browser\\firefox.exe') # binary = FirefoxBinary(r'C:\\Program Files (x86)\\Vidalia Bridge

Torify connection and change exit node programmatically

梦想的初衷 提交于 2019-12-24 12:43:29
问题 I am writing a PHP script that basically loops thru some data I have stored in my database. The two main important fields for this project are 'url' and 'country'. Basically what I am trying to do is loop thru all of these URLs and determine which links are broken (using some PHP resolver, but isn't important to know for this problem). However the issue I am having is that you cannot access a URL that is assigned to a certain country, unless you have an IP address coming from that country. I

Unable to use Stem and Tor in Python to change my IP address?

有些话、适合烂在心里 提交于 2019-12-24 08:22:45
问题 I am currently trying to follow the a script I found online here: Periodic Tor IP Rotation The code I am trying to use is the following: import requests from stem import Signal from stem.control import Controller with Controller.from_port(port = 9051) as controller: controller.authenticate() controller.signal(Signal.NEWNYM) proxies = { "http": "http://127.0.0.1:8118" } headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7

Python - Using socket.gethostbyname through proxy

丶灬走出姿态 提交于 2019-12-23 09:33:59
问题 I'm using TOR to proxy connections but am having difficulty proxying DNS lookups via socket.gethostbyname("www.yahoo.com") -- I learned that it was not sending DNS traffic via proxy by sniffing traffic with wireshark. Here's a copy of the code I'm using import StringIO import socket import socks # SocksiPy module import stem.process from stem.util import term SOCKS_PORT = 7000 socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', SOCKS_PORT) socket.socket = socks.socksocket def

How do I get the IP address of the TOR entry node in use

假如想象 提交于 2019-12-23 02:18:43
问题 I've been poking around at ways to map tor, and to look at how addresses get allocated but I need to be able to know the IP address of the entry node that I'm using at any given time. Not really sure where to start as I'm not more than a journeyman programmer (python) and tend to learn bits and pieces as necessary. Any pointers to commands to use would b emuch appreciated. I did think that running wireshark on an intermediate node might be the easiest way but needs an extra machine that I don

How to set socks5 proxy in dryscrape python?

♀尐吖头ヾ 提交于 2019-12-23 00:46:09
问题 I want to scrap some website through tor. Tor works uses socks proxy. I use dryscrape(library in python) as it also executes javascripts as well. But I dryscrape can have only http proxy. Is there some work around to set socks5 proxy for dryscrape or any other way out? Thanks. 回答1: I managed to do it using polipo. It can be installed on ubuntu from here. Polipo can speak socks protocol as well as http protocol. Polipo can be configured to receive requests through http proxy and forward the

Running python script with TOR

烂漫一生 提交于 2019-12-22 18:25:21
问题 Hello Guys! At first I want to assure that there is similar topics but there is no accepted answer or clear response. So I want to combine them and ask again. I have following script: import urllib2 proxy = urllib2.ProxyHandler({"http":"127.0.0.1:9050"}) opener = urllib2.build_opener(proxy) print(opener.open("http://www.ifconfig.me/ip").read()) I want to run it anonymously, using with tor for example. But it gives this error: Traceback (most recent call last): File "python_tor.py", line 5, in