-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathiptables.sh
More file actions
executable file
·41 lines (34 loc) · 1.87 KB
/
iptables.sh
File metadata and controls
executable file
·41 lines (34 loc) · 1.87 KB
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
# Accept TCP traffic on ports 8123 and 8124
iptables -A INPUT -i ap+ -p tcp --dport 8123 -j ACCEPT
iptables -A INPUT -i ap+ -p tcp --dport 8124 -j ACCEPT
iptables -A INPUT -i wlan1 -p tcp --dport 8123 -j ACCEPT
iptables -A INPUT -i wlan1 -p tcp --dport 8124 -j ACCEPT
iptables -A INPUT -i lo -p tcp --dport 8123 -j ACCEPT
iptables -A INPUT -i lo -p tcp --dport 8124 -j ACCEPT
# Accept UDP traffic on ports 8123 and 8124
iptables -A INPUT -i ap+ -p udp --dport 8123 -j ACCEPT
iptables -A INPUT -i ap+ -p udp --dport 8124 -j ACCEPT
iptables -A INPUT -i wlan1 -p udp --dport 8123 -j ACCEPT
iptables -A INPUT -i wlan1 -p udp --dport 8124 -j ACCEPT
iptables -A INPUT -i lo -p udp --dport 8123 -j ACCEPT
iptables -A INPUT -i lo -p udp --dport 8124 -j ACCEPT
# Drop TCP traffic on ports 8123 and 8124
iptables -A INPUT -p tcp --dport 8123 -j DROP
iptables -A INPUT -p tcp --dport 8124 -j DROP
# Drop UDP traffic on ports 8123 and 8124
iptables -A INPUT -p udp --dport 8123 -j DROP
iptables -A INPUT -p udp --dport 8124 -j DROP
# Redirect TCP traffic
iptables -t nat -A PREROUTING -i ap+ -p tcp -d 192.168.43.1/24 -j RETURN
iptables -t nat -A PREROUTING -i ap+ -p tcp -j REDIRECT --to 8123
iptables -t nat -A PREROUTING -i wlan1 -p tcp -d 192.168.43.1/24 -j RETURN
iptables -t nat -A PREROUTING -i wlan1 -p tcp -j REDIRECT --to 8123
# Redirect UDP traffic
iptables -t nat -A PREROUTING -i ap+ -p udp -d 192.168.43.1/24 -j RETURN
iptables -t nat -A PREROUTING -i ap+ -p udp -j REDIRECT --to 8123
iptables -t nat -A PREROUTING -i wlan1 -p udp -d 192.168.43.1/24 -j RETURN
iptables -t nat -A PREROUTING -i wlan1 -p udp -j REDIRECT --to 8123
/system/bin/iptables -t nat -A OUTPUT -p tcp -d 47.251.61.173 -j RETURN
/system/bin/iptables -t nat -A OUTPUT -p udp -d 47.251.61.173 -j RETURN
/system/bin/iptables -t nat -A OUTPUT -p tcp -j REDIRECT --to 8123
/system/bin/iptables -t nat -A OUTPUT -p udp -j REDIRECT --to 8123