tcp_bridge: 0.4 Copyright (c) 1995-1998 by Karl J. Runge. Listen on a port (4001) and redirect connections to tcp service (23) on another machine (). Usage: tcp_bridge -p Local port to listen to. -r Remote machine to connect to. -s Remote port to connect to. -l Place info in logfile -limit xxx.xxx.xxx Limiting connecting IP number to pattern(s). (use : as separator) -d Debug reporting -q Quiet about logging -h -help Print this help -bytes Try to read/write n bytes at a time, n=1 implies select or getc(). (default mode is one line at a time, e.g. http, smtp, nntp) -binary Use select + sysread + syswrite to transfer data (default blksize: 4096) -proxy Run as a proxy server -connect_only Do not be a server, just connect once, using STDIN and STDOUT as "client". -firewall Make connections using default firewall command. -firewall_cmd Make connections using alternative firewall command "cmd". -sysv use = 0 or 1 depending if machine is sysv. Notes: If "service" or "port" is a standard service, the name may be used instead of the number (e.g. smtp = 25). Limit xxx.xxx.xxx limits access of incoming IP's number to those matching that pattern (e.g. xxx.xxx.xxx.yyy is OK). Separate multiple ones with `:' Default logging to (/tmp/tcp_bridge_18894_log). Default IP addr limiting to (). File to look for default machine (/home/runge/.machine). Firewall command is: %Firewall_Perl script/tcp_bridge -connect_only -q -r %HOST -s %PORT When supplying your own firewall command, the STDIO is hooked to it and %HOST %PORT are expanded to the desired remote machine. However if Firewall_Command matches: TCP:fwhost:fwport:send_string:skip_lines:trim_string you can use a TCP connection to a firewall machine (instead of running a separate command). In this case a TCP socket is opened to port "fwport" on machine "fwhost". The number of bytes in "trim_string" is then read from the firewall host and discarded. Then "send_string" plus a newline is sent to the firewall host, with %HOST and %PORT expanded accordingly. If "send_string" is empty, then "%HOST %PORT" is used. Then, the next "skip_lines" lines from the connection are discarded. The TCP connection is then handed over to the client. E.g.: -firewall_cmd "TCP:myproxy.foo.com:3666::2:(to) " This works for itelnet/telnet-passthru service. The "trim_string" is basically a prompt, to which "%HOST %PORT" is sent back. Then the number "skip_lines" are skipped, and finally the connection proceeds back and forth as normal. Environment used: TCP_B_CHAR_AT_A_TIME use getc() TCP_B_VERBOSE verbose TCP_B_BINARY run in binary mode (?) TCP_B_ALLSTR in binary xfer mode, print out all data to log HOME used to fine ~/.machine PAGER used for -help Bugs: Telnet login very slow [due to getc()]. (much better now with select/sysread/syswrite) Ftp will not work (multiple ports 20+21, 2nd cannot reach original caller). Tested on: echo(7), daytime(13), chargen(19), telnet(23), mail(25), finger(79), pop(110), news(119). ssh(22). Proxy: http.