cointop icon indicating copy to clipboard operation
cointop copied to clipboard

Problem when trying to use Cointop through Proxychains+TOR

Open tuqueque opened this issue 3 years ago • 15 comments

Hello, I'm having trouble trying to run Cointop through Proxychains ( https://github.com/rofl0r/proxychains-ng ) and TOR... I have Proxychains configured to run with TOR, like here: https://www.linuxfordevices.com/tutorials/linux/proxychains-and-tor ... I have used Proxychains in other programs and it works flawlessly.

Since Cointop doesn't have options to configure the way it connects, I use Proxychains... but when I do it, it runs, but it doesn't show any data nor updates... I tried with the --clean parameter, but still no luck.

Greets!

tuqueque avatar Sep 18 '21 15:09 tuqueque

cointop uses golang net/http library, which in turn uses $HTTPS_PROXY environment variable to select a http proxy - see https://pkg.go.dev/net/http#ProxyFromEnvironment for details

Can you fetch something like https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1 from the command line, using the same proxy setup? (say using "curl"). That's basically what cointop does.

simon-anz avatar Sep 19 '21 00:09 simon-anz

Based on the output, I don't know if it works... This is what I get when I run the command through curl:

[computer@one ~]$ curl https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1
[2] 423448
[1]   Done                    proxychains curl https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd
[computer@one ~]$ {"error":"Missing parameter days"}

And this is what I get then I run the command through Proxychains:

[computer@one ~]$ proxychains curl https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1
[1] 423495
[computer@one ~]$ [proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.15
[proxychains] Dynamic chain  ...  127.0.0.1:9050  ...  api.coingecko.com:443  ...  OK
{"error":"Missing parameter days"}

I ran the command now with wget instead of curl and this is what I get:

[computer@one ~]$ wget https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1
[1] 424376
[computer@one ~]$ 
Redirecting output to ‘wget-log’.

And this is what I get with wget and Proxychains:

[computer@one ~]$ proxychains wget https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1
[2] 424392
[1]   Exit 8                  wget https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd
[computer@one ~]$ [proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.15

Redirecting output to ‘wget-log.1’.
[proxychains] Dynamic chain  ...  127.0.0.1:9050  ...  api.coingecko.com:443  ...  OK

[2]+  Exit 8                  proxychains wget https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd

tuqueque avatar Sep 19 '21 03:09 tuqueque

The issue is that your shell is taking the & character, and splitting the command in two (both curl and wget). Wrap it in single quotes.

$ curl -s 'https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1' -o data.json
$ head -c 500 data.json
{"prices":[[1631952583808,48879.69971668649],[1631952919139,48840.96228556279],[1631953154388,48813.15357138733],[1631953498452,48788.53039221487],[1631953765087,48761.03405959092],[1631954086794,48777.81476853832],[1631954397465,48804.24364375673],[1631954652089,48830.05260666326],[1631954882621,48804.83575054058],[1631955301402,48737.975700730974],[1631955645377,48726.18292288302],[1631955812466,48763.78779898194],[1631956210380,48791.574659233054],[1631956507148,48803.50008167907],[163195682

simon-anz avatar Sep 19 '21 08:09 simon-anz

Oh, such a stupid mistake... Sorry, evidently I'm not the most savvy when it comes to the Terminal and CLI applications.

Anyway, now I can confirm it works ok in both cases... (truncated output)

curl 'https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1'
{"prices":[[1631973288700,48481.28717050702],[1631973620833,48513.03115597146],[1631973881771,48571.753422922404]...

And:

proxychains curl "https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1"
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.15
[proxychains] Dynamic chain  ...  127.0.0.1:9050  ...  api.coingecko.com:443  ...  OK
{"prices":[[1631973288700,48481.28717050702],[1631973620833,48513.03115597146],[1631973881771,48571.753422922404]...

tuqueque avatar Sep 19 '21 14:09 tuqueque

What happens when you run cointop? Does it display the front-page table and chart, or just hang at the command line? Or does it display "no coin data"?

Try running "DEBUG=true cointop" then checking /tmp/cointop.log for errors?

Which version of cointop are you using? (run cointop -v)

The debug output from cointop, in the case of errors, is not awesome. Do you have an environment where you can make changes and build the code, if we suggest some patches for this?

simon-anz avatar Sep 19 '21 22:09 simon-anz

@tuqueque any updates?

lyricnz avatar Sep 30 '21 21:09 lyricnz

Hey, sorry for not responding (yet)... I've been super busy with work this whole week... Let me get back to you over the weekend.

Although I'm a Linux (Manjaro) user, I'm not familiar with building stuff from source or applying patches, you'd have to give me more or less detailed instructions, but I'm interested in helping and I'm sure I'll learn useful stuff, :)

tuqueque avatar Oct 01 '21 00:10 tuqueque

It should be fairly simple: you'll need golang development tools, and "git" to fetch code from a source repository. I'll download Manjaro into a VM, and try and walk you through it.

lyricnz avatar Oct 01 '21 01:10 lyricnz

Install "make" and "go" packages. Open a command prompt. Run the below to get a fresh copy of the source code, compile it, and run it.

git clone https://github.com/cointop-sh/cointop.git
cd cointop
make
./bin/cointop
Screen Shot 2021-10-01 at 11 46 23 am

Let us know once you get here. We can provide instructions for modifying code, rebuilding, etc, which may help diagnose your issue. (I've never used Proxychains or TOR, btw)

lyricnz avatar Oct 01 '21 01:10 lyricnz

@tuqueque any updates there?

lyricnz avatar Oct 13 '21 07:10 lyricnz

Hey, once again, sorry for the delay in responding and helping. These couple of weeks have been crazy with work. Hopefully next week I'll be able to help you with this.

BTW, the latest version of Cointop is awesome! I love the improved price graph!

tuqueque avatar Oct 15 '21 18:10 tuqueque

Lots of recent changes! https://github.com/cointop-sh/cointop/releases

lyricnz avatar Oct 15 '21 21:10 lyricnz

Sorry to bug you again @tuqueque - can you provide any more details?

lyricnz avatar Nov 07 '21 21:11 lyricnz

@lyricnz @tuqueque

It works with torsocks in arch linux with this command:

torsocks cointop

Make sure to start Tor first:

tor

Maybe use systemd if you want Tor to run on system boot.

arch-btw avatar Mar 28 '22 21:03 arch-btw

@lyricnz @tuqueque

It works with torsocks in arch linux with this command:

torsocks cointop

Make sure to start Tor first:

tor

Maybe use systemd if you want Tor to run on system boot.

Hey, this works!... I don't know why I didn't try Torsocks before!... Thank you very much!

Sorry for not responding before to the comments in this thread. I really didn't have the time to do a proper testing of the previous suggestions... But anyways, I guess we can close this issue, since Torsocks works and is a perfectly viable "workaround".

Thanks again!

tuqueque avatar Mar 30 '22 00:03 tuqueque