Sign in to follow this  
Followers 0
dinodod

IE content filter

11 posts in this topic

#1 ·  Posted (edited)

Is there any way to develop a local internet filter to remove ads in web sites BEFORE they are seen / access by the client?

I was thinking of setting the proxy settings in the IE client and have it redirected to a local proxy server app running on the client. The app itself would be where the filtering would be done PRIOR to the client so that the client can avoid ads in the HTML

???

Edited by dinodod

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites



Yes, this is very much possible. All you have to do is figure out the proxy protocols and set up a proxy server in AutoIt which will then connect to the internet. I hope you know enough about TCP to do this. It was actually something I was wanting to write for one of the labs in my school, but I had too much homework to do it.

Good luck on this if you ever get started.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Almost looks like I have it. I can see that I am able to send the data but then I don't see any data being returned [$RemoteReceive].

Thoughts ???

TCPStartup ()

Global $myip = "127.0.0.1"
Global $myport = 81

Global $remoteip = TCPNameToIP("www.google.com")
Global $remoteport = 80

Global $rm ; received message
Global $sm ; sent message
Global $iBytes
Global $passkey = "#32342345#32f"
Global $markstart = "~!2!"
Global $markend = "@#$SEEE3112"
Dim $Send2Remote, $RemoteReceive, $Remotelisteningsocket, $RemoteConnectedlisteningSocket


    $listeningsocket = TCPListen ($myip, $myport, 100); define socket
    If $listeningsocket = -1 Then Exit

;Msgbox ( 0, "listen","s")
    
While 1
    $ConnectedlisteningSocket = TCPAccept($listeningsocket);permit incoming
    Msgbox ( 0, "listen",$ConnectedlisteningSocket)
;$rm = _TCPRecieveText ($ConnectedlisteningSocket)
    $rm = TCPRecv ($ConnectedlisteningSocket, 1024)
;Msgbox ( 0, "", $rm & " !!!")
    If $rm <> "" Then
       ;ConsoleWrite ( $rm & " <" & @LF )
       ;Msgbox ( 0, "rm not null", $rm & " <>")
        
        $RemoteSite=TCPConnect($remoteip, $remoteport)
        msgbox(0,"remote connection", $RemoteSite)
        if $RemoteSite=0 OR @ERROR then
            msgbox(0,'Error','could not connect to remote sever')
            exit
        else
            $Send2Remote = TCPSend($RemoteSite,$rm)
        ;msgbox(0,"Sent Data", $Send2Remote & " bytes")

            $Remotelisteningsocket = TCPListen ($remoteIP, $remoteport, 100); define socket
            $RemoteConnectedlisteningSocket = TCPAccept($Remotelisteningsocket);permit incoming
            
            while 2
            ;while $RemoteReceive = ""
                $RemoteReceive = TCPRecv ($RemoteConnectedlisteningSocket, 1024)
                msgbox(0,"received",$RemoteReceive)
            wend
        endif
        
    EndIf
   ;Sleep ("500")
Wend
Edited by dinodod

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hey,

Just wonderin if ur still interested in this cos i've just started working on 1 which partially works just having some trouble getting pages to load. Once i get proxy sorted then i can easily implement a whitelist an blacklist. Could also try other services as well as http.

Post back if ur still interested.

EDIT: btw i'm lookin at ur script

EDIT: I've had look at ur script an i've worked on it but it gets to the same point as mine

This is my script \/

#include <GUIConstants.au3>
#include <Array.au3>

TCPStartup()

$MainSocket = TCPListen("127.0.0.1", 8080)
If $MainSocket = -1 Then Exit

