- [Instructor] Previously, we saw
a network traffic and port analysis.
This video talks about creating arbitrary sockets.
In this video, we'll create simple network sockets
and use them for communication.
For defined operations such as file transfer,
remote shells, and so on, we have pre-built tools,
such as FTP and SSH respectively.
However, in some cases, you'll find the need
to do a customized network operation.
An example for this might be writing a script,
which will do something when
a remote host connects to your machine.
In this video, we'll create simple network sockets
and use them for communication.
To do this, we'll need to create network sockets
which enable us to transfer data over a TCP/IP network.
The easiest way to do this is by using
the command netcat, or nc.
We need two sockets.
One listens for connection,
and the other connects to this one.
Set up the listening socket using nc minus-L 1234.
This will create a listening socket
on port 1234 on the local machine.
Next, we'll need to connect to the socket.
For that, open a new window, and type nc HOST 1234.
If you are running this on the same machine
that the listening socket is,
replace host with localhost.
Otherwise, replace it with the IP address
or host name of the machine.
To actually send messages, type something and press enter
on the terminal where you are connected to the socket.
The message will appear on the terminal
where you created the listening socket.
So, let's type hello connected here
and see if we get anything in the other window.
Yes, here it is.
Network sockets can be used
for more than just text communication.
Let's see how to quickly copy files over the network.
We can exploit netcat and shell redirection
to easily copy files over the network.
Let's first stop this operation.
Now, on the receiver machine, run this command.
Replace destination filename with your actual filename.
On the sender machine, run this command.
Similar to the previous one, add your actual filename.
As you can see, the file has been copied, nice.
We've successfully created sockets now.
That brings us to the end of this section.
Here we saw how to use the ping command.
Then, we listed the all machines that are alive.
We then moved on to running commands
on a remote host with SSH
and transferring files through the network.
Then, we explored auto-login with SSH.
We then saw port forwarding and mounting remote drives.
After that, we performed network traffic and port analysis
and created arbitrary sockets.
In the next section, we'll put on the monitors cap.
That is, monitor different activities.
See you around.