ROLLING UPDATE: 20180727a1LATEST
1. Fixed domains ending with punctuation marks.
2. Code cleanup.
ROLLING UPDATE: 20180726a1
1. OFFLINE mode should be fixed.
2. No segfault on DD-WRT v3.0-r36400M kongac (BusyBox v1.29.1) anymore. If it still segfaults on your router, see my last post and replace sort with awk.
How to update if you are on 20180315 or later:
SSH into router
cd /jffs/dnsmasq
./adbhostgen.sh -u
To fix invalid domain
--------------------------------------------------------------
Remove Duplicate Lines with "sort | uniq" not good: I'm using this regex to find duplicate lines : ^(.*?)$\s+?^(?=.*^\1$)
--------------------------------------------------------------
Using current folder to run scripts.
Code:
export MPDIR="$(cd "$(dirname "${0}")" && pwd)"
export TMPDIR="${MPDIR}/tmp"
if [ -d "$T4m" ]
then
rm -rf ${MPDIR};echo "Creating: $MPDIR";mkdir ${MPDIR};
else
echo "Creating: $MPDIR";mkdir ${MPDIR};
fi
ROLLING UPDATE: 20180727a1LATEST
1. Fixed domains ending with punctuation marks.
2. Code cleanup.
ROLLING UPDATE: 20180726a1
1. OFFLINE mode should be fixed.
2. No segfault on DD-WRT v3.0-r36400M kongac (BusyBox v1.29.1) anymore. If it still segfaults on your router, see my last post and replace sort with awk.
How to update if you are on 20180315 or later:
SSH into router
cd /jffs/dnsmasq
./adbhostgen.sh -u
I updated to 36410M and had to update adbhostgen and all is good. Thanks for all your work! _________________ Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9
Off Site 1
R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4
Off Site 2
R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531
Hi Yamaraj, i have installed your script successfully on R7000 with Kongs latest Testbuild.
But i am still seeing YOutube Ads and i dont know how to add more Black lists or how to block the Youtube ads.
Can you guide me pls ? i am not only seeing the Youtube ads but also the Popups during the Video Playback. its very irritating, i had not seen such things when i used ublock in browser. but with your script i cant efficiently block the Youtube ads.
To fix invalid domain
--------------------------------------------------------------
Remove Duplicate Lines with "sort | uniq" not good: I'm using this regex to find duplicate lines : ^(.*?)$\s+?^(?=.*^\1$)
--------------------------------------------------------------
Using current folder to run scripts.
Code:
export MPDIR="$(cd "$(dirname "${0}")" && pwd)"
export TMPDIR="${MPDIR}/tmp"
if [ -d "$T4m" ]
then
rm -rf ${MPDIR};echo "Creating: $MPDIR";mkdir ${MPDIR};
else
echo "Creating: $MPDIR";mkdir ${MPDIR};
fi
Last update incorporated improved parsing and filtering. I'll look at your suggestions and make changes if necessary. Thank you! _________________ Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)
Hi Yamaraj, i have installed your script successfully on R7000 with Kongs latest Testbuild.
But i am still seeing YOutube Ads and i dont know how to add more Black lists or how to block the Youtube ads.
Can you guide me pls ? i am not only seeing the Youtube ads but also the Popups during the Video Playback. its very irritating, i had not seen such things when i used ublock in browser. but with your script i cant efficiently block the Youtube ads.
Am i missing something ?
Since this script blocks ads at domain level, services that stream ads from the same servers as their media cannot be blocked effectively. Case in point: YouTube. You might also need a canvas/JS level ad blocker like uBlock Origin to tackle /some/ ads that work their way around domain level blockers.
This script still blocks about 98% of ads on my systems, including ads in apps and games, which is enough considering not all browsers or mobile devices support ad blockers. _________________ Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)
Posted: Sun Sep 16, 2018 18:54 Post subject: Ad-blocking on DD-WRT
@Yamaraj,
Thank you for all your hard work on Ad-blocking on DD-WRT. I was hoping you could help me out with my issue of trying to get this installed on my router. I have a NETGEAR Nighthawk X10 AD7200 router with Kong DD-WRT v3.0-r36020M std (05/25/1 installed on it. I have a 2 GB USB Drive connected to this router formatted and partitioned in Linux like you mentioned; /jffs (1-2GB), swap (256-512MB), and optionally /opt (1-2GB). I used a windows program to do this formatting because I am running Windows 10 on my laptop. My question is to you is how do I transfer and install the files below from a windows system to this Linux USB drive like you state below in the forum.
1b. Download and extract adbhostgen.7z or adbhostgen.tar.gz into /jffs/dnsmasq directory.
2. Run "./adbhostgen.sh" in /jffs/dnsmasq without quotes.
3. Use --update or -u command line option to update to the latest version. [only available since 20180315]
I am not knowledgeable in Linux so I’m not sure how to accomplish these commands in a windows command I hope you will be able to help me out when you get a chance.
Posted: Mon Sep 17, 2018 5:10 Post subject: Re: Ad-blocking on DD-WRT
Moose wrote:
@Yamaraj,
Thank you for all your hard work on Ad-blocking on DD-WRT. I was hoping you could help me out with my issue of trying to get this installed on my router. I have a NETGEAR Nighthawk X10 AD7200 router with Kong DD-WRT v3.0-r36020M std (05/25/18) installed on it. I have a 2 GB USB Drive connected to this router formatted and partitioned in Linux like you mentioned; /jffs (1-2GB), swap (256-512MB), and optionally /opt (1-2GB). I used a windows program to do this formatting because I am running Windows 10 on my laptop. My question is to you is how do I transfer and install the files below from a windows system to this Linux USB drive like you state below in the forum.
1b. Download and extract adbhostgen.7z or adbhostgen.tar.gz into /jffs/dnsmasq directory.
2. Run "./adbhostgen.sh" in /jffs/dnsmasq without quotes.
3. Use --update or -u command line option to update to the latest version. [only available since 20180315]
I am not knowledgeable in Linux so I’m not sure how to accomplish these commands in a windows command I hope you will be able to help me out when you get a chance.
Thank you
mꝎse
You'll need PuTTY or MobaXTerm if you are using Windows, to access your router via SSH. Once you are in:
1. Create directory /jffs/dnsmasq by typing "mkdir /jffs/dnsmasq" without quotes in terminal.
2. Change to /jffs/dnsmasq: cd /jffs/dnsmasq
3. Type this and hit ENTER:
It should download and save the script in /jffs/dnsmasq
4. Run the script by typing "./adbhostgen.sh" in terminal, without the quotes. Make sure you are in /jffs/dnsmasq directory.
If everything goes well, you'll have all the required files autogenerated in the directory for the script to work. Follow the rest of the instructions. _________________ Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)
Joined: 11 Jun 2015 Posts: 37 Location: Germany/Mexico/China
Posted: Mon Sep 17, 2018 12:31 Post subject: Re: Ad-blocking on DD-WRT
Moose wrote:
@Yamaraj,
Thank you for all your hard work on Ad-blocking on DD-WRT. I was hoping you could help me out with my issue of trying to get this installed on my router. I have a NETGEAR Nighthawk X10 AD7200 router with Kong DD-WRT v3.0-r36020M std (05/25/1 installed on it. I have a 2 GB USB Drive connected to this router formatted and partitioned in Linux like you mentioned; /jffs (1-2GB), swap (256-512MB), and optionally /opt (1-2GB). I used a windows program to do this formatting because I am running Windows 10 on my laptop. My question is to you is how do I transfer and install the files below from a windows system to this Linux USB drive like you state below in the forum.
1b. Download and extract adbhostgen.7z or adbhostgen.tar.gz into /jffs/dnsmasq directory.
2. Run "./adbhostgen.sh" in /jffs/dnsmasq without quotes.
3. Use --update or -u command line option to update to the latest version. [only available since 20180315]
I am not knowledgeable in Linux so I’m not sure how to accomplish these commands in a windows command I hope you will be able to help me out when you get a chance.
Thank you
mꝎse
Hello Moose,
since you haven't had much contact with Linux I suggest you might use WinSCP to access your router and transfer the downloaded adbhostgen.sh.
It is simular to a FTP program or explorer.
Posted: Mon Sep 17, 2018 13:24 Post subject: Ad-blocking on DD-WRT
Thank you Yamaraj and Wickiman. I have used PuTTY and WinSCP in the past I just wasn't sure how to find the USB Drive connected to my router with it being formatted in Linux. I wasn't sure of the path. When I used the jffs folder directly on the memory in the router I didn't have a problem just couldn't find it when it was connected by USB. Does it matter if the USB Drive is formatted in Linux, NTFS or Fat32? Mine is right now in Linux but would change it if one of the others would be better. Thanks for all the help as soon as I get home from work I will give it a shot.
I suggest you read the first post of Yamaraj and follow the link how to format and partition the USB stick.
The UUID you get after the USB is mounted must be filled into the jffs and opt field.
Wickiman
Wickiman,
I had everything set up exactly like the first post and I also had my USB Drive formatted exactly like the first post except it was formatted in ext3 and not ext2. I formatted it in ext2 and everything worked as advertised. Thank you Wickiman and Yamaraj for bearing with me and getting this to work.