3

I have a TCP connection (proxy) that connects through socks4-5 and sends http / https / DNS traffic through it. I need something to share, something to http / https etc. went through tcp connection 1 and dns resolve through tcp connection 2

enter image description here

I tried to create IdTCPServer1 (But I'm not sure on the right track), it connects but nothing sends him. In addition, he hangs on until ReadLn it will not be recorded data, and it is not permissible.

procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var str_str:String;
begin
  str_str:=AContext.Connection.Socket.ReadLn();
  if(str_str<>'') then    Memo1.Lines.Add('#TCP_SERVER: EXECUTE: '+str_str);
mixalbl4
  • 3,507
  • 1
  • 30
  • 44

1 Answers1

0

You need to handle (implement) the socks4/5 server side protocol (See http://tools.ietf.org/rfc/rfc1928.txt). The in the request, you can intercept to port number to see if it is http, dns or whatever. Then you forward the connection according to it.

fpiette
  • 11,983
  • 1
  • 24
  • 46
  • Indy has a `TIdSocksServer` component. – Remy Lebeau Jan 23 '14 at 16:59
  • 1
    This standard does not have a single word about dns, a feeling that officially dns it is not supported! Start byte in DNS request: #05#F0 ... 05 - version socket, F0 - dns request, but wikipedia and rfc1928 not describe this request, wiki says: 0x01 = establish a TCP/IP stream connection 0x02 = establish a TCP/IP port binding 0x03 = associate a UDP port, **but 0xF0 no such** – mixalbl4 Jan 24 '14 at 10:39