6

Is there a simple command to run in a Linux terminal to tell if a proxy is SOCKS or HTTP?

Pylsa
  • 31,383

4 Answers4

3

You could check which of the relevant ports is open (e.g. using telnet). Socks usually uses port 1080, HTTP usually uses 80, 443, 8443 or 8080.

Ofir
  • 1,504
3

Other then just trying if it's SOCKS or HTTP, no , you can't.

To test if it's a http proxy:

set http_proxy = http://1.0.0.1:8080 
wget --proxy=on http://www.google.com/

This will download the html root of google, and if it has correct content, you know it was a http proxy.

sinni800
  • 3,169
1

Use the following shell command with curl to check:

ip=127.0.0.1
port=8080
(timeout 2 curl -x socks5://$ip:$port -qs -o/dev/null http://example.com/ && printf "socks5\t$ip\t$port\n") \
|| (timeout 2 curl -x socks4://$ip:$port -qs -o/dev/null http://example.com/ && printf "socks4\t$ip\t$port\n") \
|| (timeout 2 curl -x http://$ip:$port -qs -o/dev/null http://example.com/ && printf "http\t$ip\t$port\n")

For the full script, check check_proxies.sh file.

kenorb
  • 26,615
0

On my SLES11 VM, I run socklist and grep for the port:

dev-s11:~ # socklist | grep 22
tcp 22 21112 0 4345 3 sshd
tcp 22 10473174 0 32616 3 sshd

That tells me whether it's managed by ssh or not. If you are using default ports, http will be 80 and ssh 22. That will get you started - ask more Qs if you need more specifics.

mbb
  • 2,546
  • 7
  • 27
  • 39