forked from bk201sama/daige
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdk
49 lines (45 loc) · 1.58 KB
/
dk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
echo "
---------------------------------------------------------
正在执行端口开放程序,本程序适用于大多数系统
---------------------------------------------------------
请按照提示进行端口开放
【1】单端口开放
【2】多端口开放
---------------------------------------------------------
"
sleep 1;
read xz
clear
#单端口
if test $xz == 1 ;then
echo '请输入你需要开放的端口然后轻按回车';
read port
clear
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${port} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${port} -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart
echo '执行完毕';
fi
#多端口
if test $xz == 2 ;then
echo '一次开放三个端口'
echo '请输入你需要开放的端口然后轻按回车';
read dport
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${dport} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${dport} -j ACCEPT
echo '请第二次输入你需要开放的端口然后轻按回车';
read dport
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${dport} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${dport} -j ACCEPT
echo '请第三次输入你需要开放的端口然后轻按回车';
read dport
clear
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${dport} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${dport} -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart
echo '多端口开放执行完毕';
fi
exit 0