views:

46

answers:

2

WRITTEN IN JAVA

Im creating a program that connects to a proxy and then tunneling to another server to send TCP packets, this is my code:

{
Socket skt = new Socket(proxy_address, proxy_port);
PrintStream myOutput = new PrintStream(skt.getOutputStream());

String Request = "CONNECT " + host + ":" + 443 + " HTTP/1.0";
String host3 = "Host: " + host + ":" + 443;
myOutput.println(Request + "\r\n" + host3 );
}

Trying to find out why im not getting a response from the proxy server.

A: 

You could also try and take a look at either corkscrew or Proxytunnel, although these are basically SSH over HTTP(S) proxies.

plaes
program is in java lol
Masterban
You can still use these progams to check how packet transfer over HTTP works...
plaes
A: 

You need two more line endings - one to indicate the end of the Host: header, and one for an empty line to indicate the end of the connection request. Try:

myOutput.println(Request + "\r\n" + host3 + "\r\n\r\n");
caf
thanks, works like a charm
Masterban
I actually have one more question, when i start sending the packets i want to the server do i need to do anything special to it? like adding the empty line at the end?
Masterban
@Masterban: No, after you read the response headers from the server (which are terminated with an empty line), if the response code was 200 then you'll have a raw connection with the other side.
caf