Skip to content

matteobaccan/SockRedirector

Repository files navigation

SockRedirector

Codacy Badge Language grade: Java Total alerts Build Status security status stability status DepShield Badge

Stars Badge Forks Badge Pull Requests Badge Issues Badge GitHub contributors License Badge GraalVM Build

Redirects TCP connections from one IP address and port to another

I have used this tool for many years. This tool allow to redirect the TCP data from a port of one ip to another remote port of a remote machine.

This tool is very usefull in complex network architecture, where there are some firewall that are open only from one machine to another.

In this situation you can put sockRedirector server on thrusted machine, and connect to remote server using this machine

The concept is very similar to a proxy, without the limitation of use only http connection or the problem to write a socks interface.

Java sockRedirector is written in Java.

Use this program in Linux, Windows, AIX, AS/400 or all environment you want.

Documentation

sockRedirector.ini

Ini file is divided in several section For each section you can define these parameters

key type default value
source string mandatory source ip to bind, listen on
sourceport int mandatory source port to bind, listen on
destination string mandatory destionation to bind
destinationport int mandatory destionation port to bind
log boolean true Create a log under logs/sockRedirector.log
timeout int 0 source socket timeout (seconds)
client int 10 max connected client to the source
blocksize int 64000 size of buffer to read from source and destination
inReadWait long 0 reading from destination pause
inWriteWait long 0 writing to destination pause
outReadWait long 0 reading from source pause
outWriteWait long 0 write to source pause
randomKill long 0 random kill of thread within N seconds

Example

Configuration Example (sockRedirector.ini)

<redirection>
   <source>127.0.0.1</source>
   <sourceport>80</sourceport>
   <destination>1.1.1.1</destination>
   <destinationport>80</destinationport>
   <log>true</log>
   <timeout>0</timeout>
   <client>50</client>
   <inReadWait>0</inReadWait>
   <inWriteWait>0</inWriteWait>
   <outReadWait>0</outReadWait>
   <outWriteWait>1000</outWriteWait>
</redirection>