File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change 2
2
3
3
4
4
# ################################ Default Values ###############################
5
- # This is me and always me :-)
6
- funilrys=' funilrys'
7
-
8
5
# This is the current version of this script.
9
6
versionNumber=' 1.0.0'
10
7
# ###############################################################################
94
91
then
95
92
# This initiate the input file
96
93
input=" ${1} "
97
-
98
-
94
+
95
+
99
96
if [[ ${2} != ' ' ]]
100
97
then
101
98
# We check if there is a fixed output. If it's not we save the
102
99
# output to ${PWD}iptables.rules
103
100
outputFile=" ${2} "
104
101
fi
105
-
102
+
106
103
# We read our file to an array.
107
104
readarray fileContent < ${input}
108
-
105
+
109
106
# We reset the iptables.
110
107
reset_iptables
111
-
108
+
112
109
# We set the iptable base.
113
110
set_iptables_base
114
-
111
+
115
112
for i in ${! fileContent[*]}
116
113
do
117
114
# We go through the array and initate the domain we are going to add
118
115
# to IPTABLES.
119
116
readedLine=" $( echo " ${fileContent[${i}]} " | cut -d $' \n ' -f1) "
120
-
117
+
121
118
case " ${readedLine} " in
122
119
\# * |" \n" |" " )
123
120
# If it's a commented line, we continue to the next line.
124
121
continue
125
122
;;
126
123
* )
127
124
domain=" $( echo ${readedLine##* } ) "
128
-
125
+
129
126
case " ${domain} " in
130
127
localhost|localhost.localdomain|local|broadcasthost|0.0.0.0)
131
128
# If the domain is into that list we also continue
@@ -135,11 +132,11 @@ else
135
132
esac
136
133
;;
137
134
esac
138
-
135
+
139
136
# We set out rule
140
137
${iptables} -A OUTPUT -d " ${domain} " -j DROP > /dev/null 2>&1
141
138
done
142
-
139
+
143
140
# We save the rules into the fixed or desired output.
144
141
${iptables_save} > ${outputFile}
145
142
else
You can’t perform that action at this time.
0 commit comments