While 1
 Local $ConnectedSocket = -1
 Do
  $ConnectedSocket = TCPAccept($MainSocket)
 Until $ConnectedSocket <> -1
 ConsoleWrite("Browser Connected" & @CRLF)
 Local $msg, $recv
 While 1
  $recv = TCPRecv($ConnectedSocket, 2048)
  If @error Then ExitLoop
  If $recv <> "" Then
   ConsoleWrite("Recived data from browser:-" & @CRLF & $recv & @CRLF & @CRLF)
   MsgBox(0, "TEST", $recv)
   $split1 = StringSplit($recv, "Host: ", 1)
   $split2 = StringSplit($split1[2], @CRLF)
   $ip = TCPNameToIP($split2[1])
   ConsoleWrite("Host IP: " & $ip & @CRLF)
   $socket = TCPConnect($ip, 80)
   TCPSend($socket, $recv)
   $recv = ""
   Do
    $recv2 = TCPRecv($socket, 1000000)
    If $recv2 <> "" Then $recv &= $recv2
   Until $recv <> "" And $recv2 = ""
   ConsoleWrite("Web server data:-" & @CRLF & $recv & @CRLF & @CRLF)
   TCPCloseSocket($socket)
   ConsoleWrite("Disconnected from web server" & @CRLF)
   TCPSend($ConnectedSocket, $recv)
   ConsoleWrite("Sent Data to browser" & @CRLF)
  EndIf
 WEnd
 TCPCloseSocket($ConnectedSocket)
 ConsoleWrite("Disconnected from web browser" & @CRLF)
WEnd

TCPShutdown()
Edited by Gmail

Share this post


Link to post
Share on other sites

Thanks for the comment. I haven't been working on it as my RL has been crazy. I got to look into it more as I am hellbent on wanting to get a proxy app working badly.

If anyone has any further info on this, please advise!

Hey,

Just wonderin if ur still interested in this cos i've just started working on 1 which partially works just having some trouble getting pages to load. Once i get proxy sorted then i can easily implement a whitelist an blacklist. Could also try other services as well as http.

Post back if ur still interested.

EDIT: btw i'm lookin at ur script

EDIT: I've had look at ur script an i've worked on it but it gets to the same point as mine

This is my script \/

#include <GUIConstants.au3>
#include <Array.au3>

TCPStartup()

$MainSocket = TCPListen("127.0.0.1", 8080)
If $MainSocket = -1 Then Exit

While 1
 Local $ConnectedSocket = -1
 Do
  $ConnectedSocket = TCPAccept($MainSocket)
 Until $ConnectedSocket <> -1
 ConsoleWrite("Browser Connected" & @CRLF)
 Local $msg, $recv
 While 1
  $recv = TCPRecv($ConnectedSocket, 2048)
  If @error Then ExitLoop
  If $recv <> "" Then
   ConsoleWrite("Recived data from browser:-" & @CRLF & $recv & @CRLF & @CRLF)
   MsgBox(0, "TEST", $recv)
   $split1 = StringSplit($recv, "Host: ", 1)
   $split2 = StringSplit($split1[2], @CRLF)
   $ip = TCPNameToIP($split2[1])
   ConsoleWrite("Host IP: " & $ip & @CRLF)
   $socket = TCPConnect($ip, 80)
   TCPSend($socket, $recv)
   $recv = ""
   Do
    $recv2 = TCPRecv($socket, 1000000)
    If $recv2 <> "" Then $recv &= $recv2
   Until $recv <> "" And $recv2 = ""
   ConsoleWrite("Web server data:-" & @CRLF & $recv & @CRLF & @CRLF)
   TCPCloseSocket($socket)
   ConsoleWrite("Disconnected from web server" & @CRLF)
   TCPSend($ConnectedSocket, $recv)
   ConsoleWrite("Sent Data to browser" & @CRLF)
  EndIf
 WEnd
 TCPCloseSocket($ConnectedSocket)
 ConsoleWrite("Disconnected from web browser" & @CRLF)
WEnd

TCPShutdown()

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

@All

A proxy was already made by someone else.

I don't know who but here it is.

Server

TCPStartup()
 
$hc = TCPConnect("192.168.0.100",9050)          ; Socks4a Proxy Server
 
$sReq = Chr(0x04) _                                     ; Protocol version  4
      & Chr(0x01) _                                     ; Command Code    1 - establish a tcp/ip stream connection
      & Chr(0x00) & Chr(0x50) _                         ; Port        80
      & Chr(0x00) & Chr(0x00) & Chr(0x00) & Chr(0xFF) _ ; Ip Adress   Invalid - 0.0.0.255
      & "" & Chr(0x00) _                         ; User Id      Empty
      & "www.mamma.com" & Chr(0x00)                     ; Host Name   www.mamma.com

; Send Request to Proxy
ConsoleWrite("! Request: " & Hex(BinaryString($sReq)) & @CR)
TCPSend($hc,$sReq)

; Wait for the Reply
While 1
    $sBuff = TCPRecv($hc,1)
    If @error Then Exit @ScriptLineNumber
    If StringLen($sBuff) > 0 Then ExitLoop
    Sleep(100)
WEnd

$sBuff &= TCPRecv($hc,8)
ConsoleWrite("!   Reply: " & Hex(BinaryString($sBuff)) & @CR)

; Check for errors
Switch StringMid(Hex(BinaryString($sBuff)),3,2)
    Case "5A"
        ConsoleWrite("> request granted" & @CR)
    Case "5B"
        ConsoleWrite("> request rejected or failed" & @CR)
        Exit @ScriptLineNumber
    Case "5C"
        ConsoleWrite("> request failed because client is not running identd (or not reachable from the server)" & @CR)
        Exit @ScriptLineNumber
    Case "5D"
        ConsoleWrite("> request failed because client's identd could not confirm the user id string in the request" & @CR)
        Exit @ScriptLineNumber
EndSwitch

; Send Http Request to mamma and Search for "AutoIt"
$sReq  = "GET /Mamma?query=AutoIt HTTP/1.0" & @CRLF & @CRLF
ConsoleWrite("! Request:" & @CR & $sReq & "---------------------------------" & @CR)
TCPSend($hc,$sReq)

; Wait for the Reply
ConsoleWrite("Receiving Data ")
$sRepy = ""
While 1
    $sBuff = TCPRecv($hc,1024*5)
    If @error Then ExitLoop
    If StringLen($sBuff) > 0 Then
        $sRepy &= $sBuff
        ConsoleWrite(".")
    EndIf
    Sleep(100)
WEnd

; Parse Reply
$iHeadEnd = StringInStr($sRepy,@CRLF & @CRLF) + 2
$sRepyHead = StringMid($sRepy,1,$iHeadEnd)
$sRepyBody = StringMid($sRepy,$iHeadEnd)

ConsoleWrite(@CR & "! Reply:" & @CR & $sRepyHead & "---------------------------------" & @CR)

; Save Result to disk
$hFile = FileOpen("socks.htm",2)
FileWrite($hFile,$sRepyBody)
FileClose($hFile)

ConsoleWrite("Reply Body stored in .\socks.htm (" & Round(StringLen($sRepyBody)/1024,2) & "Kb)" & @CR)oÝ÷ Ø)bz{ZºÚ"µÍÈËÝÝÝËËÜËÜÜËÜÌNL[ÔÝ

BÌÍÜÝHBÌÍÜÛØÚÙ]HÔÛÛXÝ
    ÌÎNÎK    ÌÎNË
MÌ
HÈKHÛØÚÍHÞBÌÍØÛYH ÌÎNÐÓQÓÓPÕ
LLKL
ÌÑUÈÌKIÌÎNÈ  [ÈÔÈ
LLKL
ÌH]]Ú]ØÜÛÛBÔÙ[
    ÌÍÜÛØÚÙ] ÌÍØÛY
BÚ[H
JBY
    ÌÍÜÝHJH[    ÌÍÜÜÝHÔXÝ    ÌÍÜÛØÚÙ]
LLBY
    ÌÍÜÜÝ  ÉÝÈ  ][ÝÉ][ÝÊH[ÙÐÞ
    ][ÝÉ][ÝË    ÌÍÜÜÝB[Y[YÑ[

Ii hope this can help you get going.

regards

ptrex

Share this post


Link to post
Share on other sites

Share this post


Link to post
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
Sign in to follow this  
Followers 0