tor

How to get HTTPS content using Python Requests through TOR and Privoxy

血红的双手。 提交于 2019-12-06 09:45:30
问题 I have TOR setup on my system with Privoxy that has been tested and works well. What I am trying to do is proxy HTTPS requests through this setup, so that these GET and POSTs come through TOR. Below is the simplest version of the code I could produce: import requests proxy = { 'http':'127.0.0.1:8118','https':'127.0.0.1:8118' } r = requests.get('https://www.whatismyip.com/',proxies=proxy) #r = requests.get('http://www.whatsmyip.org/') print r When using HTTPS, I do not get the response body (r

Selenium WebDriver Change Firefox path to Tor

爷,独闯天下 提交于 2019-12-06 09:34:48
I'm trying to change webdriver in ruby to open a tor browser instead of the default firefox broswer. I'm using the following code and I have a tor browser open before I run this code. path='C:\Users\Bonnnie\Downloads\Tor Browser\App\tor.exe' Selenium::WebDriver::Firefox.path = path driver = Selenium::WebDriver.for :firefox I get the following error: unable to obtain stable firefox connection in 60 seconds I think I might be linking to the wrong tor file. The following worked for me with selenium-webdriver 2.48.1 and Tor Browser Bundle 5.0.3 on Ubuntu Linux 15.04. require 'selenium-webdriver'

Generating private_key and hostname for Tor hidden service, in python

情到浓时终转凉″ 提交于 2019-12-06 09:13:43
问题 #!/usr/bin/env python import OpenSSL.crypto as crypto import sha import base64 KEY_BIT_LENGTH = 1024 ONION_LENGTH = 16 keys = crypto.PKey() keys.generate_key(crypto.TYPE_RSA, KEY_BIT_LENGTH) privkey_as_bytes = crypto.dump_privatekey(crypto.FILETYPE_ASN1, keys) privkey_hash = sha.sha(privkey_as_bytes).digest() onion = base64.b32encode(privkey_hash)[:ONION_LENGTH].lower() + '.onion' print onion print print crypto.dump_privatekey(crypto.FILETYPE_PEM, keys) Am I doing something incorrect here? I

Running python script with TOR

戏子无情 提交于 2019-12-06 07:31:33
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 <module> print(opener.open("http://www.ifconfig.me/ip").read()) File "/usr/lib/python2.7/urllib2.py",

Using Tor + Privoxy to scrape google shopping results: How to avoid block?

人走茶凉 提交于 2019-12-06 05:37:14
问题 I have installed Tor + Privoxy on my server and they're working fine! (Tested). But now when I try to use urllib2 (python) to scrape google shopping results, using proxy of course, I always get blocked by google (sometimes 503 error, sometimes 403 error). So anyone have any solutions can help me avoid that problem? It would be very appreciated!! The source code that I am using: _HEADERS = { 'User-Agent': 'Mozilla/5.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Send and receive via SOCKS5 c++

谁说胖子不能爱 提交于 2019-12-06 04:56:16
问题 I am playing with SOCKS5 proxy ( TOR ). I am able to estabilish connection but now I dont know how to send and receive data to/from destination. Thanks for help. Code: #include <stdio.h> #include <WinSock2.h> #include <stdlib.h> #pragma comment(lib,"ws2_32.lib") #define PUT_BYTE(ptr,data) (*(unsigned char*)ptr = data) int main() { WORD wVersionRequested = MAKEWORD(2,0); WSADATA wsaData; if(WSAStartup(wVersionRequested,&wsaData) != 0 ) { return 1; } int fd = socket( AF_INET, SOCK_STREAM, 0);

Trying to get Tor to work with Python, but keep getting connection refused.?

二次信任 提交于 2019-12-06 02:43:53
问题 I've been trying to get Tor to work with Python, but I've been hitting a brick wall. I simply can't get any of the examples to work. Here is one from Stackoverflow import urllib2 proxy = urllib2.ProxyHandler({'http':'127.0.0.1:8118'}) opener = urllib2.build_opener(proxy) print opener.open('http://check.torproject.org/').read() I've installed Tor and it works fine while browsing through Aurora. However running this python script I get Traceback (most recent call last): File "/home/x/Tor.py",

Authenticating a Controller with a Tor subprocess using Stem

◇◆丶佛笑我妖孽 提交于 2019-12-05 22:49:28
I am trying to launch a new tor process (no tor processes currently running on the system) using a 'custom' config by using stems launch_tor_with_config . I wrote a function that will successfully generate and capture a new hashed password. I then use that new password in the config, launch tor and try to authenticate using the same exact passhash and it fails. Here is the code: from stem.process import launch_tor_with_config from stem.control import Controller from subprocess import Popen, PIPE import logging def genTorPassHash(password): """ Launches a subprocess of tor to generate a hashed

DNS through socks proxy. How do I change windows settings for domain resolution.

↘锁芯ラ 提交于 2019-12-05 21:52:59
I am looking for a program to reroute windows domain resolution lookup through a socks proxy capable with many internet browsers and internet proxies. So far in Control Panel, Local Area Connection 1, TCP/IP Properties, I use the following DNS server addresses, preferred DNS Server, I put 127.0.0.1 and use the default in-built port request 53. I am reading that it is possible to forward this. I can not find a program to forward it through socks 4/5. I think this is possible because Socks supports UDP. Has anyone come up with the answer to a solution about a UDP-to-socks forwarding program

How i can get new ip from tor every requests in threads?

我怕爱的太早我们不能终老 提交于 2019-12-05 14:02:49
I try to use TOR proxy for scraping and everything works fine in one thread, but this is slow. I try to do something simple: def get_new_ip(): with Controller.from_port(port = 9051) as controller: controller.authenticate(password="password") controller.signal(Signal.NEWNYM) time.sleep(controller.get_newnym_wait()) def check_ip(): get_new_ip() session = requests.session() session.proxies = {'http': 'socks5h://localhost:9050', 'https': 'socks5h://localhost:9050'} r = session.get('http://httpbin.org/ip') r.text with Pool(processes=3) as pool: for _ in range(9): pool.apply_async(check_ip) pool