ad-blocking with JFFS2 filesystem - manually edit hostlist

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Goto page 1, 2  Next
Author Message
psykotrance
DD-WRT Novice


Joined: 25 Apr 2013
Posts: 6

PostPosted: Thu Apr 25, 2013 1:58    Post subject: ad-blocking with JFFS2 filesystem - manually edit hostlist Reply with quote
Hi to everyone, i will explain how to configure your DD-WRT for ad-blocking using JFFS filesystem to manually import your adblock hostlist.

1) Open your web browser and Login to your router by entering its ip address:
http://192.168.1.1 or whatever

2) Go to Aministration/Management/JFFS2 Support
JFFS2 -> enable
Clean JFFS2 -> enable
Hit Apply settings button

3) Go to Services/services/Secure Shell
SSHd -> enable
SSH TCP Forwarding -> Disable
Password login -> enable (your router login pass)
Port -> 22
Authorized Keys -> 'empty'
Hit Apply settings button

4) Now we will create a good hosts.txt file based on MVPS and YOYO lists.
Go http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts;showintro=0&useip=0.0.0.0 and select from first line "0.0.0.0 101com.com" to the end and copy paste in a new txt document called hosts.txt
To import MVPS hosts with the correct format, that is '0.0.0.0 host.example' you will need to run a linux computer and execute this code on a terminal:
Code:
wget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 |
   sed '2,$s/127.0.0.1/0.0.0.0/g; s/[[:space:]]*#.*$//g;' |
   grep -v localhost | tr ' ' '\t' |
   tr -s '\t' | tr -d '\015' | sort -u > hosts.txt

Now you can merge both YOYO and MVPS hostslist all in the same hosts.txt

5) Now is time to add to the list whatever hosts you want to block, as pornography, other pourposes or just a webpage you dont want to see more.

6) When hosts.txt is ready you want to upload and save it on your router,
Download and install WinSCP program from:
http://winscp.net/eng/download.php

7) Run WinSCP, in the main window type:
- Select protocol SCP
- Your router ip (192.168.1.1)
- Port (22, as default)
- Login: root (always is root)
- Password: your router login password
- Now a new windows opens where you can browse your PC and your router filesystems, in the router side go up to / and find /jffs directory, open it, and uplad here your hosts.txt file.

Cool Now login the router from browser again and go to:
- Administration/commands
- Copy paste this script:
Code:
#!/bin/sh
if test -s /jffs/hosts.txt
then
grep addn-hosts /tmp/dnsmasq.conf ||
   echo "addn-hosts=/jffs/hosts.txt" >>/tmp/dnsmasq.conf
killall dnsmasq
dnsmasq --conf-file=/tmp/dnsmasq.conf       
fi

- Hit Save Startup button

9) Go to Administration/management/cron
- Cron -> enable
- Aditional cron jobs -> * 1 * * * root /tmp/.rc_startup
- Hit Apply settings button

10) Go to Services/Services/DNSMasq
- DNSMasq -> Enable
- Local DNS -> Enable
- Additional DNSMasq Options -> 'empty'
- Hit apply setting button
- Hit reboot router button

11) To test if the configuration is working we can run a terminal (Windows key + R, cmd, Intro) and type:
- nslookup zedo.com
- Will see our router giving the ip 0.0.0.0 for that zedo.com domain, if not it's because something is wrong

Finally we are on bussiness! blocking advertisements from hosts.txt file.
The advantage of this system is that we can edit the block list as we want, and even add our own ideas to block any domain we want, and then upload it to the router again easily using WinSCP program.
The router loads on memory the list always (even offline)
We can add any tematic hostlist, as tracker domains, adult content domains, and other good ideas.
A personal observation i found is that facebook uses "connect.facebook.net" to track us on a lot of sites having this "like" links, so i added this domain to hosts file Smile

