1
- #! /bin/bash
2
- # BlockTorrent
3
- sudo iptables -A FORWARD -m string --string " BitTorrent" --algo bm --to 65535 -j DROP
4
- sudo iptables -A FORWARD -m string --string " BitTorrent protocol" --algo bm --to 65535 -j DROP
5
- sudo iptables -A FORWARD -m string --string " peer_id=" --algo bm --to 65535 -j DROP
6
- sudo iptables -A FORWARD -m string --string " .torrent" --algo bm --to 65535 -j DROP
7
- iptables -A FORWARD -m string --string " announce.php?passkey=" --algo bm --to 65535 -j DROP
8
- iptables -A FORWARD -m string --string " torrent" --algo bm --to 65535 -j DROP
9
- iptables -A FORWARD -m string --string " announce" --algo bm --to 65535 -j DROP
10
- iptables -A FORWARD -m string --string " info_hash" --algo bm --to 65535 -j DROP
11
- iptables -A OUTPUT -p tcp --dport 50321 -j DROP
12
- iptables -A OUTPUT -p udp --dport 50321 -j DROP
13
- iptables -A OUTPUT -d account.sonyentertainmentnetwork.com -j DROP
14
- iptables -A OUTPUT -d auth.np.ac.playstation.net -j DROP
15
- iptables -A OUTPUT -d auth.api.sonyentertainmentnetwork.com -j DROP
16
- iptables -A OUTPUT -d auth.api.np.ac.playstation.net -j DROP
17
- iptables -N LOGDROP > /dev/null 2> /dev/null
18
- iptables -F LOGDROP
19
- iptables -A LOGDROP -j LOG --log-prefix " LOGDROP "
20
- iptables -A LOGDROP -j DROP
21
- iptables -A FORWARD -m string --algo bm --string " BitTorrent" -j LOGDROP
22
- iptables -A FORWARD -m string --algo bm --string " BitTorrent protocol" -j LOGDROP
23
- iptables -A FORWARD -m string --algo bm --string " peer_id=" -j LOGDROP
24
- iptables -A FORWARD -m string --algo bm --string " .torrent" -j LOGDROP
25
- iptables -A FORWARD -m string --algo bm --string " announce.php?passkey=" -j LOGDROP
26
- iptables -A FORWARD -m string --algo bm --string " torrent" -j LOGDROP
27
- iptables -A FORWARD -m string --algo bm --string " announce" -j LOGDROP
28
- iptables -A FORWARD -m string --algo bm --string " info_hash" -j LOGDROP
29
- iptables -A FORWARD -m string --string " get_peers" --algo bm -j LOGDROP
30
- iptables -A FORWARD -m string --string " announce_peer" --algo bm -j LOGDROP
31
- iptables -A FORWARD -m string --string " find_node" --algo bm -j LOGDROP
32
- iptables -A OUTPUT -p icmp --icmp-type echo-request -j DROP
33
- iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
34
- iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
35
- iptables -A INPUT -f -j DROP
36
- iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
37
- iptables -A INPUT -m string --string " BitTorrent" --algo bm --to 65535 -j DROP
38
- iptables -A INPUT -m string --string " BitTorrent protocol" --algo bm --to 65535 -j DROP
39
- iptables -A INPUT -m string --string " peer_id=" --algo bm --to 65535 -j DROP
40
- iptables -A INPUT -m string --string " .torrent" --algo bm --to 65535 -j DROP
41
- iptables -A INPUT -m string --string " announce.php?passkey=" --algo bm --to 65535 -j DROP
42
- iptables -A INPUT -m string --string " torrent" --algo bm --to 65535 -j DROP
43
- iptables -A INPUT -m string --string " announce" --algo bm --to 65535 -j DROP
44
- iptables -A INPUT -m string --string " info_hash" --algo bm --to 65535 -j DROP
45
- iptables -A INPUT -m string --string " peer_id" --algo kmp --to 65535 -j DROP
46
- iptables -A INPUT -m string --string " BitTorrent" --algo kmp --to 65535 -j DROP
47
- iptables -A INPUT -m string --string " BitTorrent protocol" --algo kmp --to 65535 -j DROP
48
- iptables -A INPUT -m string --string " bittorrent-announce" --algo kmp --to 65535 -j DROP
49
- iptables -A INPUT -m string --string " announce.php?passkey=" --algo kmp --to 65535 -j DROP
50
- iptables -A INPUT -m string --string " find_node" --algo kmp --to 65535 -j DROP
51
- iptables -A INPUT -m string --string " info_hash" --algo kmp --to 65535 -j DROP
52
- iptables -A INPUT -m string --string " get_peers" --algo kmp --to 65535 -j DROP
53
- iptables -A INPUT -m string --string " announce" --algo kmp --to 65535 -j DROP
54
- iptables -A INPUT -m string --string " announce_peers" --algo kmp --to 65535 -j DROP
55
- iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
56
- iptables -I OUTPUT -p tcp --dport 1723 -j ACCEPT
57
- iptables -A OUTPUT -p tcp --dport 6881:6889 -j DROP
58
- iptables -A FORWARD -m string --algo bm --string " BitTorrent" -j DROP
59
- iptables -A FORWARD -p tcp --dport 6881:6889 -j DROP
60
- iptables -D FORWARD -m string --algo bm --string " BitTorrent" -j LOGDROP
61
- iptables -D FORWARD -m string --algo bm --string " BitTorrent protocol" -j LOGDROP
62
- iptables -D FORWARD -m string --algo bm --string " peer_id=" -j LOGDROP
63
- iptables -D FORWARD -m string --algo bm --string " .torrent" -j LOGDROP
64
- iptables -D FORWARD -m string --algo bm --string " announce.php?passkey=" -j LOGDROP
65
- iptables -D FORWARD -m string --algo bm --string " torrent" -j LOGDROP
66
- iptables -D FORWARD -m string --algo bm --string " announce" -j LOGDROP
67
- iptables -D FORWARD -m string --algo bm --string " info_hash" -j LOGDROP
68
- iptables -A FORWARD -m string --string " get_peers" --algo bm -j DROP
69
- iptables -A FORWARD -m string --string " announce_peer" --algo bm -j LOGDROP
70
- iptables -A FORWARD -m string --string " find_node" --algo bm -j LOGDROP
71
- iptables -A FORWARD -p udp -m string --algo bm --string " BitTorrent" -j DROP
72
- iptables -A FORWARD -p udp -m string --algo bm --string " BitTorrent protocol" -j DROP
73
- iptables -A FORWARD -p udp -m string --algo bm --string " peer_id=" -j DROP
74
- iptables -A FORWARD -p udp -m string --algo bm --string " .torrent" -j DROP
75
- iptables -A FORWARD -p udp -m string --algo bm --string " announce.php?passkey=" -j DROP
76
- iptables -A FORWARD -p udp -m string --algo bm --string " torrent" -j DROP
77
- iptables -A FORWARD -p udp -m string --algo bm --string " announce" -j DROP
78
- iptables -A FORWARD -p udp -m string --algo bm --string " info_hash" -j DROP
79
- iptables -A FORWARD -p udp -m string --algo bm --string " tracker" -j DROP
80
- iptables -A INPUT -p udp -m string --algo bm --string " BitTorrent" -j DROP
81
- iptables -A INPUT -p udp -m string --algo bm --string " BitTorrent protocol" -j DROP
82
- iptables -A INPUT -p udp -m string --algo bm --string " peer_id=" -j DROP
83
- iptables -A INPUT -p udp -m string --algo bm --string " .torrent" -j DROP
84
- iptables -A INPUT -p udp -m string --algo bm --string " announce.php?passkey=" -j DROP
85
- iptables -A INPUT -p udp -m string --algo bm --string " torrent" -j DROP
86
- iptables -A INPUT -p udp -m string --algo bm --string " announce" -j DROP
87
- iptables -A INPUT -p udp -m string --algo bm --string " info_hash" -j DROP
88
- iptables -A INPUT -p udp -m string --algo bm --string " tracker" -j DROP
89
- iptables -I INPUT -p udp -m string --algo bm --string " BitTorrent" -j DROP
90
- iptables -I INPUT -p udp -m string --algo bm --string " BitTorrent protocol" -j DROP
91
- iptables -I INPUT -p udp -m string --algo bm --string " peer_id=" -j DROP
92
- iptables -I INPUT -p udp -m string --algo bm --string " .torrent" -j DROP
93
- iptables -I INPUT -p udp -m string --algo bm --string " announce.php?passkey=" -j DROP
94
- iptables -I INPUT -p udp -m string --algo bm --string " torrent" -j DROP
95
- iptables -I INPUT -p udp -m string --algo bm --string " announce" -j DROP
96
- iptables -I INPUT -p udp -m string --algo bm --string " info_hash" -j DROP
97
- iptables -I INPUT -p udp -m string --algo bm --string " tracker" -j DROP
98
- iptables -D INPUT -p udp -m string --algo bm --string " BitTorrent" -j DROP
99
- iptables -D INPUT -p udp -m string --algo bm --string " BitTorrent protocol" -j DROP
100
- iptables -D INPUT -p udp -m string --algo bm --string " peer_id=" -j DROP
101
- iptables -D INPUT -p udp -m string --algo bm --string " .torrent" -j DROP
102
- iptables -D INPUT -p udp -m string --algo bm --string " announce.php?passkey=" -j DROP
103
- iptables -D INPUT -p udp -m string --algo bm --string " torrent" -j DROP
104
- iptables -D INPUT -p udp -m string --algo bm --string " announce" -j DROP
105
- iptables -D INPUT -p udp -m string --algo bm --string " info_hash" -j DROP
106
- iptables -D INPUT -p udp -m string --algo bm --string " tracker" -j DROP
107
- iptables -I OUTPUT -p udp -m string --algo bm --string " BitTorrent" -j DROP
108
- iptables -I OUTPUT -p udp -m string --algo bm --string " BitTorrent protocol" -j DROP
109
- iptables -I OUTPUT -p udp -m string --algo bm --string " peer_id=" -j DROP
110
- iptables -I OUTPUT -p udp -m string --algo bm --string " .torrent" -j DROP
111
- iptables -I OUTPUT -p udp -m string --algo bm --string " announce.php?paskey=" -j DROP
112
- iptables -I OUTPUT -p udp -m string --algo bm --string " torrent" -j DROP
113
- iptables -I OUTPUT -p udp -m string --algo bm --string " announce" -j DROP
114
- iptables -I OUTPUT -p udp -m string --algo bm --string " info_hash" -j DROP
115
- iptables -I OUTPUT -p udp -m string --algo bm --string " tracker" -j DROP
116
- iptables -D INPUT -m string --algo bm --string " BitTorrent" -j DROP
117
- iptables -D INPUT -m string --algo bm --string " BitTorrent protocol" -j DROP
118
- iptables -D INPUT -m string --algo bm --string " peer_id=" -j DROP
119
- iptables -D INPUT -m string --algo bm --string " .torrent" -j DROP
120
- iptables -D INPUT -m string --algo bm --string " announce.php?passkey=" -j DROP
121
- iptables -D INPUT -m string --algo bm --string " torrent" -j DROP
122
- iptables -D INPUT -m string --algo bm --string " announce" -j DROP
123
- iptables -D INPUT -m string --algo bm --string " info_hash" -j DROP
124
- iptables -D INPUT -m string --algo bm --string " tracker" -j DROP
125
- iptables -D OUTPUT -m string --algo bm --string " BitTorrent" -j DROP
126
- iptables -D OUTPUT -m string --algo bm --string " BitTorrent protocol" -j DROP
127
- iptables -D OUTPUT -m string --algo bm --string " peer_id=" -j DROP
128
- iptables -D OUTPUT -m string --algo bm --string " .torrent" -j DROP
129
- iptables -D OUTPUT -m string --algo bm --string " announce.php?passkey=" -j DROP
130
- iptables -D OUTPUT -m string --algo bm --string " torrent" -j DROP
131
- iptables -D OUTPUT -m string --algo bm --string " announce" -j DROP
132
- iptables -D OUTPUT -m string --algo bm --string " info_hash" -j DROP
133
- iptables -D OUTPUT -m string --algo bm --string " tracker" -j DROP
134
- iptables -D FORWARD -m string --algo bm --string " BitTorrent" -j DROP
135
- iptables -D FORWARD -m string --algo bm --string " BitTorrent protocol" -j DROP
136
- iptables -D FORWARD -m string --algo bm --string " peer_id=" -j DROP
137
- iptables -D FORWARD -m string --algo bm --string " .torrent" -j DROP
138
- iptables -D FORWARD -m string --algo bm --string " announce.php?passkey=" -j DROP
139
- iptables -D FORWARD -m string --algo bm --string " torrent" -j DROP
140
- iptables -D FORWARD -m string --algo bm --string " announce" -j DROP
141
- iptables -D FORWARD -m string --algo bm --string " info_hash" -j DROP
142
- iptables -D FORWARD -m string --algo bm --string " tracker" -j DROP
1
+ # Bruteforce Protection
2
+ iptables -A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --set
3
+ iptables -A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 10 -j DROP
4
+
5
+ # Protection Port Scanning
6
+ iptables -N port-scanning
7
+ iptables -A port-scanning -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s --limit-burst 2 -j RETURN
8
+ iptables -A port-scanning -j DROP
9
+
10
+ # Anti-Torrent Blocking
11
+ iptables -A INPUT -m string --algo bm --string "BitTorrent" -j REJECT
12
+ iptables -A INPUT -m string --algo bm --string "BitTorrent protocol" -j REJECT
13
+ iptables -A INPUT -m string --algo bm --string "peer_id=" -j REJECT
14
+ iptables -A INPUT -m string --algo bm --string ".torrent" -j REJECT
15
+ iptables -A INPUT -m string --algo bm --string "announce.php?passkey=" -j REJECT
16
+ iptables -A INPUT -m string --algo bm --string "torrent" -j REJECT
17
+ iptables -A INPUT -m string --algo bm --string "info_hash" -j REJECT
18
+ iptables -A INPUT -m string --algo bm --string "/default.ida?" -j REJECT
19
+ iptables -A INPUT -m string --algo bm --string ".exe?/c+dir" -j REJECT
20
+ iptables -A INPUT -m string --algo bm --string ".exe?/c_tftp" -j REJECT
21
+ iptables -A INPUT -m string --string "peer_id" --algo kmp -j REJECT
22
+ iptables -A INPUT -m string --string "BitTorrent" --algo kmp -j REJECT
23
+ iptables -A INPUT -m string --string "BitTorrent protocol" --algo kmp -j REJECT
24
+ iptables -A INPUT -m string --string "bittorrent-announce" --algo kmp -j REJECT
25
+ iptables -A INPUT -m string --string "announce.php?passkey=" --algo kmp -j REJECT
26
+ iptables -A INPUT -m string --string "find_node" --algo kmp -j REJECT
27
+ iptables -A INPUT -m string --string "info_hash" --algo kmp -j REJECT
28
+ iptables -A INPUT -m string --string "get_peers" --algo kmp -j REJECT
29
+ iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j REJECT
30
+ iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j REJECT
31
+ iptables -A FORWARD -m string --algo bm --string "peer_id=" -j REJECT
32
+ iptables -A FORWARD -m string --algo bm --string ".torrent" -j REJECT
33
+ iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j REJECT
34
+ iptables -A FORWARD -m string --algo bm --string "torrent" -j REJECT
35
+ iptables -A FORWARD -m string --algo bm --string "info_hash" -j REJECT
36
+ iptables -A FORWARD -m string --algo bm --string "/default.ida?" -j REJECT
37
+ iptables -A FORWARD -m string --algo bm --string ".exe?/c+dir" -j REJECT
38
+ iptables -A FORWARD -m string --algo bm --string ".exe?/c_tftp" -j REJECT
39
+ iptables -A FORWARD -m string --string "peer_id" --algo kmp -j REJECT
40
+ iptables -A FORWARD -m string --string "BitTorrent" --algo kmp -j REJECT
41
+ iptables -A FORWARD -m string --string "BitTorrent protocol" --algo kmp -j REJECT
42
+ iptables -A FORWARD -m string --string "bittorrent-announce" --algo kmp -j REJECT
43
+ iptables -A FORWARD -m string --string "announce.php?passkey=" --algo kmp -j REJECT
44
+ iptables -A FORWARD -m string --string "find_node" --algo kmp -j REJECT
45
+ iptables -A FORWARD -m string --string "info_hash" --algo kmp -j REJECT
46
+ iptables -A FORWARD -m string --string "get_peers" --algo kmp -j REJECT
47
+ iptables -A OUTPUT -m string --algo bm --string "BitTorrent" -j REJECT
48
+ iptables -A OUTPUT -m string --algo bm --string "BitTorrent protocol" -j REJECT
49
+ iptables -A OUTPUT -m string --algo bm --string "peer_id=" -j REJECT
50
+ iptables -A OUTPUT -m string --algo bm --string ".torrent" -j REJECT
51
+ iptables -A OUTPUT -m string --algo bm --string "announce.php?passkey=" -j REJECT
52
+ iptables -A OUTPUT -m string --algo bm --string "torrent" -j REJECT
53
+ iptables -A OUTPUT -m string --algo bm --string "info_hash" -j REJECT
54
+ iptables -A OUTPUT -m string --algo bm --string "/default.ida?" -j REJECT
55
+ iptables -A OUTPUT -m string --algo bm --string ".exe?/c+dir" -j REJECT
56
+ iptables -A OUTPUT -m string --algo bm --string ".exe?/c_tftp" -j REJECT
57
+ iptables -A OUTPUT -m string --string "peer_id" --algo kmp -j REJECT
58
+ iptables -A OUTPUT -m string --string "BitTorrent" --algo kmp -j REJECT
59
+ iptables -A OUTPUT -m string --string "BitTorrent protocol" --algo kmp -j REJECT
60
+ iptables -A OUTPUT -m string --string "bittorrent-announce" --algo kmp -j REJECT
61
+ iptables -A OUTPUT -m string --string "announce.php?passkey=" --algo kmp -j REJECT
62
+ iptables -A OUTPUT -m string --string "find_node" --algo kmp -j REJECT
63
+ iptables -A OUTPUT -m string --string "info_hash" --algo kmp -j REJECT
64
+ iptables -A OUTPUT -m string --string "get_peers" --algo kmp -j REJECT
65
+ iptables -A INPUT -p tcp --dport 25 -j REJECT
66
+ iptables -A FORWARD -p tcp --dport 25 -j REJECT
67
+ iptables -A OUTPUT -p tcp --dport 25 -j REJECT
0 commit comments