Installing Stevens' sock program
Richard Stevens uses a generic program called sock.c in his TCP/IP Illustrated book. Its purpose is to generate TCP and UDP data for testing various network features of interest. It runs as either client or server. Stevens used it in versions of UNIX. There are linux versions at the T/TCP site, and a "dusted off and updated" version in source code by Christian Kreibich. Obtain the latter. It will be in the form of a file named sock-0.3.1.tar.gz or similar. That file may be already present in the /home/public directory of your provided machine.
If you are working with provided VirtualBox virtual machines, do this exercise in the CLIENT and SERVER virtual machines that are produced when you run the scripts that set up the "sniffing" exercise. (I assume you have done that.)
The assignment for you to perform
Log in as root on both CLIENT and SERVER. Their
addresses assigned when you set up the "sniffing" experiment are:
CLIENT 192.168.1.2
SERVER 192.168.1.1
The color coding convention for commands you are asked to execute below is:
blue - for commands to be executed
on CLIENT
red - for commands to be executed on SERVER
black - for commands to be executed on
both
The file containing sock's source code is stored in the /home/public directory. Get it into your home directory by:
cd
cp /home/public/sock-0.3.1.tar.gz ~
Unpack it:
tar -xzvf sock-0.3.1.tar.gz
Drop down into the created directory:
cd sock-0.3.1
Per the instructions in the INSTALL file,
./configure
make
make install
(This is the traditional method of distribution and installation of open source software in source code form.) At this point sock is installed. To verify, run it with no arguments to provoke it to print usage messages on the screen:
sock
Test it further by running it between the two machines. In SERVER run sock as a listening udp server:
sock -u -s 5555
It waits. In CLIENT run sock as a client, against the server instance:
sock -u 192.168.1.1 5555
It waits for input. Type your name, followed by enter. Whatever you typed should appear over in the server's window. Terminate both instances with the ctrl-C key.
We're almost done but please wait a moment. Before you go, here's a recapitulation
using nc (netcat) because I want to point out the similarity between sock and
the much better known nc.
Substitute nc for sock.. In SERVER run nc as a listening udp server:
nc -l -u -p 5555
It waits. In the second run nc as a client, against the server instance:
nc -u 192.168.1.1 5555
It waits for input. Type your name, followed by enter. Whatever you typed should appear over in the server's window. Terminate both instances with the ctrl-C key.
The two programs are quite similar but do have non-identical feature sets. Both are useful.
What to turn in:
I want a screenshot showing the sock interaction between CLIENT and SERVER that you performed above. Arrange the two VM windows that are on your host desktop in the overlapping manner, and with contents clearly visible that are shown in this example screenshot (but use your name, not mine). Name your screenshot file sock-interaction.jpg (or .png).