Skip to content

Instantly share code, notes, and snippets.

@Shujito
Created August 28, 2023 05:57
Show Gist options
  • Save Shujito/54abb1760eaae8d9c514a0ad010a295e to your computer and use it in GitHub Desktop.
Save Shujito/54abb1760eaae8d9c514a0ad010a295e to your computer and use it in GitHub Desktop.

Revisions

  1. Shujito created this gist Aug 28, 2023.
    7 changes: 7 additions & 0 deletions restore-hosts.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    if [ -s /etc/hosts.bak ]; then
    echo '[ Restoring your original hosts file ]'
    sudo mv /etc/hosts.bak /etc/hosts
    echo '[ Done! ]'
    else
    echo '[ There is nothing to do... ]'
    fi
    21 changes: 21 additions & 0 deletions update-hosts.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    if [ -s /etc/hosts ] && [ ! -s /etc/hosts.bak ]; then
    echo '[ Backing up your original hosts file... ]'
    sudo cp /etc/hosts /etc/hosts.bak
    fi

    TEMPHOSTS=temphosts.txt

    cat /etc/hosts > $TEMPHOSTS

    echo '[ Downloading unified hosts... ]'
    curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts >> $TEMPHOSTS

    #ls -hl $TEMPHOSTS

    echo '[ Replacing hosts with new hosts file... ]'

    sudo cp $TEMPHOSTS /etc/hosts

    rm $TEMPHOSTS

    echo '[ Done! ]'