home *** CD-ROM | disk | FTP | other *** search
-
- "Mutant" Bob Forsman and his amazing 43 burner stove present
- ------------------------------------------------------------
- "stuff"
- ------------------------------------------------------------
-
- This directory contains faucet and hose.
-
-
-
- faucet and hose:
-
- These two utilities are useful for connecting arbitrary programs
- over sockets. The power of the '|' characeter in the shell can now be
- used over the network.
- As an example of what they can do, compile them and on one machine
- type
-
- lightning:21 % ./faucet 3000 "tar cf - ." out
-
- and on another type
-
- springs:3 % ./hose lightning 3000 "tar tvf -" in
-
- You will get output (from machine springs) that looks like this.
-
- rwxr-xr-x771/50 0 Jul 7 11:53 1990 ./
- rw-r-----771/50 9266 Jun 30 21:41 1990 ./faucet.c~
- rw-r--r--771/50 6086 Mar 6 21:40 1990 ./server.cc
- rw-r--r--771/50 1203 Jul 7 11:49 1990 ./Makefile
- rw-r-----771/50 9757 Jul 7 11:49 1990 ./faucet.c
- rw-r--r--771/50 4241 Jun 23 04:09 1990 ./hose.c~
- rwxr-xr-x771/50 24576 Jul 7 11:50 1990 ./hose
- rw-r--r--771/50 4041 Jul 7 11:50 1990 ./hose.c
- rw-r-----771/50 592 Jul 7 11:48 1990 ./portname.c
- rw-r--r--771/50 317 Jul 7 11:48 1990 ./portname.o
- rwxr-xr-x771/50 24576 Jul 7 11:50 1990 ./faucet
- rw-r--r--771/50 3378 Jul 7 11:50 1990 ./hose.o
- rw-r--r--771/50 1069 Jun 23 02:42 1990 ./Makefile~
- rw-r--r--771/50 4662 Jul 7 11:50 1990 ./faucet.o
- rw-r-----771/50 377 Jul 7 11:53 1990 ./#README#
- rw-r-----771/50 371 Jul 7 11:53 1990 ./README
- rw-r--r--771/50 2917 Mar 6 22:13 1990 ./client.cc
-
- The 3000 is the port number to connect to. Normal users can use any
- number over 1023. You can also specify a service name in place of a
- number since the program can look it up from the services database.
- The argument in ""s (argv[2] for faucet, argv[3] for hose) is the
- command to be connected to the socket. The flags in, out and err
- govorn which file descriptors get connected to the socket after the
- connection is successful.
- hose is a one-shot program. It connects to the foreign server
- socket and execs the command. faucet is an undying server. Every
- time it recieves a connection on its socket it forks and execs a "csh
- -c". faucet can be limited to one-shot by the "once" flag.
-
- SYNTAX
-
- faucet <port> <command> (in|out|err)+ [once] [verb(|ose)] [quiet]
- [unix] [foreignport <port>] [foreignhost <host>]
-
- hose <hostname> <port> <command> (in|out|err)+ [unix] [localport <port>]}
-
- Host names can be be the name of the machine or (if no name is
- found) the internet number. The individual numbers are sscanfed with
- %i so 0x or 0 prefixes mean hex or octal instead of decimal for that
- one byte.
- You must chose at least one of in, out, and err. The other flags
- are optional and listed below
- unix.........causes the program to go into unix-domain socket mode.
- hose can also be forced into unix-domain operation by
- specifying -unix- as the hostname (those dashes are
- part of the arg) or by being run with argv[0] as the
- string "uhose" (possible by hardlinking the binary).
- Port names are then treated as unix domain socket
- addresses (filenames) as opposed to internet port
- numbers.
- localport....(only on hose) asks hose to bind to a specific local
- port.
- once.........(only on faucet) the faucet command will not fork, but
- will exec the command, and when the command exits
- you're done.
- verbose|quiet (only on faucet) enables|disables the printing of
- extra information such as what host and port faucet is
- getting connections from.
- foreignport..(only on faucet) causes faucet to refuse (close
- immediately) any connection from a machine that hasn't
- bound its socket to the port specified immediately
- after the foreignport flag. This can be used with the
- localport option of hose to perform crude
- authentication. If the foreignport is <1024 then only
- a foreign root user will be able to connect to your
- faucet because only root can bind to a port number
- below 1024.
- foreignhost..(only on faucet) causes faucet to refuse (close
- immediately) any connection from any machine other
- than the host specified immediately after the
- foreignhost flag.
-
- Be aware that addresses and ports can be spoofed if your network
- isn't secure (yours probably isn't). If you have PCs or other
- non-UNIX boxes connected to the network, then it's DISGUSTINGLY easy
- for ANYONE to spoof the network.
-
-
-
- EXAMPLES
-
- FAUCET HOSE
-
- reef:100 % ./faucet chat "echo send
- $14M and 2 airline stewardesses or
- you'll never see Hoffa alive"
- foreignhost azalea verbose out
-
- reef:40 % ./hose reef chat cat in
-
- refusing connection from host 128.
- 227.224.61(reef.cis.ufl.edu).
-
- azalea:20 % ./hose reef chat cat in
-
- ./faucet: Got connection from 128.
- 227.224.55(azalea.cis.ufl.edu) port
- 1687
- Unmatched '.
- /* darn, screwed up the shell quoting */
- ^C
-
- reef:107 % ./faucet /tmp/blah 'echo
- send '\'\$14M\'' and 2 airline
- stewardesses or you'\\\''ll never
- see Hoffa alive' foreignhost azalea
- verbose out foreignport /tmp/auth unix
- ./faucet: foreignhost parameter makes no
- sense with UNIX domain sockets, ignoring.
- /* %#@)*, bite me */
-
- reef:41 % ./hose -unix- /tmp/blah cat in
-
- ./faucet: refusing connection from port
-
- reef:43 % ./hose -unix- /tmp/blah cat in
- localport /tmp/auth
-
- ./faucet: Got connection from /tmp/auth
-
- send $14M and 2 airline stewardesses or
- you'll never see Hoffa alive
-
-
- Notice the elaborate quoting on that one. faucet+hose fork a "csh
- -c " to interpret the command. The echo command had to be quoted so
- that faucet saw:
-
- echo send '$14M' and 2 airline stewardesses or you\'ll never see Hoffa alive
-
- faucet then performed this system call
-
- execl("/bin/csh","csh","-c",argv[2],NULL);
-
- and the "$14M" and "you'll" were properly quoted to survive THAT csh
- as well. Commands to hose must be similarly protected.
-
- Why use csh?
- 1) This allows you to have pipelines and other fancy stuff inside
- the command, and
- 2) I don't have to write code to parse the command!
-
-
-
- BUGS
-
- Hoohoohoo, god knows what sort of bugs are waiting to rip your
- ankles off. I'm the only one who's extensively used these. They were
- developed on Sun3s and Sun4s. They have been compiled (but not
- extensively tested) on Sonys, DECstations and HPs. If your machine
- needs different include files, start grepping and mail me the results.
-
- If anything is not crystal clear, check the source and mail me.
- I'll try to put it in the README.
-
-
- AUTHOR
-
- Robert H. Forsman Jr. <thoth@lightning.cis.ufl.edu>
- former underpaid Systems Programmer
- now piddly underpaid Research Assistant
- University of Florida
- Department of Computer
- and Information Science
-