Created
April 22, 2016 18:07
-
-
Save pgiu/4e9ca46deedf9481e52acad5a7e3e6a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Como hacer un proxy con netcat | |
# Correr esto en una maquina intermedia | |
# | |
# yo ---> maquina_intermedia ---> maquina_destino | |
# Desde mi maquina conecto al puerto $listening_port y el servicio que quiero de | |
# la maquina destino en $dest_host y puerto $dest_port | |
# | |
# correrlo así: | |
# proxy_kong.sh 151.168.0.9 20000 | |
# donde 152.168.0.9 es la RTU real | |
# y 2000 es el puerto de la RTU | |
# El script se queda escuchando en $listening_port | |
# | |
dest_host=$1 | |
dest_port=$2 | |
listening_port=5000 | |
mkfifo afifo | |
nc -l $listening_port 0<afifo | nc $dest_host $dest_port 1>afifo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tested on ubuntu 14.04