Page 2 of 2

Re: [Solved] TCP/IP DNS file

Posted: 09 May 2017, 14:38
by Ed_P
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}'

Re: [Solved] TCP/IP DNS file

Posted: 12 May 2017, 15:51
by Bogomips
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:

Re: [Solved] TCP/IP DNS file

Posted: 14 May 2017, 23:00
by Ed_P
: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:

Re: [Solved] TCP/IP DNS file

Posted: 14 May 2017, 23:51
by Bogomips
^

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)

Re: [Solved] TCP/IP DNS file

Posted: 15 May 2017, 00:21
by Ed_P
hmmmm

Code: Select all

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

Re: [Solved] TCP/IP DNS file

Posted: 15 May 2017, 00:51
by Evan
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 >......................

Re: [Solved] TCP/IP DNS file

Posted: 15 May 2017, 04:11
by Ed_P
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:

Re: [Solved] TCP/IP DNS file

Posted: 13 Jul 2017, 08:26
by Evan
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..........

Re: [Solved] TCP/IP DNS file

Posted: 15 Jul 2017, 12:02
by Bogomips
@ Evan

Took a look at script. Looks sooo complicated. :%) Prefer to remain with the straight forward 14,000 host exclusions, thanx.

Re: [Solved] TCP/IP DNS file

Posted: 15 Jul 2017, 12:04
by Evan
LOL , i scrolled down the script a few lines and promptly left. :)