Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. #!/bin/sh
  2. #um
  3.  
  4. #Current hosts file blocks this update.
  5. sudo cp /etc/hosts /etc/hosts.old
  6. sudo cp /etc/hosts.off /etc/hosts
  7.  
  8. #Delete old backups and create new.
  9. echo '
  10. Archiving hosts data directory...'
  11. find ~/hosts_bkup -mtime +7 -type f -delete
  12. cd ~/hosts/data/ || exit
  13. tar -cjf "Archive-$(date +"%Y-%m-%d").tar.xz" -- *
  14. mv "Archive-$(date +"%Y-%m-%d").tar.xz" ~/hosts_bkup/
  15.  
  16. adblock='https://raw.githubusercontent.com/eladkarako/hosts.eladkarako.com/master/build/hosts_adblock.txt'
  17. bboys='https://raw.githubusercontent.com/mitchellkrogza/Badd-Boyz-Hosts/master/hosts'
  18. disad='https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt'
  19. dismal='https://s3.amazonaws.com/lists.disconnect.me/simple_malware.txt'
  20. dismvt='https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt'
  21. distra='https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt'
  22. fireag='https://v.firebog.net/hosts/AdguardDNS.txt'
  23. fireair='https://v.firebog.net/hosts/Airelle-trc.txt'
  24. fireel='https://v.firebog.net/hosts/Easylist.txt'
  25. fireep='https://v.firebog.net/hosts/Easyprivacy.txt'
  26. firepa='https://v.firebog.net/hosts/Prigent-Ads.txt'
  27. fireps='https://v.firebog.net/hosts/static/w3kbl.txt'
  28. hphosts='http://hosts-file.malwareteks.com/hosts.txt'
  29. hppart='https://hosts-file.net/hphosts-partial.txt'
  30. kadhosts='https://raw.githubusercontent.com/azet12/KADhosts/master/KADhosts.txt'
  31. opnphi='https://openphish.com/feed.txt'
  32. quidsup='https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt'
  33. roughted='https://gist.github.com/malwareinfosec/73d10721cdb9868a05baff6a59a6bcbc#file-roughted_list'
  34.  
  35. echo '
  36. Updating AdBlock hosts...'
  37. rm -rf ~/hosts/data/adblock/hosts
  38. curl $adblock -o ~/hosts/data/adblock/hosts
  39. sed -i -e '/\[[^]]*\]/d' -e '/!/d' -e '/theguardian/d' -e '/nasa.gov/d' -e '/privateinternetaccess.com/d' -e 's/^/0.0.0.0 /' ~/hosts/data/adblock/hosts
  40.  
  41. echo '
  42. Updating Badd-Boyz-Hosts...'
  43. rm -rf ~/hosts/data/Badd-Boyz-Hosts/hosts
  44. curl $bboys -o ~/hosts/data/Badd-Boyz-Hosts/hosts
  45. sed -i -e '/pastebin/d' -e '/[a-zA-Z]/!d' ~/hosts/data/Badd-Boyz-Hosts/hosts
  46.  
  47. echo '
  48. Updating Disconnect filter lists...'
  49. rm -rf ~/hosts/data/disconnect-filters/hosts
  50. curl $disad $dismal $dismvt $distra >> ~/hosts/data/disconnect-filters/del
  51. sed -i -e '/[ #]/d' -e '/^$/d' -e 's/^/0.0.0.0 /' ~/hosts/data/disconnect-filters/del
  52. sort -u ~/hosts/data/disconnect-filters/del -o ~/hosts/data/disconnect-filters/hosts
  53. rm -rf ~/hosts/data/disconnect-filters/del
  54.  
  55. echo '
  56. Updating Firebog block lists...'
  57. rm -rf ~/hosts/data/firebog/hosts
  58. curl $fireag $fireair $fireel $fireep $firepa $fireps >> ~/hosts/data/firebog/del
  59. sed -i -e '/^#/ d' -e '/^\s*$/d' -e 's/^/0.0.0.0 /' ~/hosts/data/firebog/del
  60. sort -u ~/hosts/data/firebog/del -o ~/hosts/data/firebog/hosts
  61. rm -rf ~/hosts/data/firebog/del
  62.  
  63. echo '
  64. Updating hpHosts and hpHosts partial...'
  65. rm -rf ~/hosts/data/hphosts/hosts
  66. curl $hphosts -o ~/hosts/data/hphosts/del
  67. iconv -c -f utf-8 -t ascii ~/hosts/data/hphosts/del -o ~/hosts/data/hphosts/hosts
  68. sed -i -e '/[a-zA-Z]/!d' -e '/thedailybeast/d' ~/hosts/data/hphosts/hosts
  69. rm -rf ~/hosts/data/hphosts/del
  70.  
  71. rm -rf ~/hosts/data/hppart/hosts
  72. curl $hppart -o ~/hosts/data/hppart/del
  73. iconv -c -f utf-8 -t ascii ~/hosts/data/hppart/del -o ~/hosts/data/hppart/hosts
  74. rm -rf ~/hosts/data/hppart/del
  75.  
  76. echo '
  77. Updating KADhosts...'
  78. rm -rf ~/hosts/data/KADhosts/hosts
  79. curl $kadhosts -o ~/hosts/data/KADhosts/del
  80. iconv -c -f utf-8 -t ascii ~/hosts/data/KADhosts/del -o ~/hosts/data/KADhosts/hosts
  81. rm -rf ~/hosts/data/KADhosts/del
  82.  
  83. echo '
  84. Updating openphish hosts...'
  85. rm -rf ~/hosts/data/openphish/hosts
  86. curl $opnphi -o ~/hosts/data/openphish/hosts
  87. sed -i -e 's/^/0.0.0.0 /' ~/hosts/data/openphish/hosts
  88.  
  89. echo '
  90. Updating QuidsUp no track...'
  91. rm -rf ~/hosts/data/quidsup/hosts
  92. curl $quidsup -o ~/hosts/data/quidsup/hosts
  93. sed -i -e 's/[[:space:]]*#.*//' -e '/^$/d' -e 's/^/0.0.0.0 /' ~/hosts/data/quidsup/hosts
  94.  
  95. echo '
  96. Updating RoughTed hosts...'
  97. rm -rf ~/hosts/data/roughted/hosts
  98. curl $roughted -o ~/hosts/data/roughted/hosts
  99. sed -i -e 's/^/0.0.0.0 /' ~/hosts/data/roughted/hosts
  100.  
  101. #Reinstate old hosts file.
  102. sudo cp /etc/hosts.old /etc/hosts
  103. sudo chown root:root /etc/hosts
  104. echo '
  105. Miscellaneous host files updated.'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement