Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Based on the long search in net I came to know that SOCKS uses a handshake protocol to inform the proxy software about the connection that the client is trying to make, and then acts as transparently as possible, whereas an HTTP proxy may interpret and rewrite headers. And we can use both as well.

What I want to know is, how can we find if the proxy is HTTP, SOCKS4, SOCKS4a or SOCKS5? Is there any way to find out? And I can guess that we can't differ it based on port number because there are lot of port numbers available for each of the types. Please help me to differ the proxy based on HTTP or SOCKS.

share|improve this question

1 Answer 1

Try this little python script:

$ cat get_version.py 
#!/usr/bin/python

import struct
import socket
import sys


try:
        server = sys.argv[1]
        port = sys.argv[2]
except:
        print "Usage: server port"

try:
        sen = struct.pack('BBB', 0x05, 0x01, 0x00)
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect(( server , int( port )  ))
        s.sendall(sen)
        data = s.recv(2)
        s.close()
        version, auth = struct.unpack('BB', data)
        print 'server : port  is  ', server, ':', port, '; varsion: ', version
except Exception as e:
        print e
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.