Updated Block Lists

Yesterday I posted about tweaking Deluge. In there I also talked about the block lists.Today I decided I would take the time to update the script that compiles all the blocklists to one file every weekend.

It now has: Level1-3, Microsoft, IANA filters, and the Bogon lists. Also, it now uses several for loops for better modularity of adding new lists.

Visit http://stephentanner.info/public-share/blocklist-updated/ to find all the files you need.

  1. #!/bin/bash
  2. ##
  3. ##
  4.  
  5. ##This bash will automatically download new
  6. ##Blocklists from bluetack.co.uk
  7.  
  8. #Distributed under the GPL
  9. #Updated 2009.03.11
  10.  
  11. #Change Dir
  12. cd ~/blocklists
  13.  
  14. #Download the block lists
  15. #adding the -nv option to wget
  16. # to make the output shorter
  17. for list in level1 level2 level3 bogon Microsoft iana-multicast iana-private iana-reserved
  18. do
  19.     wget -nv http://bluetack.co.uk/config/$list.zip
  20. done
  21.  
  22. echo "——————————————"
  23. echo
  24.  
  25. #Extract the text files
  26. for list in `ls | grep .zip`
  27. do
  28.     unzip $list
  29. done
  30. echo "——————————————"
  31. echo
  32.  
  33. #Merge the files to one
  34. touch blocklist
  35. for list in `ls | grep .txt`
  36. do
  37.     cat $list >> blocklist
  38. done
  39. echo "combined blocklist created"
  40. echo
  41. echo "——————————————"
  42. echo
  43.  
  44. #Change extention on blocklist file
  45. mv blocklist blocklist.txt
  46. echo "blocklist.txt created"
  47. echo
  48. echo "——————————————"
  49. echo
  50.  
  51. #Create Zip of new file
  52. zip blocklist blocklist.txt
  53. echo "——————————————"
  54. echo
  55.  
  56. #Time Stamp The update
  57. echo "This was last updated:" > CHANGELOG.txt
  58. date >> CHANGELOG.txt
  59. echo "change log created"
  60. echo
  61. echo "—————————————–"
  62. echo
  63.  
  64. #Delete Old Files
  65. rm ~/stephentanner.info/public-share/blocklist-old/*
  66.  
  67. #Move New files to Old Files
  68. mv ~/stephentanner.info/public-share/blocklist-updated/* ~/stephentanner.info/public-share/blocklist-old/
  69.  
  70. #Copy New Files to New Files
  71. cp ./* ~/stephentanner.info/public-share/blocklist-updated/
  72.  
  73. #Clean up New Files
  74. rm ./*.txt
  75. rm ./*.zip
  76. echo "House keeping done"
  77. echo
  78. echo "—————————————-"
  79. echo
  80.  
  81. #Yay
  82. cat ~/stephentanner.info/public-share/blocklist-updated/CHANGELOG.txt
  83. echo
  84. echo "Seems like everything went well."
  85. echo
  86. echo "New File Sizes are:"
  87. ls -lh ~/stephentanner.info/public-share/blocklist-updated/ | awk ‘{print $5,$8}’ | grep -v CH | grep -v down
  88. echo
  89. echo "Old File Sizes are:"
  90. ls -lh ~/stephentanner.info/public-share/blocklist-old/ | awk ‘{print $5,$8}’ | grep -v CH | grep -v down

Share and enjoy!

This entry was posted in BitTorrent, Security, Software and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>