[Solved] TCP/IP DNS file
- Ed_P
- Contributor
- Posts: 8368
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
[Solved] TCP/IP DNS file
On Windows there is the hosts file which allows one to direct host names to specific IP addresses, such as:
127.0.0.1 ad.doubleclick.net
127.0.0.1 advertizing.com
Is there a similar file/function, in Porteus?
127.0.0.1 ad.doubleclick.net
127.0.0.1 advertizing.com
Is there a similar file/function, in Porteus?
Ed
Re: TCP/IP DNS file
sudo gedit /etc/hosts
Examples:
0.0.0.0 www.nastyadserver.ads
0.0.0.0 fr.weliketospyonyou.nowhere
0.0.0.0 m.t.whatisthis.huh
0.0.0.0 ad.server.notagain
https://delightlylinux.wordpress.com/20 ... osts-file/
Is the above info any good?
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: TCP/IP DNS file
Great Guns! Being plagued by these parasites. Had to enable javascript on a site, and as soon as finished stopped all scripts in tab, I thought. Closed tab, then went on to view embedded youtube video with html player, playback jerky, suspected script, but cpu at around 40%, Maybe yt overburdened, tried couple more and no better, but then all of a sudden script went ballistic at 100% cpu. After best part of a minute of frozen computer had to kill browser.
The script here http://www.putorius.net/2012/01/block-u ... ts-on.html looks like a must, which will have to put in guiexec to alleviate some of the script misery.
The script here http://www.putorius.net/2012/01/block-u ... ts-on.html looks like a must, which will have to put in guiexec to alleviate some of the script misery.
In this case have to rely on extensions which block URLs, like SilentBlock, which uses regular expression matching. And using in conjunction with HTTP Request Logger add-on could provide a clearer picture:It could be that a different domain name or even a direct IP address is used for the connection. Some ads are sneaky, so double check. An entry in /etc/hosts might exist for y.lottaspam.fr.m, but the ad could be connecting directly to its server using an IP address. In this case, /etc/hosts will not help.
Code: Select all
guest@porteus:~$ grep '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' Desktop/http-request-log.txt | tail
(none) GET https://www.google.com/gen_204?atyp=i&zx=1493984138491&ei=8GEMWaPCKsvWmwGv9pqQAw&ogf=.40.36.36.40.36.36.&ogrp=&ogv=1493707922.0&ogd=&ogc=DEU&ogl=en-GB&oggv=es_plusone_gc_20170309.0_p0&oge=5&ogex=40400&ogp=23&ogsr=1&ogus=1
(none) GET https://www.google.com/gen_204?atyp=i&zx=1493984141666&ei=8GEMWaPCKsvWmwGv9pqQAw&ogf=.40.36.36.40.36.36.&ogrp=&ogv=1493707922.0&ogd=&ogc=DEU&ogl=en-GB&oggv=es_plusone_gc_20170309.0_p0&oge=9&ogex=40400&ogp=23&ogsr=1&ogus=1&ogad=l.o
(none) GET https://openload.co/stream/l7z-vY25o5Q~1494071353~142.4.0.0~di0bW7db
(none) GET https://openload.co/stream/vBwcg832hng~1494075333~142.4.0.0~ld7I7YAc?mime=true
(none) GET https://openload.co/stream/vBwcg832hng~1494076014~142.4.0.0~g0wdOIov
(none) GET https://openload.co/stream/Je5vXXZ7aes~1494080762~142.4.0.0~IVsq40Sz
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
- Ed_P
- Contributor
- Posts: 8368
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Re: [Solved] TCP/IP DNS file
^
Why don't you try the hosts file Evan suggested?
-edit-
Oh! Just visited the link you posted. Interesting
Code: Select all
root@porteus:/home/guest# grep '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' Desktop/http-request-log.txt | tail
grep: Desktop/http-request-log.txt: No such file or directory
root@porteus:/home/guest# grep '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' Cinnamon/http-request-log.txt | tail
grep: Cinnamon/http-request-log.txt: No such file or directory
-edit-
Oh! Just visited the link you posted. Interesting
Ed
Re: [Solved] TCP/IP DNS file
I think it was on Puppylinux forum that i read something ages ago that said if you start adding a large block lists at system level then it starts adding latency to all network connections where it keeps scanning the blocklist for all connections rather than just the ones your web browser uses.......
The web browser add-on uBlock Origin was recommended as it scored the best on all test results and added very little latency and was lower on resources , the wiki says the same.
https://addons.mozilla.org/en-GB/firefo ... ck-origin/
https://chrome.google.com/webstore/deta ... phjbkeiagm
UBlock Origin
The web browser add-on uBlock Origin was recommended as it scored the best on all test results and added very little latency and was lower on resources , the wiki says the same.
https://addons.mozilla.org/en-GB/firefo ... ck-origin/
https://chrome.google.com/webstore/deta ... phjbkeiagm
UBlock Origin
Technology websites and user reviews for uBlock have regarded the extension as less resource intensive in comparison with extensions that provide similar feature sets such as Adblock Plus.A benchmark test, conducted in August 2015 with ten blocking extensions, showed uBlock Origin as the most resource efficient among extensions tested.
uBlock surveys what style resources are required for an individual web page rather than reliance on a universal style sheet. The extension takes a snapshot of the filters the user has enabled. This contributes to accelerated browser start-up speed when compared to retrieving filters from cache every time.
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: [Solved] TCP/IP DNS file
https://shiftlock.wordpress.com/2011/07 ... a-firefox/Ed_P wrote:^Code: Select all
root@porteus:/home/guest# grep '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' Desktop/http-request-log.txt | tail grep: Desktop/http-request-log.txt: No such file or directory root@porteus:/home/guest# grep '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' Cinnamon/http-request-log.txt | tail grep: Cinnamon/http-request-log.txt: No such file or directory
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: [Solved] TCP/IP DNS file
Offering a script: hoisted.sh
Code: Select all
#!/bin/bash
# if you need to add something to your hosts file you now want to add it to .etc/suphosts
# Uses/Creates a Directory .etc for hosts.txt file and for suphosts
hoisted()
{
[[ -d .etc ]] || mkdir .etc || return 1
wget -O .etc/hosts http://winhelp2002.mvps.org/hosts.txt
sed -i '/^127.0.0.1/a\
# Linux box.\
127.0.0.1 porteus.example.net porteus' .etc/hosts
[[ -f .etc/suphosts ]] && cat .etc/suphosts >> .etc/hosts
sudo ln -sf ~/.etc/hosts /etc/hosts
}
hoisted $*
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
Re: [Solved] TCP/IP DNS file
I'm starting to feel like the new Fullmoonremix
https://www.bleepingcomputer.com/tutori ... -explained
hpguru's HOSTS File can be found here: http://www.hosts-file.net/
The MVPS Host File can be found at: http://www.mvps.org.
Hosts File Project can be found here : http://remember.mine.nu/
https://github.com/gorhill/uBlock
It also includes the above host block list file in this thread and many more.
https://www.bleepingcomputer.com/tutori ... -explained
If you must use a large host file instead of the Ublock Origin browser add-on then you'll find a couple of other url's for host block list in the link above.NOTE: It is important to note that there have been complaints of system slowdowns when using a large hosts file. This is usually fixed by turning off and disabling the DNS Client in your Services control panel under Administrative Tools. The DNS client caches previous DNS requests in memory to supposedly speed this process up, but it also reads the entire HOSTS file into that cache as well which can cause a slowdown. This service is unnecessary and can be disabled.
hpguru's HOSTS File can be found here: http://www.hosts-file.net/
The MVPS Host File can be found at: http://www.mvps.org.
Hosts File Project can be found here : http://remember.mine.nu/
test results for Ublock origin being lower on Cpu and RameDexter - When you block ads on web sites using a HOSTS file, there tends to be empty boxes on the web site you are visiting where the ad would normally have appeared. If this bothers you, you can use the program eDexter to fill in the image with one on your local machine such as a clear image or any other one for that matter. This removes the empty boxes and is quick because the replacement image is loaded off of your hard drive.
Hostess - Hostess is an application that is used to maintain and organize your HOSTS file. This program will read your HOSTS file and organize the entries contained in it into a database. You can then use this database to scan for duplicates and to manage the entries. It is a program that is definitely worth checking out if you plan on using the HOSTS file extensively.
https://github.com/gorhill/uBlock
It also includes the above host block list file in this thread and many more.
- Ed_P
- Contributor
- Posts: 8368
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Re: [Solved] TCP/IP DNS file
hmmmm Bogomips
Maybe
would allow for
Maybe
Code: Select all
#!/bin/bash
# http://forum.porteus.org/viewtopic.php?f=140&t=6908&p=55064#p55061
# if you need to add something to your hosts file you now want to add it to .etc/suphosts
# Uses/Creates a Directory .etc for hosts.txt file and for suphosts
hoisted()
{
[[ -d .etc ]] || mkdir .etc || return 1
wget -O .etc/hosts http://winhelp2002.mvps.org/hosts.txt
sed -i '/^127.0.0.1/a\
# Linux box.\
127.0.0.1 $1 $2' .etc/hosts
[[ -f .etc/suphosts ]] && cat .etc/suphosts >> .etc/hosts
sudo ln -sf ~/.etc/hosts /etc/hosts
}
hoisted $*
Code: Select all
hoisted.sh epiclol.com "# FB pop under ad"
Wouldn't that be only for the 1st time with all subsequent reads from the HOSTS file in the cache?Evan wrote:it also reads the entire HOSTS file into that cache as well which can cause a slowdown.
Ed
Re: [Solved] TCP/IP DNS file
I dunno dude , i'm just the messenger.Ed_P wrote:Wouldn't that be only for the 1st time with all subsequent reads from the HOSTS file in the cache?
Maybe i have this wrong but all i can remember from a couple of years ago was the least preferred method is to use a fixed host file because that means every network connection that has nothing to do with web browsing are also being checked which is a complete waste of time and resources , 1000's of bittorent connections for example.
The preferred method was to only load a block list when the web browser is active.
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: [Solved] TCP/IP DNS file
Okay, battening down the hatches:Evan wrote:The preferred method was to only load a block list when the web browser is active.
- Revised more secure hoisted.sh
Code: Select all
#!/bin/bash # if you need to add something to your hosts file you now want to add it to .etc/suphosts # Uses/Creates a Directory .etc for hosts.txt file and for suphosts hoisted() # Restore original hosts: sudo cp /etc/hosts.bak /etc/hosts { [[ -e /etc/hosts.bak ]] || cp /etc/hosts /etc/hosts.bak || return 2 [[ -d .etc ]] || mkdir .etc || return 1 wget -O .etc/hosts http://winhelp2002.mvps.org/hosts.txt sed -i '/^127.0.0.1/a\ # Linux box.\ 127.0.0.1 porteus.example.net porteus' .etc/hosts [[ -f .etc/suphosts ]] && cat .etc/suphosts >> .etc/hosts sudo cp .etc/hosts /etc/hosts ls -lh /etc/hosts{,.bak} echo -n "Entries: "; wc -l /etc/hosts } hoisted $*
In this manner:Ed_P wrote:would allow forCode: Select all
hoisted.sh epiclol.com "# FB pop under ad"
Code: Select all
guest@porteus:~$ #!/bin/bash guest@porteus:~$ # if you need to add something to your hosts file you now want to add it to .etc/suphosts guest@porteus:~$ # Uses/Creates a Directory .etc for hosts.txt file and for suphosts guest@porteus:~$ hoisted() > # Restore original hosts: sudo cp /etc/hosts.bak /etc/hosts > { > [[ -e /etc/hosts.bak ]] || cp /etc/hosts /etc/hosts.bak || return 2 > [[ -d .etc ]] || mkdir .etc || return 1 > wget -O .etc/hosts http://winhelp2002.mvps.org/hosts.txt > sed -i '/^127.0.0.1/a\ > # Linux box.\ > 127.0.0.1 porteus.example.net porteus' .etc/hosts > [[ -f .etc/suphosts ]] && cat .etc/suphosts >> .etc/hosts > sudo cp .etc/hosts /etc/hosts > } guest@porteus:~$ hoisted $* --2017-05-08 20:50:09-- http://winhelp2002.mvps.org/hosts.txt Resolving winhelp2002.mvps.org... 216.155.126.40 Connecting to winhelp2002.mvps.org|216.155.126.40|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 498107 (486K) [text/plain] Saving to: ‘.etc/hosts’ .etc/hosts 100%[=========================>] 486.43K 337KB/s in 1.4s 2017-05-08 20:50:11 (337 KB/s) - ‘.etc/hosts’ saved [498107/498107] guest@porteus:~$ ls -lh /etc/hosts{,.bak} -rw-r--r-- 1 guest users 487K May 8 20:50 /etc/hosts -rw-r--r-- 1 guest users 786 May 8 20:50 /etc/hosts.bak guest@porteus:~$ tail -n3 /etc/hosts 0.0.0.0 www.winadiscount.com #[Dr.Web.Adware.Xbarre] 0.0.0.0 www.winaproduct.com # [end of entries generated by MVPS HOSTS]
- Already expunges google-analytics parasite. Just prior to this responsible for bringing down system. Script froze browser at 100% cpu and everything else. Killed browser, but upon restart managed to bring down system.
Code: Select all
guest@porteus:~$ grep google-analytics .etc/hosts 0.0.0.0 google-analytics.com 0.0.0.0 ssl.google-analytics.com 0.0.0.0 www.google-analytics.com #[affects Google Trends]
- Add Supplement
Code: Select all
guest@porteus:~$ echo "0.0.0.0 epiclol.com # FB pop under ad" >> .etc/suphosts guest@porteus:~$ cat .etc/suphosts 0.0.0.0 epiclol.com # FB pop under ad guest@porteus:~$ hoisted --2017-05-08 21:15:58-- http://winhelp2002.mvps.org/hosts.txt Resolving winhelp2002.mvps.org... 216.155.126.40 Connecting to winhelp2002.mvps.org|216.155.126.40|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 498107 (486K) [text/plain] Saving to: ‘.etc/hosts’ .etc/hosts 100%[=========================>] 486.43K 360KB/s in 1.3s 2017-05-08 21:16:00 (360 KB/s) - ‘.etc/hosts’ saved [498107/498107] guest@porteus:~$ ls -lh /etc/hosts{,.bak} -rw-r--r-- 1 guest users 487K May 8 21:16 /etc/hosts -rw-r--r-- 1 guest users 786 May 8 20:50 /etc/hosts.bak guest@porteus:~$ tail -n3 /etc/hosts 0.0.0.0 www.winaproduct.com # [end of entries generated by MVPS HOSTS] 0.0.0.0 epiclol.com # FB pop under ad
- Expanded hosts file is some 15000 lines which hardly takes any time to traverse these days, and all hardly takes up any memory relatively speaking, just under half a MiB:
Code: Select all
guest@porteus:~$ wc -l /etc/hosts 15007 /etc/hosts
Last edited by Bogomips on 09 May 2017, 12:28, edited 1 time in total.
Reason: Entry Stats
Reason: Entry Stats
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
- Ed_P
- Contributor
- Posts: 8368
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Re: [Solved] TCP/IP DNS file
So code can't be added to hoisted such that if a non-blank $1 is present it can:Bogomips wrote: [*]Add SupplementCode: Select all
guest@porteus:~$ echo "0.0.0.0 epiclol.com # FB pop under ad" >> .etc/suphosts guest@porteus:~$ cat .etc/suphosts 0.0.0.0 epiclol.com # FB pop under ad guest@porteus:~$ hoisted
Code: Select all
echo "127.0.0.1 $1 $2 $3 $4 $5 $6 $7 $8 $9" >> .etc/suphosts
cat .etc/suphosts
Code: Select all
hoisted.sh epiclol.com # FB pop under ad
And while we are talking about code, how do I get this code
Code: Select all
root@porteus:/home/guest# ls -lght /tmp/mod | awk '{print $4,$5,$6,$7,$8}'
Code: Select all
120 May 8 18:13 var/
160 May 8 15:48 etc/
60 May 8 15:47 usr/
60 May 8 11:46 home/
Code: Select all
120 May 8 18:13 var/
160 May 8 15:48 etc/
60 May 8 15:47 usr/
60 May 8 11:46 home/
Ed
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: [Solved] TCP/IP DNS file
KISSEd_P wrote:Bogomips wrote: So code can't be added to hoisted such that if a non-blank $1 is present it can:Code: Select all
echo "127.0.0.1 $1 $2 $3 $4 $5 $6 $7 $8 $9" >> .etc/suphosts cat .etc/suphosts
DIYEd_P wrote:so a user in a single step can use:Bummer.Code: Select all
hoisted.sh epiclol.com # FB pop under ad
Deserves topic in Programming section. 8)Ed_P wrote:And while we are talking about code, how do I get this codewhich produces:Code: Select all
root@porteus:/home/guest# ls -lght /tmp/mod | awk '{print $4,$5,$6,$7,$8}'
to produce:Code: Select all
120 May 8 18:13 var/ 160 May 8 15:48 etc/ 60 May 8 15:47 usr/ 60 May 8 11:46 home/
Code: Select all
120 May 8 18:13 var/ 160 May 8 15:48 etc/ 60 May 8 15:47 usr/ 60 May 8 11:46 home/
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB