HOSTS file
HOSTS file
There is a good chance you are using a hosts file to block ads, banners, 3rd party Cookies, 3rd party page counters, web bugs, and even most hijackers.
Puppy can provide an app to do just that, it's called Pup Advert Blocker. But if you want to dig into the subject deeper, and see what you can do with a few command lines and a terminal for any desktop environment and Linux OS, have a look at this :
How to do this via a graphical file manager will vary, depending on which file manager and which desktop environment you're using. But, you can do this very easily from the command line, and it's the same for all desktop environments. If you downloaded your new hosts file to your Downloads directory, and called it hosts.txt, you can complete all the steps by entering the following at a command line prompt:
cd Downloads
tr -d '\15\32' < ./hosts.txt > ./hosts.new
su
<enter root password>
cd /etc
cp hosts hosts.bak
cp /home/<your-username>/Downloads/hosts.new /etc/hosts
(Answer "y" when asked if you want to overwrite the hosts file)
Source for this information is found here : http://pclosmag.com/html/Issues/201504/page06.html
Puppy can provide an app to do just that, it's called Pup Advert Blocker. But if you want to dig into the subject deeper, and see what you can do with a few command lines and a terminal for any desktop environment and Linux OS, have a look at this :
How to do this via a graphical file manager will vary, depending on which file manager and which desktop environment you're using. But, you can do this very easily from the command line, and it's the same for all desktop environments. If you downloaded your new hosts file to your Downloads directory, and called it hosts.txt, you can complete all the steps by entering the following at a command line prompt:
cd Downloads
tr -d '\15\32' < ./hosts.txt > ./hosts.new
su
<enter root password>
cd /etc
cp hosts hosts.bak
cp /home/<your-username>/Downloads/hosts.new /etc/hosts
(Answer "y" when asked if you want to overwrite the hosts file)
Source for this information is found here : http://pclosmag.com/html/Issues/201504/page06.html
Explanation:linuxcbon wrote: do you know what the commands are doing at least ?
Code: Select all
cd Downloads
where $HOME is your users home directory
Code: Select all
tr -d '\15\32' < ./hosts.txt > ./hosts.new
Code: Select all
su
<enter root password>
Code: Select all
cd /etc
Code: Select all
cp hosts hosts.bak
Code: Select all
cp /home/<your-username>/Downloads/hosts.new /etc/hosts
( I would do this with -f flag to force overwrite)
Or perhaps you meant more generally that code should be explained
Last edited by Scooby on Wed 15 Apr 2015, 20:08, edited 1 time in total.
If you want check it you could do something likelinuxcbon wrote: And it's not even recommended to download hosts files from anywhere, better do it yourself.
Cheers.
Code: Select all
cat /etc/hosts | grep -v ^0.0.0.0 | grep -v ^\#
That is show the lines that are not comments and are not mapped
to 0.0.0.0
If these doesn't show anything suspicious I wouldn't be scared to
use the hosts file form internet
@Scooby I meant it's not nice to give a code without explanations and which is not so useful, because opening and saving in geany achieves the same result.
It's not recommended to use hosts files from the internet because many servers inside are no longer existing and so the big size of the hosts file will take more ram than needed. And that's why I add or remove servers manually. I even wrote a howto.
@Galbi yes that's it .
It's not recommended to use hosts files from the internet because many servers inside are no longer existing and so the big size of the hosts file will take more ram than needed. And that's why I add or remove servers manually. I even wrote a howto.
@Galbi yes that's it .
Hello, everyone.
In line with linuxcbon's comment:
The authors of winhelp2002.mvps.org are pretty strict and have a heavy
hand. For ex. they block the excellent search engine info.com
(very useful to search rare awk or bash examples, among other things).
To get my info.com back, I had to comment line 3864 of the hosts file
like so:
for Linux man files... I had to send them an e-mail about it. (I was not the
only one who noticed, I'm sure.)
Remember: those guys are well-meaning, but they are WhineDose
experts, not linux users. They put in their hosts file anything that appears
suspicious to a WhineDose user.
@labbe5: Puppy does not use a su or a sudo command. Please adapt
your references to the Puppy environment before you dump them on us.
Thank you. (You do that a lot, unfortunately, whatever the value of the
info you provide...)
@Galbi: I use leafpad to change End-of-Line (EOL) characters to Line-
Feed (LF) only. It's easier and clearer to do than in geany. (Does geany
really do it? Check the file size before and after, you'll see.)
BFN.
musher0
In line with linuxcbon's comment:
The authors of winhelp2002.mvps.org are pretty strict and have a heavy
hand. For ex. they block the excellent search engine info.com
(very useful to search rare awk or bash examples, among other things).
To get my info.com back, I had to comment line 3864 of the hosts file
like so:
A few years back they had blocked die.net, the international repository# 0.0.0.0 ccs.infospace.com
for Linux man files... I had to send them an e-mail about it. (I was not the
only one who noticed, I'm sure.)
Remember: those guys are well-meaning, but they are WhineDose
experts, not linux users. They put in their hosts file anything that appears
suspicious to a WhineDose user.
@labbe5: Puppy does not use a su or a sudo command. Please adapt
your references to the Puppy environment before you dump them on us.
Thank you. (You do that a lot, unfortunately, whatever the value of the
info you provide...)
@Galbi: I use leafpad to change End-of-Line (EOL) characters to Line-
Feed (LF) only. It's easier and clearer to do than in geany. (Does geany
really do it? Check the file size before and after, you'll see.)
BFN.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
I add some of the more annoying ad sites to my routers blocklist...eg google ads and facebook are sooo common.
Check yer routers interface as its nice to do it there if you have several machines....or several systems
linefeeds...there is that perl dos2unix script that seems to be in puppy ...I have used it to deal with sources that won't build dues to similar problem.
Geany tends to maintain whatever the file is/has.
mike
Check yer routers interface as its nice to do it there if you have several machines....or several systems
linefeeds...there is that perl dos2unix script that seems to be in puppy ...I have used it to deal with sources that won't build dues to similar problem.
Geany tends to maintain whatever the file is/has.
mike
yeah well say someone wanted to automate download andlinuxcbon wrote:@Scooby I meant it's not nice to give a code without explanations and which is not so useful, because opening and saving in geany achieves the same result.
install it would be useful to know how to do it from cmdline
I would use the tool suggested by mikeb dos2unix but
now I learnt how to do it with tr
well this certainly sounds like a task that would be easily automated.linuxcbon wrote: It's not recommended to use hosts files from the internet because many servers inside are no longer existing and so the big size of the hosts file will take more ram than needed.
Read hosts file and check if they still exist. Maybe one could use dnslookup for this??????
The problem of good sites being nulled is of course
a little bit annoying but easy enough to edit out in hosts file.
In my opinion the ads are more annoying still.
Anyway I saw musher say that puppy doesn't have su
How do you switch user in puppy then?
Thanks, mikeb.mikeb wrote:I believe he was saying giving examples of code using su would confuse in puppy so need to be edited to suit.... su is usually around. No sudo and its fiddly to make work too as I found on the other hand.Anyway I saw musher say that puppy doesn't have su
How do you switch user in puppy then?
mike
Yeah, I meant: "edit the stuff you quote" for Puppy; adapt it. If you are
posting in the Puppy forum, you should show some knowledge of Puppy.
Unlike me (see paragraph below; shame-shame-shame).
I stand corrected: yep, there is a < su > in Puppy, but no < sudo >.
BFN.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
*DOESN'T WORK ON PUPPY*
Did the automation of checking if servers are no longer exising.
It's a hack
Download it here
The processed_hosts.tar.gz archive contains script for checking a hosts file
and output of a run of it that is a hosts file with dead servers removed
The script check_hosts uses getent to check if servers are alive
Maybe not existent in puppy?? In alphaos I aint got dig or hosts or even
dnslookup. But I guess script could be adapted to use any of them
Takes quite a bit of time to run it
10549 of 29351 servers removed so I guess linuxcbon was right in issue a warning about that
Anyway is there a troll-warning going on in regards to labbe5?
I enjoy his posts in security and think they are informative
Did the automation of checking if servers are no longer exising.
It's a hack
Download it here
The processed_hosts.tar.gz archive contains script for checking a hosts file
and output of a run of it that is a hosts file with dead servers removed
The script check_hosts uses getent to check if servers are alive
Maybe not existent in puppy?? In alphaos I aint got dig or hosts or even
dnslookup. But I guess script could be adapted to use any of them
Takes quite a bit of time to run it
10549 of 29351 servers removed so I guess linuxcbon was right in issue a warning about that
Anyway is there a troll-warning going on in regards to labbe5?
I enjoy his posts in security and think they are informative
Last edited by Scooby on Fri 17 Apr 2015, 20:38, edited 1 time in total.
don't see why... promotes good discussion from my experience..Anyway is there a troll-warning going on in regards to labbe5?
now about the troll warning about me.... the rumours are true.
that would indeed be a lot of wasted overhead.10549 of 29351 servers removed so I guess linuxcbon was right in issue a warning about that
mike
Hi, Scooby.
Thanks for that. I'll be trying it in a minute.
As to labbe5, I don't think he's a troll, far from it. I believe he's well-
meaning, and the info that he provides can indeed be useful, if somewhat
specialized at times. He just needs to be more aware of the PuppyLinux
context and edit his info accordingly, that's all.
BFN.
musher0
Thanks for that. I'll be trying it in a minute.
As to labbe5, I don't think he's a troll, far from it. I believe he's well-
meaning, and the info that he provides can indeed be useful, if somewhat
specialized at times. He just needs to be more aware of the PuppyLinux
context and edit his info accordingly, that's all.
BFN.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Hello again, Scooby.
A couple of thoughts:
* Have you informed the authors of this hosts lists that they have a lot of
dead wood in their list?
* Maybe provide an already processed, ready-to-use, hosts list for the
PuppyLinux newbies, as well as your script?
... script still working...
BFN.
musher0
A couple of thoughts:
* Have you informed the authors of this hosts lists that they have a lot of
dead wood in their list?
* Maybe provide an already processed, ready-to-use, hosts list for the
PuppyLinux newbies, as well as your script?
... script still working...
BFN.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
About the code, yes it doesn't apply to puppy and easier is to save in geany...
I used to use ready-made hosts files but then I used a similar program to Scooby's using dnslookup and noticed too many servers were down. Plus the fact that using such stuff, you lose control of what is going on, they can block sites that you need etc. So I decided to manually create my own hosts file. I wrote a howto and it's easy, the hardest are the 100 first lines. Now it is 1400 lines...but even with 20 lines, you already notice a difference.
I used to use ready-made hosts files but then I used a similar program to Scooby's using dnslookup and noticed too many servers were down. Plus the fact that using such stuff, you lose control of what is going on, they can block sites that you need etc. So I decided to manually create my own hosts file. I wrote a howto and it's easy, the hardest are the 100 first lines. Now it is 1400 lines...but even with 20 lines, you already notice a difference.
nopemusher0 wrote: * Have you informed the authors of this hosts lists that they have a lot of
dead wood in their list?
Actually there was a cleaned hosts filemusher0 wrote: * Maybe provide an already processed, ready-to-use, hosts list for the
PuppyLinux newbies, as well as your script
in the archive availible for download
However it included my hostname I
have to edit and re-upload
*EDIT* edited out my hostname and re-uploaded
SOLVED
SOLVED
My system was setup to always do DNS
Now I created /etc/nsswitch.conf
and added line
Now it will check /etc/hosts first and then if that fails try DNS
The fix also means that my script doesn't work anymore
and since this is default behaviour on puppy my script won't
work on them
------------------------------------------------------------------
I just noticed an ad from googleads.g.doubleclick.net
and thought to manually hack it in my hosts file
But to my chagrin it was already there
how come it isn't blocked?
I have
Also it seems the html is of either version below
Why isn't it blocked?
Also when I try at the cmd line
I get this? Is this some IPv6 trickery?
Any input why Sh** isn't blocked?
I tried adding the site with the www prefix also???
Also tried 127.0.0.1 instead of 0.0.0.0 as suggested in post in linuxcbon
howto thread
My system was setup to always do DNS
Now I created /etc/nsswitch.conf
and added line
Code: Select all
hosts: files dns nis
Now it will check /etc/hosts first and then if that fails try DNS
The fix also means that my script doesn't work anymore
and since this is default behaviour on puppy my script won't
work on them
------------------------------------------------------------------
I just noticed an ad from googleads.g.doubleclick.net
and thought to manually hack it in my hosts file
But to my chagrin it was already there
how come it isn't blocked?
I have
Code: Select all
network.dns.disablePrefetch=true
Also it seems the html is of either version below
Code: Select all
<script src="http://pagead2.googlesyndication.com/pagead/js/r20150414/r20110914/abg.js"></script>
<img src="http://pagead2.googlesyndication.com/simgad/14629189109557694214" class="img_ad" onload="tick('1ad');" border="0" width="200">
Also when I try at the cmd line
Code: Select all
getent hosts pagead2.googlesyndication.com
2a00:1450:400f:803::1019 pagead46.l.doubleclick.net pagead2.googlesyndication.com
Any input why Sh** isn't blocked?
I tried adding the site with the www prefix also???
Also tried 127.0.0.1 instead of 0.0.0.0 as suggested in post in linuxcbon
howto thread
Last edited by Scooby on Fri 17 Apr 2015, 20:37, edited 1 time in total.