In-Class Lab 1 (10 points)
Initial setup of your development environment using WSL and VSCode. This lab introduces you to basic Linux commands, Python execution, and packet capturing.
Follow the instructions below to setup your development environment. Type one command at a time. As a best practice, make sure you understand what the command might do before you hit Enter.
Upon the completion of all activities, have your instructor review your work and track your progress to receive full credit.
Install and configure WSL
From a Windows Terminal-
winget install Microsoft.VisualStudioCode # if needed
winget install Docker.DockerDesktop
winget install Git.Git
winget install WiresharkFoundation.Wireshark
code --install-extension ms-vscode-remote.remote-wsl
wsl --update # ensure wsl feature is at the latest version
wsl --list # list currently installed distros; if you already have ubuntu, skip reinstalling it
wsl --list --online # list of available distros
wsl --install ubuntu
wsl # now enter wsl
Connect vscode to Linux (WSL)
From within WSL environment-
sudo apt update # update package index; do this in Linux, not Windows
sudo apt install tcpdump tshark bind9-dnsutils traceroute # network tools
sudo apt install python-is-python3 fish # quality of life upgrades
Navigate to your home directory in Linux by typing cd. Confirm your current directory with pwd.
Create your class directory, navigate the filesystem, list contents to confirm-
mkdir cy350
cd cy350
ls
pwd
Finally, launch vscode from your current directory in Linux - code .
vscode setup
- Ensure that the bottom-left corner shows
WSL: Ubuntu. - Install Python extension.
- Also install
autopep8formatter extension for easier code formatting. - Notice the “Remote Explorer” icon on the left sidebar; use it to manage your WSL connections in the future and to return to your cy350 directory
Run python “hello world” on Linux
- Create a new file named
hello.py - Add the following code to it:
print("Hello, CY350!")- Save the file and run it in the Linux terminal-
python hello.py
Capture packets on Linux
In a terminal-
sudo tcpdump -i eth0 -c 20 --print -w lab2.pcap # nothing will happen until you generate some network traffic; see next step
Run man tcpdump or tcpdump --help for an explanation of these command line flags.
In another terminal-
curl -v -i httpforever.com
Here, -v will ensure verbose output and -i will display HTTP headers in addition to the content.
Now return to the first terminal and press Ctrl+C to stop the packet capture process. Type ls to ensure that the captured packets were written to
Bring up your packet capture in Wireshark or Wireview
- Locate the PCAP file you created in the previous step (lab2.pcap)
- Open it in Wireshark or Wireview (wireview.github.io)
- Identify the HTTP GET request to
httpforever.comand the corresponding HTTP response.
Hide AI features in vscode
Features > Chat > Disable AI Features to protect yourself from unintentional AI completions!
Alternatively:
- Press
Ctrl + Shift + P - Search for “Hide AI Features”
- Under setting, check the “Disable” box