sh 使用iblocklist.com中的阻止列表列表更新传输阻止列表的脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用iblocklist.com中的阻止列表列表更新传输阻止列表的脚本相关的知识,希望对你有一定的参考价值。

#!/bin/sh
:<<END_DOC
blocklist updater - for transmission
Written by raidzero for linux

BLOCKLIST_HOME is the directory where transmission keeps its blocklists
END_DOC

BLOCKLIST_HOME=~/.config/transmission/blocklists

# blocklist URLS go here:
cat << END_LIST > /tmp/blocklists
http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=bt_level2&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=bt_level3&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=bt_edu&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=bt_templist&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=bt_hijacked&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=ijfqtofzixtwayqovmxn&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=ecqbsykllnadihkdirsh&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=jcjfaxgyyshvdbceroxf&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=lljggjrpmefcwqknpalp&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=pfefqteoxlfzopecdtyw&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=tbnuqfclfkemqivekikv&fileformat=p2p&archiveformat=gz
http://list.iblocklist.com/?list=ewqglwibdgjttwttrinl&fileformat=p2p&archiveformat=gz
END_LIST

#check for transmission in the process list
RUNNING=`ps -ef | grep "transmission-gtk" | grep -v grep | wc -l`

if [ $RUNNING -ge 1 ]; then
  #kill it gracefully
  killall transmission-gtk
  [ $? -eq 0 ] && KILLED=1
fi

cd $BLOCKLIST_HOME
rm -rf $BLOCKLIST_HOME/*
echo "Removed existing blocklists."

NUMBER=1
echo -n "Downloading blocklist "

while read URL; do 
  echo -n "$NUMBER..."
  wget -q $URL
  if [ $? -ne 0 ]; then
	echo "$NUMBER FAILED!"
  fi
  let NUMBER=$NUMBER+1
done < /tmp/blocklists
echo " Done!"

NUMBER=1
echo -n "Unpacking blockist "
for file in `find . -type f`; do 
  echo -n "$NUMBER..."
  mv $file $file.gz
  gunzip $file.gz
  sed -i '/\#.*$/d;/^$/d' $file #remove comment and blank lines, so transmission doesnt yell about invalid lines
  let NUMBER=$NUMBER+1
done
echo " Done!"

#rename the existing files, so transmission can pick them up
NUMBER=1
for file in `find . -type f -name "index.html?*"`; do
  mv $file $NUMBER-blocklist
  let NUMBER=$NUMBER+1
done

#count and display the number of addresses in all of the blocklists
AMOUNT=`cat $BLOCKLIST_HOME/* | wc -l | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta'`
echo "Blocked $AMOUNT bad addresses."

#be sure to restart the process if we killed it 
if [ -n "$KILLED" ]; then
	transmission-gtk &
fi

#clean up
rm /tmp/blocklists

以上是关于sh 使用iblocklist.com中的阻止列表列表更新传输阻止列表的脚本的主要内容,如果未能解决你的问题,请参考以下文章

sh 用于关闭magento 2模板和阻止提示的Shell脚本,将文件添加到流浪者中的〜/ bin并将权限设置为755

sh 用于打开magento 2模板和阻止提示的Shell脚本,将文件添加到流浪者中的〜/ bin并将权限设置为755

SwiftUI 点击手势阻止列表中的项目删除操作

sh PostgresDesconect并阻止

sh 阻止UFW尝试中断

sh Git端口阻止了代理解决方法