Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading through TOR partially bypasses TOR network. #9677

Closed
zebusr opened this issue Jun 2, 2016 · 7 comments
Closed

Downloading through TOR partially bypasses TOR network. #9677

zebusr opened this issue Jun 2, 2016 · 7 comments

Comments

@zebusr
Copy link

@zebusr zebusr commented Jun 2, 2016

When using the following command to route the download through TOR... the initial part of the transfer that fetches file info still goes over the non-TOR network, i.e. it bypasses TOR.

youtube-dl --external-downloader /usr/local/bin/curl --external-downloader-args '''--socks5 127.0.0.1:9150''' URL

Verified using tcpdump.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 3, 2016

You did not specify --proxy.

@dstftw dstftw closed this Jun 3, 2016
@zebusr
Copy link
Author

@zebusr zebusr commented Jun 3, 2016

@dstftw
Adding proxy helps but there is still are multiple cookies being set.
Now using:
youtube-dl --proxy https://127.0.0.1:9150 --external-downloader /usr/local/bin/curl --external-downloader-args '''--socks5 127.0.0.1:9150''' URL

Try it for yourself... running tcpdump.
sudo /usr/sbin/tcpdump -In -s 0 -w youtub.pcap -vv -i en0

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 3, 2016

Use --proxy socks5://127.0.0.1:9150.

@zebusr
Copy link
Author

@zebusr zebusr commented Jun 3, 2016

@yan12125
OK I tried that. There are still 2 packets that appear to still be either DNS lookup or perhaps an HTTP redirect.

youtube-dl --proxy socks5://127.0.0.1:9150 --external-downloader /usr/local/bin/curl --external-downloader-args '''--socks5 127.0.0.1:9150'''

By the way can you please reopen this ticket until it is resolved?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 3, 2016

I'll test it later and reopen it if I can reproduce it.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 3, 2016

Confirmed. There's at least a DNS lookup not going through Tor but my local DNS server.

@yan12125 yan12125 reopened this Jun 3, 2016
@yan12125 yan12125 added the bug label Jun 8, 2016
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jul 8, 2016

Found the problem - the argument passed to curl is wrong. From curl 7.40's man page: (partial)

       --socks5-hostname <host[:port]>
              Use the specified SOCKS5 proxy (and let the proxy resolve the host name). If the port number  is  not specified, it is assumed at port 1080. (Added in 7.18.0)

              Since  7.21.7,  this  option  is  superfluous  since you can specify a socks5 hostname proxy with -x, --proxy using a socks5h:// protocol prefix.

       --socks5 <host[:port]>
              Use  the specified SOCKS5 proxy - but resolve the host name locally. If the port number is not specified, it is assumed at port 1080.

              Since 7.21.7, this option is superfluous since you can specify a socks5 proxy with -x, --proxy  using a socks5:// protocol prefix.

So a possible combination can be:

youtube-dl -v --proxy socks5://127.0.0.1:9050 --external-downloader /usr/local/bin/curl --external-downloader-args "--proxy socks5h://127.0.0.1:9050" <the URL>

Note that youtube-dl sends DNS lookup requests to SOCKS proxies for socks5:// protocol while curl not. curl uses another protocol name socks5h:// for that.

@yan12125 yan12125 closed this Jul 8, 2016
@yan12125 yan12125 removed the bug label Jul 8, 2016
@yurendry yurendry mentioned this issue Oct 5, 2019
3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.