Jump to content

Local Proxy Server v1.00


ripdad
 Share

Recommended Posts

Sorry if I raise up old theme, but I have started a new project (parental filter: filtering internet traffic for children)

 

And I was advised to try this way (proxy)

Is it possible to  "catch" the address of navigation before the browser is navigated there, so that my other script  could check the destination address and if it is "good" allow further surfing?

 

Link to comment
Share on other sites

topten,

I didn't see your post, sorry. Probably too late now but, the answer to your question is:

That is what this script does and more. It allows you to blacklist or whitelist any website.

There are plugins for Firefox that accomplish about same thing. "Easy Whitelist" is one of them.

There are applications like "NetNanny". Search for them on the net.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

  • 4 weeks later...

While doing some research, I stumbled across a link that had information that I wish I had before I started this thread.

Had I known it, this project would not exist. Oh well, Live and learn and learn.

It's so simple -- I'm embarrassed for not knowing. As a result, I will lose interest for this project. No point going any further with it.

Well, here it is:

http://forums.mozillazine.org/viewtopic.php?f=8&t=287280

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Updated to version 1.00

Stick foot in mouth. I said I would lose interest in this project -- and I did.

Until, I needed some way to heavily test the WSA_NBTCP.au3 UDF, which is included in this version.

Inspiration only comes to me every once in awhile. Gotta seize the moment! Right?

In any case, lots of improvements have been made. Changes are in the header of the script.

Please let me know if you have any problems with it.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

  • 1 month later...

I found a bug in two places with an SRE that I have used for a long time. It showed up when I was testing the K-Meleon browser.

I'm pretty sure it affected another browser too, but I can't remember the name of it at the moment.

In any case, here is the fix for it...

At lines 240 and 513 of this script (v1.00), change the SRE pattern from:

'(?i)(GET|CONNECT|POST|HEAD|PUT|OPTIONS|TRACE)'

To:

'(?i)\b(GET|CONNECT|POST|HEAD|PUT|OPTIONS|TRACE)\b'

---

This will be included in the next version update -- whenever I get more time.

---

If anyone else has noticed a bug or quirk about the script, please share your thoughts or ideas.

 

Edited by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

  • 2 years later...

Hi Ripdad,

i'm using your proxy for a while and it's very powerfull.

Is it any way of getting the response headers?

I've used the function _WSA_TCPRecv($nSocket, $nMaxLen = 65536, $nBinaryMode = 0, $nTimeout = 10) setting $nBinaryMode to 0 to get raw data but I'm not able to get the header fields.

If you can help me I'll appreciate it.

Link to comment
Share on other sites

jcpetu,

You can grab the headers at PrecisionModify() in the script, just before it's processed.

Be aware that you cannot get the secure https headers -- because they are encrypted.

Only the local browser and remote website have that access.

-- edit

If you are trying to get headers for some other script, then that will be a bit more complex.

If so, then I need to know some details about it.

Is it just a query or is it more than that? If more, then I need to know in what way.

.

Edited by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

ripdad,

I found PrecisionModify() is used to get the client browser request headers but, if it is possible, I would like to get the response headers to show in the edit control of the proxy.

 

 

Link to comment
Share on other sites

The majority of websites these days are https (ssl).

The Local Proxy Server does not have the ability to decode these sites, as I hinted in my last post.

If you are just trying to grab normal http headers from the remote server, then you can get them from "Section 6" of the script.

;*** Now Under Active Loop ****************************************************** Section 6
        ;
        ; we sent data from client to remote in previous sections -->
        ; <-- and now we will send data from remote to client.
        ;
        ;
        If $a[$i][$RemoteSocket] > 0 Then; make sure the remote socket is good (4)
            $sRecv = _WSA_TCPRecv($a[$i][$RemoteSocket], 32768, 1, 10); <- 10 second time-out
            $nError = @error
            $nBytesReceived = @extended
            ;
            Switch $nError
                Case 0
                Case 10053, 10054, 10060; client disconnected, remote disconnected, timed-out
                    CloseSocket($i); <- these are common errors, so bypass displaying them, but close socket
                Case Else
                    CloseSocket($i, '[E108] Remote/' & $a[$i][$RemoteHost] & '/' & _WSA_FormatMessage($nError), 1)
            EndSwitch
            ;
            If $nBytesReceived > 0 Then; remote data received
                $nTotalBytesReceived += $nBytesReceived; add to total bytes received
                $Active = 1; reset
                ;
                $sRecv = BinaryToString($sRecv); <============== HERE ======
                _WSA_TCPSend($a[$i][$ClientSocket], $sRecv, 1)
                $nError = @error
                ;
                If $nError Then
                    CloseSocket($i, '[E109] Client/' & $a[$i][$RemoteHost] & '/' & _WSA_FormatMessage($nError))
                EndIf
            EndIf
        EndIf

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

You will need to separate the header from the body. You can split it like this most of the time:

$array = StringSplit($sRecv, @CRLF & @CRLF, 1)

$array[1] holds the header. $array[2] holds the body.

Also, you need to detect if the incoming data is a header or is receiving continuing data before the split.

A header always starts with HTTP/1.1 (or in some cases HTTP/1.0) and then the response code.

For instance: HTTP/1.1 200 OK

That's the best this script can provide. I hope it works out for you -- and you're welcome.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...