[Solved] TCP/IP DNS file

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 3423
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: [Solved] TCP/IP DNS file

Post#16 by Ed_P » 09 May 2017, 14:38

This works. :good:

Code: Select all

#ls -lght /tmp/mod   | awk '{ if ($4 < 100) $4 = " "$4 } {print $8,"\t",$5,$6,$7,"\t",$4}'
 ls -lght /tmp/mod   | awk '{ if ($4 < 100) $4 = " "$4 } {print $5,$6,$7,$4,$8}'
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: [Solved] TCP/IP DNS file

Post#17 by Bogomips » 12 May 2017, 15:51

A Last Enhancement
  • 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
        [[ -f .etc/suphosts ]] && sed  "s/^/0.0.0.0\t\t/" .etc/suphosts >> .etc/hosts
        sudo  cp  .etc/hosts   /etc/hosts
        ls -lh /etc/hosts{,.bak}
        echo -n "Entries: "; wc -l /etc/hosts
    }
    hoisted $*
    
  • Code: Select all

    guest@porteus:~$ . $g/hoisted.sh
    --2017-05-12 14:04:55--  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   243KB/s    in 2.0s    
    
    2017-05-12 14:04:58 (243 KB/s) - ‘.etc/hosts’ saved [498107/498107]
    
    -rw-r--r-- 1 guest users 487K May 12 14:04 /etc/hosts
    -rw-r--r-- 1 guest users  786 May 12 14:04 /etc/hosts.bak
    Entries: 15006 /etc/hosts
    
  • Homemade Hosts

    Code: Select all

    guest@porteus:~$ cat >> .etc/suphosts
    epiclol.com         # FB pop under ad
    apis.google.com     # Ballistic Script!
    ^D
    
  • Update Addon

    Code: Select all

    guest@porteus:~$ . $g/hoisted.sh                      
    --2017-05-12 14:27:33--  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  36.8KB/s    in 13s
    
    2017-05-12 14:27:47 (37.3 KB/s) - ‘.etc/hosts’ saved [498107/498107]
    
    -rw-r--r-- 1 guest users 487K May 12 14:27 /etc/hosts
    -rw-r--r-- 1 guest users  786 May 12 14:04 /etc/hosts.bak
    Entries: 15008 /etc/hosts
    
  • Verify

    Code: Select all

    guest@porteus:~$ ping apis.google.com
    PING apis.google.com (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.037 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.060 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.049 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.043 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.037 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.109 ms
    ^C
    --- apis.google.com ping statistics ---
    6 packets transmitted, 6 received, 0% packet loss, time 5110ms
    rtt min/avg/max/mdev = 0.037/0.055/0.109/0.026 ms
    
    :twisted:
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

User avatar
Ed_P
Contributor
Contributor
Posts: 3423
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: [Solved] TCP/IP DNS file

Post#18 by Ed_P » 14 May 2017, 23:00

:x
hostupdate.sh

Code: Select all

#!/bin/sh
if [ "$1" != "" ]; then 
   echo "127.0.0.1 " $1 " # " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 >> .etc/suphosts
   cat .etc/suphosts | tail -n 2
fi
hoisted.sh
:twisted:
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: [Solved] TCP/IP DNS file

Post#19 by Bogomips » 14 May 2017, 23:51

^

Code: Select all

guest@porteus:~$ tst() { h=$1; shift;  echo $h \# $*;}
guest@porteus:~$ tst To be or not to be?
To # be or not to be?
Timing Spinoff

Code: Select all

guest@porteus:~$ ping apis.google.com
PING apis.google.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.040 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.044 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.045 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.044 ms
64 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 time=0.038 ms
Giving an idea of the amount of time taken to traverse 15000 entries, something less than 26 microseconds. 8)
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

User avatar
Ed_P
Contributor
Contributor
Posts: 3423
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: [Solved] TCP/IP DNS file

Post#20 by Ed_P » 15 May 2017, 00:21

hmmmm

Code: Select all

guest@porteus:~$ tst() { echo $1 "#" $*;} 
guest@porteus:~$ tst That is the question.
That # That is the question.
guest@porteus:~$  
:o
Ed

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: [Solved] TCP/IP DNS file

Post#21 by Evan » 15 May 2017, 00:51

Bogomips wrote:Giving an idea of the amount of time taken to traverse 15000 entries, something less than 26 microseconds. 8)
MVPs is an incomplete block list and Google is a fairly blank page? Image

https://filterlists.com
No single block lists is complete and a lot have over 30,000 Unique domains each..

What about when you load up 20 plus tabs with busy webpages such as.....

https://www.mail.com/int
https://www.thesun.co.uk
https://www.thetimes.co.uk
http://www.dailymail.co.uk/home/index.html
https://www.theguardian.com/uk
http://www.telegraph.co.uk
http://www.mirror.co.uk
http://www.express.co.uk
http://www.dailystar.co.uk
http://www.independent.co.uk
http://metro.co.uk
http://www.standard.co.uk
http://www.huffingtonpost.co.uk

and so on >......................

User avatar
Ed_P
Contributor
Contributor
Posts: 3423
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: [Solved] TCP/IP DNS file

Post#22 by Ed_P » 15 May 2017, 04:11

Bogomips wrote:

Code: Select all

guest@porteus:~$ tst() { h=$1; shift;  echo $h \# $*;}
guest@porteus:~$ tst To be or not to be?
To # be or not to be?
Very clever. :good:

hostupdate.sh

Code: Select all

#!/bin/sh
if [ "$1" != "" ]; then
   U=$1; shift; echo "127.0.0.1 " $U " #" $* >> .etc/suphosts
   cat .etc/suphosts | tail -n 2
fi
hoisted.sh
:) :beer:
Ed

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: [Solved] TCP/IP DNS file

Post#23 by Evan » 13 Jul 2017, 08:26

https://github.com/antiX-Linux/advert-block-antix
https://github.com/antiX-Linux/advert-b ... -advert.sh

@ Bogomips »

I just noticed that antiX-Linux uses a host block list script , don't know if it's worth looking at for anything to add to your script..........

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: [Solved] TCP/IP DNS file

Post#24 by Bogomips » 15 Jul 2017, 12:02

@ Evan

Took a look at script. Looks sooo complicated. :%) Prefer to remain with the straight forward 14,000 host exclusions, thanx.
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

Evan
Warlord
Warlord
Posts: 519
Joined: 11 Apr 2016, 09:00
Distribution: Anything Cinnamon
Location: London

Re: [Solved] TCP/IP DNS file

Post#25 by Evan » 15 Jul 2017, 12:04

LOL , i scrolled down the script a few lines and promptly left. :)

Post Reply