Hope this post helped you to configure your ad-blocking on your DD-WRT routers in a different way!!
Sponsor
Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Wed May 08, 2013 19:02    Post subject: Reply with quote
Hello dear psykotrance,

Is there an easier way to do this for us Mac users(cough cough).
Wink

T.I.A.
psykotrance
DD-WRT Novice


Joined: 25 Apr 2013
Posts: 6

PostPosted: Wed May 08, 2013 19:20    Post subject: Reply with quote
Pamela wrote:
Hello dear psykotrance,

Is there an easier way to do this for us Mac users(cough cough).
Wink

T.I.A.


There are 2 ways for ad-blocking, you can do it at Network level tweaking your router as i explained in this post, another way is at Computer, editing your hosts.ics file (using Windows and Internet explorer) or installing an addon on your internet browser, like Ad Block Plus (for Firefox or Chrome).

Im sorry that im not experimented with Mac OS but you can try using a search engine.
I think that your best solution (and easier) is not to tweak a router, but possibly the best way for you is install an addon for your Safari browser.
Try Safari AdBlock at http://safariadblock.com/

If you mean that you are trying to do what i explain in the post, the only problem you can have is:
1) you need to download and install a SCP client for MAC
2) To download the MVPS host list in correct format, you will need Linux, so you can try to download any light Linux distribution, install it to a USB pendrive, and run it from the USB, see http://www.pendrivelinux.com for that.
Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Wed May 08, 2013 19:33    Post subject: Reply with quote
Thanks for the quick response!

Yes I already have a browser plugin that is suppose to block ads but thought I could take it farther by tweaking ddwrt a bit.

Sadly, I am not savvy enough to figure it out on a linux.

Thank you,

Pamela
psykotrance
DD-WRT Novice


Joined: 25 Apr 2013
Posts: 6

PostPosted: Wed May 08, 2013 20:16    Post subject: Reply with quote
Pamela wrote:
Thanks for the quick response!

Yes I already have a browser plugin that is suppose to block ads but thought I could take it farther by tweaking ddwrt a bit.

Sadly, I am not savvy enough to figure it out on a linux.

Thank you,

Pamela


If you want to try tweak your ddwrt and your problem is linux, i can send to you or post here the MVPS list in the correct format and you can upload it directly to your router, or merge it with the YOYO list and upload it. Let me a moment and i will post here...

ok ready here in attachments



hosts.txt
 Description:
Updated MVPS host list 21 May 2013

Download
 Filename:  hosts.txt
 Filesize:  387.06 KB
 Downloaded:  1588 Time(s)


hosts.txt
 Description:
MVPS list in correct format for DD-WRT DnsMasq config (updated 02-04-2013)

Download
 Filename:  hosts.txt
 Filesize:  389.7 KB
 Downloaded:  1459 Time(s)



Last edited by psykotrance on Wed May 29, 2013 1:25; edited 1 time in total
Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Wed May 08, 2013 20:40    Post subject: Reply with quote
psykotrance, you’re a sweetheart!
Without abusing your time I better learn how to upload the file you posted.
I m taking some serious notes right now..LOL

T.I.A.
psykotrance
DD-WRT Novice


Joined: 25 Apr 2013
Posts: 6

PostPosted: Wed May 08, 2013 21:17    Post subject: Personal HOSTS.TXT files Reply with quote
Ok Pamela, hope you finally got it working!

I decided to upload 2 personal hosts list.

List-1 is a small list of hosts of the most famous trackers and information thieves operating in internet now, some of then are:
- Facebook
- Google (Gmail, Youtube, Android...)
- Yahoo
- Microsoft
- others...
They all have dedicated servers about getting personal information about us as statitics, they move lot of money only by tracking what we are doing on internet.

So List-1 is a personal investigation on my personal internet usage on a research for seeying what are the most used DNS url's while browsing, you can do this by using OpenDNS.com and watching wich domains your router visited. Lot of this domains are those trackers.

Microsoft.txt is a Microsoft dedicated list in case of you dont want to allow any contact with microsoft servers done by your Windows OS automatically, for example:
- Always you got internet conection on your PC (through www.msftncsi.com)
- Every day you have a scan on your computer for updates (even if you disabled the service!) and they always look for piratery!
(note: using Microsoft.txt on your hosts.txt file wont allow your windows to update)

I will try to maintain List-1 updated here.
dont hessitate to make any sugestion for this list.



Microsoft.txt
 Description:
Microsoft dedicated hostlist

Download
 Filename:  Microsoft.txt
 Filesize:  700 Bytes
 Downloaded:  187 Time(s)


List-1.txt
 Description:
Common trackers and other hosts that doesnt appear on MVPS and YOYO lists

Download
 Filename:  List-1.txt
 Filesize:  616 Bytes
 Downloaded:  144 Time(s)

Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Thu May 09, 2013 0:39    Post subject: Reply with quote
Hello again psykotrance,

Thank you so very much for the files!
I still am looking at how to upload these files to the router.

Again I very much appreciate your time.

T.I.A.

Pamela
psykotrance
DD-WRT Novice


Joined: 25 Apr 2013
Posts: 6

PostPosted: Thu May 09, 2013 1:29    Post subject: Reply with quote
Pamela wrote:
Hello again psykotrance,

Thank you so very much for the files!
I still am looking at how to upload these files to the router.

Again I very much appreciate your time.

T.I.A.

Pamela


To upload the files to the router you need to enable JFFS2 and SSH as i explain in the post.
After, you will need a SCP client, as you use MAC you should try to use: http://www.rbrowser.com/
When installed, try to connect to your router with their ip (192.168.1.1) login name is "root" and password is your current router password. Remember to specify you want a SCP (or SSH) connection.
Once you get the router filesystem, search for the /jffs directory and copy there your "hosts.txt" file.
Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Thu May 09, 2013 1:33    Post subject: Reply with quote
Thank you psykotrance,

I will follow your advice/instructions and report the good new.

T.I.A.
Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Thu May 09, 2013 5:03    Post subject: Reply with quote
Up and running psykotrance!

Thank you so much dear friend:)
Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Sat May 11, 2013 13:25    Post subject: Reply with quote
Hello again my friend:)

I had a ghost in the machine and desktop crashed.
Now that I am back and running I want to add my newest modified hosts file to the /jffs directory.

When trying to upload I get an error message, I have tried a few times. Would I need to change permissions or something?

T.I.A.
psykotrance
DD-WRT Novice


Joined: 25 Apr 2013
Posts: 6

PostPosted: Tue May 14, 2013 2:27    Post subject: Reply with quote
Pamela wrote:
Hello again my friend:)

I had a ghost in the machine and desktop crashed.
Now that I am back and running I want to add my newest modified hosts file to the /jffs directory.

When trying to upload I get an error message, I have tried a few times. Would I need to change permissions or something?

T.I.A.


If you have problems uploading into /jffs directory, try to do this:

Go to Administration, management, JFFS2 Support ->
JFFS2 -> Enable
Clean JFFS2 -> Enable
Hit Apply settings
Hit Reboot router

Your JFFS2 partition will be "reformated".
Your current hosts.txt file hosted into the router will be erased.

But possibly, when you want to upload again you wont have any problem.

Be sure that you have SSH enabled
Pamela
DD-WRT Novice


Joined: 21 May 2010
Posts: 35

PostPosted: Tue May 14, 2013 2:55    Post subject: Reply with quote
Thank you again!
Smile
spanman
DD-WRT User


Joined: 27 Sep 2008
Posts: 445
Location: Port Of Spain

PostPosted: Sun Jun 09, 2013 17:16    Post subject: Reply with quote
thank you working good for me.
_________________
Buffalo WZR-600DHP - 23838
TP Link WDR3600 - 21676
Linksys WRT54G-TM - 12548 (NEWD Eko Mega)
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum