Week 2: Networking Lab ​ ​ ​ ​​ ​ ​ ​ Topics: I. Netcat II. III.

Setup 1. SSH Client ​ ​ If you completed this step in the previous lab, you can skip this step. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Once you are in the lab, you will need to get access to the Wi-Fi, and you will need a ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ SSH client installed on your laptop. The lab Wi-Fi password will be up on the board, so ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ you can use that to get access to the Wi-Fi. If you are on a Mac or have installed, ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ a SSH client should already be installed. If your laptop is running Windows, though, you ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ will need to install putty (a windows SSH client). Its installer can be found the below ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ URL:

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Now that everything is set up, SSH into the lab1 server. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

On Mac/Linux, the following into your terminal ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ssh [email protected] ​ ​ Substitute your username for “user1” and it should work out ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

On windows, start up putty, and enter the following into the “Host Name (or IP Address)” ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Field

[email protected]

Please answer the questions through google forms: ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

https://goo.gl/forms/F7bYeiOcKCyhHR5g1 ​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​

1. Install Wireshark ​ ​ https://www.wireshark.org/download.htm

Lab

I. NetCat is a great utility that allows you to easily send and receive the data over the ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ network. Go over the following commands to learn about it. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

1. Open a web browser of your choice. Go to website lab1.cyberdragons.edu ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​​ 2. Right-click anywhere in the page and select “View page source” ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 3. Go to the terminal and type the following lines: ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ nc lab1.cyberdragons.edu 80 ​ ​ ​ ​ GET index.html HTTP 1.0 ​ ​ ​ ​ ​ ​

The first line here opens a new connection to a web server. The second one ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ requests the index.html. This is what a web browser does every you open a ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ new web page. The “GET” line is a part of the HTTP request header, which is an ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Application Layer protocol used for fetching information from the web. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Compare the information you see in the page source vs. what you received using ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ netcat. The difference is another HTTP header, called HTTP response. It is not a ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ part of the page, so your browser doesn’t display it. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Question: What is the first line of the HTTP response you received? ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

II. Port Scanning ​ ​

1. Determine all hosts that are on the network 192.168.1.0/24 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Question: How many devices did you found? ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

2. Determine the OS that run of the hosts you found. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Question: How many Windows boxes did you ? ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ How many Linux ones? ​ ​ ​ ​ ​ ​ Did you found any other operating systems running? ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

III. NCL Labs ​ ​

If you have registered for NCL, go to https://ncl.cyberskyline.com ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​​ Otherwise, download the following files from the Google Group/recent email: ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ NCL-2015-ftp.pcap NCL-2015-DNS.pcap

Answer the questions on the Google Form for this part of the assignment. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​

Bonus

IV. Learn how to copy files using netcat ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ https://nakkaya.com/2009/04/15/using-netcat-for-file-transfers/

V. Try creating a small web server ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ https://stackoverflow.com/questions/16640054/minimal-web-server-using-netcat

VI. Try combining several options that nmap allows to see the results produced ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ https://linux.die.net/man/1/nmap