SHARE
TWEET

openport

tolikpunkoff Oct 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. if [ -z "$1" ]; then
  4.     echo "parameters: <port> [t|f]"
  5.     exit
  6. fi
  7.  
  8. echo "Open  port "$1
  9. if [ -z "$2" ]; then
  10.     #to computer
  11.     iptables -A INPUT  -p tcp --dport $1 -j ACCEPT
  12.     iptables -A OUTPUT -p tcp --sport $1 -j ACCEPT
  13.     #from computer
  14.     iptables -A INPUT  -p tcp --sport $1 -j ACCEPT
  15.     iptables -A OUTPUT -p tcp --dport $1 -j ACCEPT
  16. else
  17.     if [ "$1"="t" ]; then
  18.     #to computer
  19.     iptables -A INPUT  -p tcp --dport $1 -j ACCEPT
  20.     iptables -A OUTPUT -p tcp --sport $1 -j ACCEPT
  21.     else
  22.     #from computer
  23.     iptables -A INPUT  -p tcp --sport $1 -j ACCEPT
  24.     iptables -A OUTPUT -p tcp --dport $1 -j ACCEPT
  25.     fi
  26. fi
  27.  
  28. echo "OK"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top