Common Protocols (HTTPS, FTP, SSH, etc.) | Cyber Security Tutorial - Learn with VOKS
Back Next

Common Protocols (HTTPS, FTP, SSH, etc.)


Introduction to common network protocols

when computers communicate over a network, they follow specific rules called protocols. each protocol is designed for a particular purpose, such as loading websites, transferring files, or remotely controlling another computer.

think of a protocol as a language with strict rules. if both sides follow the same rules, communication works correctly.

Below is a beginner-friendly explanation of some of the most common protocols used on the internet.

1. https (hypertext transfer protocol secure)

https is the secure version of http. it is used for loading websites securely.

when you visit a website like:

https://example.com

your browser and the web server communicate using https.

how https works:

  1. your browser connects to the server (usually on port 443).
  2. they perform a secure handshake.
  3. the server sends a digital certificate.
  4. encryption is established.
  5. data is exchanged securely.

https uses:

  • Hypertext Transfer Protocol (http)
  • Transport Layer Security (tls)

why https is important:

  • encrypts data
  • prevents attackers from reading information
  • protects passwords and credit card data

example using python to make an https request:

import requests

response = requests.get("https://example.com")
print(response.status_code)
print(response.text[:200])

2. ftp (file transfer protocol)

ftp is used to transfer files between computers over a network.

it typically uses:

  • port 21 (control connection)
  • port 20 (data connection)

ftp is not secure by default because it sends data in plain text.

common uses:

  • uploading website files to a server
  • downloading files from remote servers

secure alternatives:

  • ftps (ftp over tls)
  • sftp (ssh file transfer protocol)

example ftp connection in python:

from ftplib import FTP

ftp = FTP("ftp.example.com")
ftp.login(user="username", passwd="password")

ftp.retrlines("LIST")
ftp.quit()

3. ssh (secure shell)

ssh allows you to remotely access and control another computer securely.

it usually runs on port 22.

what ssh does:

  • encrypts communication
  • allows remote command execution
  • supports secure file transfers (sftp)

example use case:

you connect from your laptop to a remote linux server:

ssh user@server_ip

behind the scenes, ssh:

  1. establishes a secure encrypted channel
  2. authenticates the user
  3. allows command execution

ssh uses strong encryption to prevent eavesdropping.

example using python (paramiko library):

import paramiko

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("example.com", username="user", password="password")

stdin, stdout, stderr = ssh.exec_command("ls")
print(stdout.read().decode())

ssh.close()

4. smtp

smtp is used to send emails between mail servers.

it usually runs on:

  • port 25 (standard)
  • port 587 (secure submission)

smtp handles sending emails, not receiving them.

example sending email with python:

import smtplib

server = smtplib.SMTP("smtp.example.com", 587)
server.starttls()
server.login("user@example.com", "password")

message = "Subject: Test\n\nThis is a test email."
server.sendmail("user@example.com", "recipient@example.com", message)

server.quit()

5. pop3 and imap

these protocols are used to receive emails.

pop3 (post office protocol version 3):

  • downloads emails to your device
  • usually removes them from the server
  • port 110 (or 995 secure)

imap (internet message access protocol):

  • keeps emails on the server
  • syncs across devices
  • port 143 (or 993 secure)

imap is more modern and commonly used today.

6. dns (domain name system)

dns translates domain names into ip addresses.

example:

when you type:

google.com

dns translates it into something like:

142.250.190.14

dns usually uses:

  • port 53
  • udp (sometimes tcp)

without dns, you would have to remember numeric ip addresses for every website.

7. dhcp (dynamic host configuration protocol)

dhcp automatically assigns ip addresses to devices on a network.

when you connect to wifi:

  1. your device sends a request.
  2. the dhcp server assigns an ip address.
  3. it also provides gateway and dns information.

dhcp usually uses:

  • port 67 (server)
  • port 68 (client)
  • udp

summary of common protocols

https:

  • secure web browsing
  • port 443
  • encrypted

ftp:

  • file transfer
  • port 21
  • not secure by default

ssh:

  • secure remote login
  • port 22
  • encrypted

smtp:

  • sending email
  • port 25/587

pop3:

  • download email
  • port 110

imap:

  • sync email
  • port 143

dns:

  • domain name translation
  • port 53
  • usually udp

dhcp:

  • automatic ip assignment
  • ports 67/68
  • udp

How these protocols work together

when you open a website:

  1. dhcp gives your device an ip address.
  2. dns translates the website name to an ip.
  3. your browser connects using https.
  4. tcp ensures reliable data transfer.
  5. tls encrypts the communication.

each protocol has a specific role, and together they make the internet function smoothly.

Example Code:
# =========================
# https request example
# =========================
import requests

def https_example():
    response = requests.get("https://example.com")
    print(response.status_code)
    print(response.text[:200])

# =========================
# ftp example
# =========================
from ftplib import FTP

def ftp_example():
    ftp = FTP("ftp.example.com")
    ftp.login(user="username", passwd="password")
    ftp.retrlines("LIST")
    ftp.quit()

# =========================
# ssh example
# =========================
import paramiko

def ssh_example():
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect("example.com", username="user", password="password")
    stdin, stdout, stderr = ssh.exec_command("ls")
    print(stdout.read().decode())
    ssh.close()

# =========================
# smtp example
# =========================
import smtplib

def smtp_example():
    server = smtplib.SMTP("smtp.example.com", 587)
    server.starttls()
    server.login("user@example.com", "password")
    message = "Subject: Test\n\nThis is a test email."
    server.sendmail("user@example.com", "recipient@example.com", message)
    server.quit()

# choose which function to run manually
# https_example()
# ftp_example()
# ssh_example()
# smtp_example()
Cyber Security
Introduction Types of Cyber Threats Cyber Security Domains CIA Triad (Confidentiality Integrity Availability) Career paths in Cyber Security Certifications Ethics and Responsible Disclosure Laws and Regulation (e.g. GDPR, NDPR) What is an OS? Types: Window, Linus, macOS Command-line vs GUI OS Internals Overview (filesystems, processes, permissions) Windows command prompt basics Linux Bash Basics File System Navigation Basic Scripting IP Addressing DNS, DHCP Mac Address OSI VS TCP/IP Models Ports and Protocols (TCP, UDP) Common Protocols (HTTPS, FTP, SSH, etc.) Packet structure Firewalls, IDS/IPS, VPNs Common attacks: MITM, Sniffing Secure Network Practices How the Web works HTTP vs HTTPS URLs, Headers, Cookies Client-Server Architecture Introduction To Web Security OWASP Top 10 Overview Common Threats (XSS, SQLi, CSRF) Inpute validation and authentication flow Basic Exploitation demo (e.g. XSS) Burp Suite Introduction Using a Browser For Testing Password security MFA-Antivirus Cyber Hygeine Practice Intro To Tools: Nmap, Wireshark, Netstat
All Courses
Advance AI Bootstrap C C++ Computer Vision Content Writing CSS Cyber Security Data Analysis Deep Learning Email Marketing Excel Figma HTML Java Script Machine Learning MySQLi Node JS PHP Power Bi Python Python for AI Python for Analysis React React Native SEO SMM SQL