jafeha / parabird

Simple script written in python to build an os independent truecrypt encrypted usb-stick containing a portable thunderbird, enigmail, torbirdy and vidalia.
GNU General Public License v3.0
11 stars 7 forks source link

use tor switch #10

Open jafeha opened 11 years ago

jafeha commented 11 years ago

A friend suggested an opt in switch for using Tor while creating the stick. Good thought, thats a paraparabird. I might implement this possibility later. This issue is meant to remind me of that idea.

jojoo- commented 11 years ago

i suggest using a --proxy localhost:port commandline switch.

http://docs.python-requests.org/en/latest/user/advanced/#proxies

jafeha commented 10 years ago

this would be very easy, at least theoretically. i made a simple test with urllib3 (python requests). the problem is, that tor uses a socks proxy, while ullib3 only works with http/https/ftp proxies.

simple code adaptation would look like this and works for http those proxies:

config.ini:
[DEFAULT]
proxy = None
parabird_build.py:
clparser.add_argument("-p", "--proxy", help="Proxy Server: [IP:Port]")
update_config("DEFAULT", "proxy", args.proxy)
utily.py / download_applications
if parser.get("DEFAULT", "proxy") == None:
    proxies = None
else
    proxies = {'http':'parser.get("DEFAULT", "proxy")','https':'parser.get("DEFAULT", "proxy")'}

down = requests.get(url, proxies)
jafeha commented 10 years ago

for further testing, here my python log:

import requests
def proxycheck(proxyvalue):
    if proxyvalue == None:
        proxies=None
        r = requests.get('http://check.torproject.org/', proxies=proxies)
        print r
        print r.content

    else:
        proxies={'http':proxyvalue, 'https':proxyvalue}
        r = requests.get('http://check.torproject.org/', proxies=proxies)
        print r
        print r.content

i would actually suggest that we only support http proxies until urllib3 supports socks5. this is not that difficult. the code here works with privoxy running on port 8118 and forwarding to a locally installed tor node on port 9050. for further information read "I need an HTTP proxy. Where did Polipo go?" and the referenced privoxy example configuration: "How do I use Privoxy together with Tor?".

i'll implement the code as suggested above and see how it works.

jafeha commented 10 years ago

running into the next problem, http proxy works, but https server still fails: http://stackoverflow.com/a/13710154 we might dig a little deeper and try this: http://stackoverflow.com/questions/14390605/python-requests-ssl-issue

jafeha commented 10 years ago

i upgraded urllib3 to v1.6 and requests to v1.2.3 using "pip install --upgrade" but i'm still having this issue. don't know much further.