Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- #local
- port_from="8088"
- #ip_from="localhost"
- #remoto
- port_to="80"
- ip_to="149.154.167.99"
- sleep_time=5
- crea_tunel () {
- echo "creando tunel desde: $ip_from:$port_from hacia $ip_to:$port_to"
- #socat -u TCP:$ip_to:$port_to TCP:$ip_from:$port_from &
- socat TCP-LISTEN:$port_from,fork TCP:$ip_to:$port_to
- }
- echo "iniciando script:"
- crea_tunel
- while true; do
- echo "chequeando si el tunel esta up"
- check=sudo netstat -putan | grep ":$port_from ES"
- if [ ${#check} -ge 10 ]
- then
- result="connected"
- else
- sudo killall socat -s KILL
- result="not connected"
- crea_tunel
- fi
- sleep $sleep_time
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement