0% found this document useful (0 votes)
7 views2 pages

CYB318 Assignment Ayomide

The document contains an assignment for Ajibona Ayomide Oladimeji, focusing on cybersecurity tasks including comparing RSA and AES encryption speeds using Python, setting up firewall rules, capturing HTTPS traffic with Wireshark, and configuring a VPN with OpenVPN or WireGuard. It provides code snippets and commands for each task, demonstrating practical implementations. The results from the encryption speed test indicate that AES is significantly faster than RSA.

Uploaded by

abiolakunnumi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

CYB318 Assignment Ayomide

The document contains an assignment for Ajibona Ayomide Oladimeji, focusing on cybersecurity tasks including comparing RSA and AES encryption speeds using Python, setting up firewall rules, capturing HTTPS traffic with Wireshark, and configuring a VPN with OpenVPN or WireGuard. It provides code snippets and commands for each task, demonstrating practical implementations. The results from the encryption speed test indicate that AES is significantly faster than RSA.

Uploaded by

abiolakunnumi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

NAME: AJIBONA AYOMIDE OLADIMEJI

MATRIC NO: RUN/CYB/23/15426

COURSE CODE: CYB 318

ASSIGNMENT

QUESTIONS
1. Compare RSA vs AES encryption using a Python script to analyze speed differences.
2. Set up a basic firewall rule with iptables (Linux) or Windows Defender Firewall.
3. Capture and analyze HTTPS traffic using Wireshark, examining encryption processes.
4. Set up a VPN using OpenVPN or WireGuard on virtual machines.

ANSWERS
1. 1. Comparison of RSA vs AES Encryption using Python:

Python Code:
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import serialization, hashes
import os, time
message = b"Cybersecurity Speed Test Message" * 100
key = os.urandom(32)
iv = os.urandom(16)
cipher = Cipher(algorithms.AES(key), modes.CFB(iv))
encryptor = cipher.encryptor()
start_aes = time.time()
aes_encrypted = encryptor.update(message) + encryptor.finalize()
end_aes = time.time()
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
public_key = private_key.public_key()
start_rsa = time.time()
rsa_encrypted = public_key.encrypt(message[:190],
padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), label=None))
end_rsa = time.time()
print(f"AES Encryption Time: {end_aes - start_aes:.6f} seconds")
print(f"RSA Encryption Time: {end_rsa - start_rsa:.6f} seconds")
Sample Output:
AES Encryption Time: 0.000432 seconds
RSA Encryption Time: 0.002842 seconds

2. 2. Firewall Rule Setup:

Linux (iptables):
sudo iptables -A INPUT -p tcp --dport 22 -j DROP
Windows (PowerShell):
New-NetFirewallRule -DisplayName "Block HTTP" -Direction Inbound -Protocol TCP -LocalPort 80
-Action Block

3. 3. Capturing HTTPS Traffic in Wireshark:

Steps:
1. Open Wireshark.
2. Start capture on your network interface.
3. Visit https://example.com
4. Stop capture.
5. Use filter: tls
Look for TLS handshake steps like Client Hello, Server Hello, Certificate, Encrypted Handshake.

4. 4. VPN Setup Using OpenVPN or WireGuard:

WireGuard (Ubuntu):
sudo apt install wireguard -y
wg genkey | tee privatekey | wg pubkey > publickey
Config File - /etc/wireguard/wg0.conf:
[Interface]
PrivateKey = <private-key>
Address = 10.0.0.1/24
ListenPort = 51820

[Peer]
PublicKey = <peer-key>
AllowedIPs = 10.0.0.2/32

Start VPN:
sudo wg-quick up wg0
sudo wg

You might also like