iptables block BT/PT/SPAM (spam) and custom port/keywords One-click script

System Requirements

CentOS 6+ / Debian 6+ / Ubuntu 14.04 +

 

Recommend Debian 8 x64, this is the system I have been using, my script has the lowest error rate on this system.

 

Script version

Ver: 1.0.10

 

installation steps

Execute the code below to download and run the script.

 

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/ban_iptables.sh && chmod +x ban_iptables.sh && bash ban_iptables.sh

After running the script, the script operation menu will appear, select and enter the corresponding number to operate.

 

Instructions for use

Go to the directory where the script is downloaded and run the script:

 

./ban_iptables.sh

Then select the option you want to execute.

 

 iptables firewall block management script [vX.X.X]

- Toyo | doub.io/shell-jc2 -

 

0. View current banned list

————————————

1. Ban BT, PT

2. Block SPAM (Spam)

3. Ban BT, PT+SPAM

4. Block custom ports

5. Block custom keywords

————————————

6. Unblock BT, PT

7. Unblock SPAM (spam)

8. Unblock BT, PT+SPAM

9. Unblock custom port

10. Unblock custom keywords

11. Unblock all keywords

————————————

12. Upgrade script

 

Please enter the number [0-11]:

Other operations:

For convenience, I also made a few quick commands, without having to enter the menu to select the corresponding option, you can directly block/unblock it.

 

./ban_iptables.sh banbt

# Block BT, PT

 

./ban_iptables.sh banspam

# Block SPAM (spam)

 

./ban_iptables.sh banall

# Block BT, PT+SPAM

 

./ban_iptables.sh unbanbt

# Unblock BT, PT

 

./ban_iptables.sh unbanspam

# Unblock SPAM (spam)

 

./ban_iptables.sh unbanall

# Unblock BT, PT+SPAM

other instructions

Prompt wget: unknown host "raw.githubusercontent.com" and other errors

This is because my domain name cannot be resolved. It is mostly a DNS problem. Please change the DNS to Google DNS (copy the following two lines and execute them together).

 

echo -e "nameserver 8.8.8.8

nameserver 8.8.4.4"> /etc/resolv.conf

Prompt wget: command not found error

This is your system is streamlined and too clean, wget is not installed, so you need to install wget.

 

# CentOS system:

yum install -y wget

 

# Debian/Ubuntu system:

apt-get install -y wget

To reprint, please indicate the hyperlink: "Original" iptables block BT/PT/SPAM (spam) and custom port/keywords One-click script

這篇文章有幫助嗎? 5466 Users Found This Useful (2457 Votes)