Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Make fetch test work with .onion domains#11988

Merged
Hainish merged 8 commits into
masterEFForg/https-everywhere:masterfrom
unknown repositoryCopy head branch name to clipboard
Aug 25, 2017
Merged

Make fetch test work with .onion domains#11988
Hainish merged 8 commits into
masterEFForg/https-everywhere:masterfrom
unknown repositoryCopy head branch name to clipboard

Conversation

@ghost

@ghost ghost commented Aug 19, 2017

Copy link
Copy Markdown

@ghost ghost changed the title Update fetch.sh Make fetch test work with .onion domains Aug 19, 2017
@ghost

ghost commented Aug 19, 2017

Copy link
Copy Markdown
Author

ping @Hainish.

@cschanaj

Copy link
Copy Markdown
Collaborator

did you try ./fetch-test.sh ./rules/FacebookCoreWWWi.onion.xml locally?

import traceback
import subprocess
import re
from urlparse import urlparse

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see line 5

buf = cStringIO.StringIO()
headerBuf = cStringIO.StringIO()

urlParts = urlparse(url)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe urlParts = urlparse.urlparse(url)?

@ghost

ghost commented Aug 19, 2017

Copy link
Copy Markdown
Author

@cschanaj No, for that I need @Hainish to update Docker base.

@ghost

ghost commented Aug 19, 2017

Copy link
Copy Markdown
Author

@cschanaj Done.

@cschanaj

cschanaj commented Aug 19, 2017

Copy link
Copy Markdown
Collaborator

I get the following result on my local machine with tor installed. Not really sure why though.

$ ./fetch-test.sh ./rules/FacebookCoreWWWi.onion.xml 
INFO Finished comparing http://developers.facebookcorewwwi.onion/ -> https://developers.facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://m.facebookcorewwwi.onion/ -> https://m.facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://www.facebookcorewwwi.onion/ -> https://www.facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://facebookcorewwwi.onion/ -> https://facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://scontent.xx.fbcdn23dssr3jqnq.onion/ -> https://scontent.xx.fbcdn23dssr3jqnq.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
ERROR ./rules/FacebookCoreWWWi.onion.xml: Fetch error: http://developers.facebookcorewwwi.onion/ => https://developers.facebookcorewwwi.onion/: CURLOPT_PROXY
ERROR ./rules/FacebookCoreWWWi.onion.xml: Fetch error: http://m.facebookcorewwwi.onion/ => https://m.facebookcorewwwi.onion/: CURLOPT_PROXY
ERROR ./rules/FacebookCoreWWWi.onion.xml: Fetch error: http://www.facebookcorewwwi.onion/ => https://www.facebookcorewwwi.onion/: CURLOPT_PROXY
ERROR ./rules/FacebookCoreWWWi.onion.xml: Fetch error: http://facebookcorewwwi.onion/ => https://facebookcorewwwi.onion/: CURLOPT_PROXY
ERROR ./rules/FacebookCoreWWWi.onion.xml: Fetch error: http://scontent.xx.fbcdn23dssr3jqnq.onion/ => https://scontent.xx.fbcdn23dssr3jqnq.onion/: CURLOPT_PROXY
INFO Finished in 0.01 seconds. Loaded rulesets: 1, URL pairs: 5.

Also, I expect the timeout value needed to be increased.

@ghost

ghost commented Aug 19, 2017

Copy link
Copy Markdown
Author

@cschanaj Was Tor running?

@ghost

ghost commented Aug 19, 2017

Copy link
Copy Markdown
Author

@cschanaj Try curl -v --socks5-hostname localhost:9050 https://facebookcorewwwi.onion

@cschanaj

Copy link
Copy Markdown
Collaborator

curl -v --socks5-hostname 127.0.0.1:9050 https://facebookcorewwwi.onion works, I guess it is something related to pycurl

c.setopt(c.VERBOSE, options.curlVerbose)
c.setopt(c.SSL_CIPHER_LIST, options.cipherList)
if urlParts.hostname[-6:] == '.onion':
c.setopt(c.CURLOPT_PROXY, '127.0.0.1:9050')

@cschanaj cschanaj Aug 19, 2017

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please replace line 331 and 332 with the following

c.setopt(c.PROXY, 'socks5h://127.0.0.1:9050')

or

c.setopt(c.PROXY, '127.0.0.1')
c.setopt(c.PROXYPORT, 9050)
c.setopt(c.PROXYTYPE, c.PROXYTYPE_SOCKS5_HOSTNAME)

this typo is so difficult to trace...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cschanaj Done. Working now?

@cschanaj

cschanaj commented Aug 19, 2017

Copy link
Copy Markdown
Collaborator

@koops76 AFAIK, it works on my local machine and finished the fetch-test with exit 0. Please run your code at least locally next time, since fetch-test is not triggered by the core code changes.

Linking #11187 (no conflict at the moment)

@ghost

ghost commented Aug 19, 2017

Copy link
Copy Markdown
Author

Try testing a deliberately broken ruleset like replace the hostname with doesntexistdoesn.onion.

@cschanaj

cschanaj commented Aug 19, 2017

Copy link
Copy Markdown
Collaborator

Not really sure if this is good enough. I'd like to leave this for @Hainish to decide. thanks.

$ ./fetch-test.sh ./rules/FacebookCoreWWWi.onion.xml 
INFO Finished comparing http://developers.facebookcorewwwi.onion/ -> https://developers.facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://m.facebookcorewwwi.onion/ -> https://m.facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://www.facebookcorewwwi.onion/ -> https://www.facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://doesntexistdoesn.onion/ -> https://doesntexistdoesn.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://facebookcorewwwi.onion/ -> https://facebookcorewwwi.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
INFO Finished comparing http://scontent.xx.fbcdn23dssr3jqnq.onion/ -> https://scontent.xx.fbcdn23dssr3jqnq.onion/. Rulefile: ./rules/FacebookCoreWWWi.onion.xml.
ERROR ./rules/FacebookCoreWWWi.onion.xml: Fetch error: http://doesntexistdoesn.onion/ => https://doesntexistdoesn.onion/: (7, "Can't complete SOCKS5 connection to 0.0.0.0:0. (4)")
INFO Finished in 63.31 seconds. Loaded rulesets: 1, URL pairs: 6.

P.S. I do not want to get too involved in this since I have other priorities in this project. Thanks for this PR anyway!!

@J0WI

J0WI commented Aug 20, 2017

Copy link
Copy Markdown
Contributor

@koops76 the Docker base can be updated here: https://github.com/EFForg/https-everywhere-docker-base/blob/master/Dockerfile

Edit: Never mind, just found your PR there.

@Hainish

Hainish commented Aug 23, 2017

Copy link
Copy Markdown
Member

@koops76 you can test locally using docker. Just run

sudo docker build -t electronicfrontierfoundation/https-everywhere-docker-base .

Once that image is built on your system, you can then run in this project

sudo docker build -t httpse .
sudo docker run --rm -ti -v $(pwd):/opt httpse bash -c "./fetch-test.sh ./rules/FacebookCoreWWWi.onion.xml"

@ghost

ghost commented Aug 23, 2017

Copy link
Copy Markdown
Author

@Hainish I'm not running Linux, so I can't test it.

@Hainish Hainish merged commit e2f93d0 into EFForg:master Aug 25, 2017
@Hainish

Hainish commented Aug 25, 2017

Copy link
Copy Markdown
Member

Thanks for this!

@ghost ghost deleted the patch-5 branch August 25, 2017 23:32
@ghost

ghost commented Aug 25, 2017

Copy link
Copy Markdown
Author

@Hainish See #11806.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.