Ricky Ford

Tech & BBQ Enthusiast

Your Cart Contents

Your cart is empty.
Subtotal:$0.00

Categories

Creations

Twitter: @rickylford

I recently got into refurbishing and custom-building retro gaming consoles. Want to learn more about my store? Chec… twitter.com/i/web/status/1…
August 25th, 2019

@madsmmorrow pic.twitter.com/ZYdFOV6kqf
August 25th, 2019

@MurderSmall Your podcast is amazing. I usually try and find things that I hate about a podcast to justify not list… twitter.com/i/web/status/1…
June 20th, 2019

Update 10/10/2018: I have updated the blocklist script again. As of today it downloads 520,963 rules.

Update 2/8/2015: The blocklist script has been updated once more. There was an issue with an "if" statement in the script that was causing the script to fail and not find certain files (as with Damien's comment on 10/16/2014). The script should now be back in working order!

Update 9/8/2013: The blocklist script has been updated and actually looks a lot prettier than it did before. I did not create this script by hand. As I was scouring the internet looking for new blocklists, I came across http://crunchbang.org/forums/viewtopic.php?id=25914 and found Ragnarok's script in the first post. I cleaned his code up a bit and that is the script you're getting below.

Critical Update 9/8/2013: The website that the script below pulls the blocklists from has decided to make it so that you are unable to download their IP filters if you do not donate to their website. I am looking all over the place to try and replace these IP filters with a new provider and once I'm able to find one, I will update the script accordingly. For those of you wondering why the script doesn't work, this is why. The script will not work as it is right now.

Update 5/30/2013: The webexploit blocklist was reported as being unavailable. After checking it out, it does look like it no longer exists in the list of blocklist .gz files. I have updated the blocklist.sh script with five new blocklists and removed the webexploit from being called. You can download the new version by clicking the above link or you can copy/paste the script from above.

Update 12/21/2012: I've changed the reloading configuration at the bottom of the script. Before, it was restarting the transmission daemon. I've changed this so that it reloads the daemon instead of restarting it. Not a huge issue to worry about, but following the lead of my tutorial on how to actually install Transmission, I noted in there that it is always better to reload the transmission daemon service instead of restarting it.

You can download the blocklist script by clicking here. When you download the file, you need to rename it from blist.txt to blist.sh so that you can run it from the command line. You need to make sure that you also run it using the sudo command if you aren't logged in as root, otherwise the renaming and removing portions of the script won't work. Also, be sure that in the script, you change the BLOCKLISTDIR variable at the beginning of the script to the correct path that points to your blocklist directory for Transmission.

This script currently, as of September 8th, 2013, adds 411,636 IP addresses to your Transmission blocklist.

Posted on March 12th, 2012 by Ricky Ford in Technology.

Updated on October 9th, 2018 at 12:00 AM.

https://www.rickylford.com/post/transmission-blocklist-on-ubuntu-server-12-04-lts/

Post Comment

Comments (14)

Hello Ricky, dude! Thank you so much for your guide. You took your time to write this out... this is awesome.

I do have a question...
I am using your script to download and merge the block list... but script exits with with the message:

root@transmission:/home/rsx/downloads# sudo sh ./updateblocklists.sh
Deleting the old blocklist file if it exists...
./updateblocklists.sh: 23: ./updateblocklists.sh: [[: not found
Downloading new blocklists...
Merging blocklists into one massive blocklist...
./updateblocklists.sh: 50: ./updateblocklists.sh: [[: not found
-e Unable to find /var/lib/transmission-daemon/info/blocklists/blocklist.txt.gz --- Exiting
./updateblocklists.sh: 55: ./updateblocklists.sh: remove_temp: not found


I did make sure that BLOCKLISTDIR variable at the beginning of the script points to the correct path to blocklist directory for Transmission:


rsx@transmission:/var/lib/transmission-daemon/info/blocklists$ ls -lh
total 11M
-rw-r--r-- 1 root root 11M Oct 16 14:18 blocklist.txt.gz
-rw-r--r-- 1 debian-transmission debian-transmission 0 Oct 16 00:47 blocklist.txt.gz.bin
rsx@transmission:/var/lib/transmission-daemon/info/blocklists$



Also I can see the lists are downloaded just fine:


rsx@transmission:/tmp$ ls -lh
total 11M
-rw-r--r-- 1 root root 45K Oct 15 20:03 bl-ads.gz
-rw-r--r-- 1 root root 435K Oct 15 20:03 bl-badpeers.gz
-rw-r--r-- 1 root root 15K Oct 15 20:03 bl-bogon.gz
-rw-r--r-- 1 root root 615 Oct 15 20:06 bl-dshield.gz
-rw-r--r-- 1 root root 3.3K Oct 15 20:06 bl-hijacked.gz
-rw-r--r-- 1 root root 114 Oct 15 20:13 bl-iana-multicast.gz
-rw-r--r-- 1 root root 283 Oct 15 20:13 bl-iana-reserved.gz
-rw-r--r-- 1 root root 3.6M Oct 15 20:02 bl-level1.gz
-rw-r--r-- 1 root root 1.3M Oct 15 20:03 bl-level2.gz
-rw-r--r-- 1 root root 13K Oct 15 20:03 bl-microsoft.gz
-rw-r--r-- 1 root root 4.9M May 23 00:26 bl-primary-threats.gz
-rw-r--r-- 1 root root 49K Oct 15 20:03 bl-spyware.gz
rsx@transmission:/tmp$



Could you please look over this and if you could, let me know where the problem might be....

THank you for your help and your time.

Damien.

Posted by Damien on October 16th, 2014

Hmm. That's quite interesting. Sorry I didn't see your message earlier. But honestly, I'm not 100% sure what exactly is wrong. There's a chance that it could be the 14.04 version of Ubuntu, but honestly, I can't even say that for sure. I'm still running 12.04 so I don't even have a 14.04 to troubleshoot on. Let me do some more investigation on my end and see if I can pinpoint the issue.

Posted by Ricky on November 20th, 2014

I'm sure you've long moved on since your comment regarding the script failing. However, just in case you come across this post again, the fix is with the if statement on lines 23 and 50. There are two double brackets, [[ and ]] that need to be change to single brackets. After fixing those brackets the script should work just fine.

Posted by Ricky on February 8th, 2015

Hello Ricky, could you please help me out to diagnose what the problem might be.

I am using your script to download and merge the lists, however your script exits with error:

rsx@transmission:~/downloads$ sudo sh ./updateblocklists.sh
Deleting the old blocklist file if it exists...
./updateblocklists.sh: 23: ./updateblocklists.sh: [[: not found
Downloading new blocklists...
Merging blocklists into one massive blocklist...
./updateblocklists.sh: 50: ./updateblocklists.sh: [[: not found
-e Unable to find /var/lib/transmission-daemon/info/blocklists/blocklist.txt.gz --- Exiting
./updateblocklists.sh: 55: ./updateblocklists.sh: remove_temp: not found
rsx@transmission:~/downloads$

So, what I can tell is that files are downloaded in to /tmp directory just fine, and I verified it, please see the output:

rsx@transmission:/tmp$ ls -lh
total 11M
-rw-rw-r-- 1 rsx rsx 45K Oct 15 20:03 bl-ads.gz
-rw-rw-r-- 1 rsx rsx 435K Oct 15 20:03 bl-badpeers.gz
-rw-rw-r-- 1 rsx rsx 15K Oct 15 20:03 bl-bogon.gz
-rw-rw-r-- 1 rsx rsx 615 Oct 15 20:06 bl-dshield.gz
-rw-rw-r-- 1 rsx rsx 3.3K Oct 15 20:06 bl-hijacked.gz
-rw-rw-r-- 1 rsx rsx 114 Oct 15 20:13 bl-iana-multicast.gz
-rw-rw-r-- 1 rsx rsx 283 Oct 15 20:13 bl-iana-reserved.gz
-rw-rw-r-- 1 rsx rsx 3.6M Oct 15 20:02 bl-level1.gz
-rw-rw-r-- 1 rsx rsx 1.3M Oct 15 20:03 bl-level2.gz
-rw-rw-r-- 1 rsx rsx 13K Oct 15 20:03 bl-microsoft.gz
-rw-rw-r-- 1 rsx rsx 4.9M May 23 00:26 bl-primary-threats.gz
-rw-rw-r-- 1 rsx rsx 49K Oct 15 20:03 bl-spyware.gz



Also, the path to the path that points to my blocklist directory for Transmission is set and correct, the file is there:

rsx@transmission:/var/lib/transmission-daemon/info/blocklists$ ls -lh
total 11M
-rw-r--r-- 1 root root 11M Oct 16 00:10 blocklist.txt.gz

...but script is exiting with the message:
"Unable to find /var/lib/transmission-daemon/info/blocklists/blocklist.txt.gz"


Could you please let me know if I missed something?

Thank you for your time and your help.

D

Posted by Damien on October 16th, 2014

I want to also let you know that all of this is running on the latest Ubuntu 14.04 LTS, could that be the cause of this issue?

Posted by Damien on October 16th, 2014

Hi Ricky,
Thanks for this script. One question though. I have read on other sites that you have to change the "blocklist-url": setting in the transmission/settings.json file. Is this correct? What exactly should that setting be?

Posted by mrgrey on August 19th, 2013

You only do that if you are using one blocklist. If you are doing multiple blocklists, this is bypassing the Transmission config file and loading the blocklists directly in the manual way. The only reason you would want to change the blocklist-url is if you want Transmission to update it's blocklists automatically with the one blocklist URL.

Posted by Ricky on September 8th, 2013

Hello,

Great work!

Just a quick note to simplify the process. You don't need to rename the file, simply execute it with sh.
So it can be simply:
wget https://www.rickylford.com/updateblocklists.txt
sudo sh updateblocklists.txt

Posted by asterix on August 11th, 2013

I am getting an error saying mv: cannot stat ./var/lib/transmission-daemon/info/blocklists./gnutella: No such file or directory or similar over and over again - but the /var/lib/transmission-daemon/info/blocklists folder definitely exists. Any ideas what I have done wrong?

Posted by bob808 on August 3rd, 2013

It appears that the bluetack.co.uk website has made it so that all of their lists are no longer publicly available. I am searching all over the place at the moment trying to find a new blocklist provider, and when I find one, I'll update the script accordingly.

Posted by Ricky on September 8th, 2013

Hi Ricky,

Everything with your script works except the "webexploit.gz" blocklist. Do you know if something changed with webexploit?

Thanks.
BobbyD

Posted by BobbyD on May 27th, 2013

For some reason that list is no longer available. I updated the blocklist.sh script to include quite a few new blocklists and removed the webexploit. Thanks for informing me of that! :)

Posted by Ricky on May 30th, 2013

Hello Ricky.
Nice little script there!
Im trying to get it to work but having a problem.
I rarely use Linux, but I piece things together pretty quickly.
Im running Ubuntu 11.04 currently.
Looks like the transmission directory is: ~/user/.config/transmission
So I edited the file for that location.

Im having problems having the script access the website.
When I run the script from terminal
sudo bash updateblocklists.sh
the BASEURL in the script gets substituted with 'updatedblocklists.sh' so it fails to download

updatedblocklists.sh: line 20: curl: command not found

Do you have any ideas or suggestions?
Thanks so much!

Posted by Jesse on June 15th, 2012

Hey Jesse,

You might want to make sure you have curl installed on your system. It looks like it can't find the curl command when it's trying to download the files, so just run a "sudo apt-get install curl" and then try running the script again.

Also, you said you're typing "sudo bash updateblocklists.sh" -- I'm not sure about the "bash" command, so what you can try to do just to make sure, after you get curl installed, try running the command like this: "sudo ./updateblocklists.sh"

Be sure that you're in the actual directory where the updateblocklists.sh file is at.

Try out those tips and let me know how they work for you. :)

Posted by Ricky on June 17th, 2012

Loading

© 2011-2019 www.rickylford.com | All Rights Reserved.