Ad blocking implementation

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

foreverstorm
Posts: 20
Joined: Mon Aug 24, 2009 2:17 pm

Ad blocking implementation

Postby foreverstorm » Tue May 28, 2013 7:25 am

Hi, I have tried to make a universal adblock on my gargoyle WR1043ND router running the latest 1.5.10-ar71xx firmware, but I haven't got it working quite right yet and need some help.

I got a block list from winhelp2002.mvps.org/hosts.htm and added it to the etc/hosts file using WinSCP. That works fine - but I find the messages saying url cannot be found in place of the ads still annoying.

I wanted to implement a pixelserv from proxytunnel.sourceforge.net/pixelserv.php, but I can't get it to run. In /etc/init.d/pixelserv I have the (set to be executable) code

Code: Select all

#!/bin/sh /etc/rc.common

START=100

SERVICE_DAEMONIZE=1

start() {
       service_start /sbin/pixelserv.pl
}


and in usr/sbin/pixelserv.pl I have the (1.0 daemon) code

Code: Select all

#! /usr/bin/perl -Tw

use IO::Socket::INET;

$crlf="\015\012";
$pixel=pack("C*",qw(71 73 70 56 57 97 1 0 1 0 128 0 0 255 255 255 0 0 0 33 249 4 1 0 0 0 0 44 0 0 0 0 1 0 1 0 0 2 2 68 1 0 59));

$sock = new IO::Socket::INET (  LocalHost => '0.0.0.0',
                                LocalPort => '80',
                                Proto => 'tcp',
                                Listen => 30,
                                Reuse => 1);

if (!defined($sock)) {
        print "error : cannot bind : $! exit\n";
        exit(1);
}

while ($new_sock = $sock->accept()) {
       while (<$new_sock>) {
              chop;chop;
#             print "$_\n";
              if ($_ eq '') { last; }
       }
        print $new_sock "HTTP/1.1 200 OK$crlf";
        print $new_sock "Content-type: image/gif$crlf";
        print $new_sock "Accept-ranges: bytes$crlf";
        print $new_sock "Content-length: 43$crlf$crlf";
       print $new_sock $pixel;
        shutdown($new_sock,2);
       undef($new_sock);
}

close($sock);
exit(0);
 


It doesn't make a difference, however.

If it's too difficult to setup on the router - I also have a synology nas that might be able to host it, but I'm not sure how that would be done.

Any ideas?

User avatar
powerlogy
Posts: 66
Joined: Wed Aug 22, 2012 12:04 pm
Location: Turkey

Re: Ad blocking implementation

Postby powerlogy » Tue May 28, 2013 9:05 am

Done that with a second ip interface on router,firewall rule and a web server.

There was a openwrt topic about that on openwrt forums.
Here is the link : https://forum.openwrt.org/viewtopic.php ... 51#p197151

foreverstorm
Posts: 20
Joined: Mon Aug 24, 2009 2:17 pm

Re: Ad blocking implementation

Postby foreverstorm » Tue May 28, 2013 11:06 am

Thanks, that looks like what I'm after. But I'm stuck at the second block of commands; as soon as I enter uci add uhttpd uhttpd I get the message uci: Entry not found. Is there something else I need to do first?

lakyljuk
Posts: 5
Joined: Sat Jun 01, 2013 6:15 pm

Re: Ad blocking implementation

Postby lakyljuk » Sun Jun 02, 2013 12:44 pm

I would like to have this solution working as well, because I have the same router and would like to get rid of adblock chrome extension in every computer behind router. If some one experienced could advice, how to make it work, it would be appreciated, thanks.

Lukas


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests