LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware 11 (1DVD version) - intercept and modify HTTP requests. (http://www.linuxquestions.org/questions/slackware-14/slackware-11-1dvd-version-intercept-and-modify-http-requests-536101/)

ErV 03-09-2007 04:27 PM

Slackware 11 (1DVD version) - intercept and modify HTTP requests.
 
Hello!
I have a specific closed-source (a traffic compression utility) program, that communicate with remote machine via TCP using tunnels. The only acceptable way for me to establish tunnel is to establish it through external http proxy-server.
Unfortunately, this program tries to use "CONNECT" with a port that proxy doesn't allow to use with "CONNECT". I'd like to intercept HTTP requests generated by that program and modify them. I'd like to use (if possible) only utilities included in original distribution (1DVD). I've already written program that (sometimes :)) does what I need, but I'd like to know if there is more "sane" way to do this.
I've searched man pages, the only possible solution was iptables, but it (most likely, but I'm not sure) can't modify data, only redirect it to another address/port and this is not a solution since requests are sent through the proxy, not directly to the target IP.

Here are more details:
1) Program generates only one type of HTTP requests: "CONNECT xyz.xyz.net:8081 HTTP/1.1\r\n\r\n". It never sends any other type of requests. Only "CONNECT" requests and never anything else.

2) To make this request work with my proxy-server I need to replace it with "CONNECT xyz.xyz.net:443 HTTP/1.1\r\n\r\n".

3) Upon arrival of positive answer program will immediately establish tunnel on that port and will begin sending|receiving data. That means, that redirection utility must be able to handle tunnels...

4) It looks like squid isn't included in my distribution.

5) There is no way to replace the traffic compression utility with something else. (I just don't know about any similar utilities with same quality)

6) I can post a source code for my own utility that redirects traffic, if this is necessary to make clear what i need/what i'm talking about...

That's all. How can this be done without writing my own programs?

P.S. I apologize for any language errors in this message. English is not my native language.

duryodhan 03-09-2007 09:41 PM

I think WebScarab might work ... try it out and tell the result! :D

search google for OWASP / WebScarab

ErV 03-15-2007 03:12 AM

Quote:

Originally Posted by duryodhan
I think WebScarab might work ... try it out and tell the result! :D

search google for OWASP / WebScarab

I've tried WebScarab, but (it looks like) it doesn't intercept CONNECT requests (no such method on Proxy pages). And it doesn't work without X (I'd like to start both programs(compressor (it works without X) and "redirector") as a in background during system startup.)

Is there any other way? Like inserting filter into iptables (looks like it's possible to write a separate module or something like this)

I'm looking for small highly specialized utility (can't download a lot right now), or for some small C++ program (with source code) that supports tunnels and can be easily adapted for this task...


All times are GMT -5. The time now is 11:18 PM.