Professional Documents
Culture Documents
LAB
WORKBOOK
20CS2222 COMPUTER NETWORKS & SECURITY
Team CNS
K L UNIVERSITY | COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
1
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
LAB WORKBOOK
STUDENT NAME
REG. NO
YEAR
SEMESTER
SECTION
FACULTY
2
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
CONTENTS
4
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
5
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
a. Pre-Lab
The Prelab exercise is a homework assignment that links the lecture with the
laboratory period - typically takes 2 hours to complete. The goal is to
synthesize the information they learn in lecture with material from their
textbook to produce a working piece of software. Prelab Students attending a
two-hour closed laboratory are expected to make a good-faith effort to
complete the Prelab exercise before coming to the lab. Their work need not
be perfect, but their effort must be real (roughly 80 percent correct).
b. In-Lab
The In-lab section takes place during the actual laboratory period. The First hour
of the laboratory period can be used to resolve any problems the students might
have experienced in completing the Prelab exercises. The intent is to give
constructive feedback so that students leave the lab with working Prelab software
- a significant accomplishment on their part. During the second hour, students
complete the In-lab exercise to reinforce the concepts learned in the Prelab.
Students leave the lab having received feedback on their Prelab and In-lab work.
c. Post-Lab
The last phase of each laboratory is a homework assignment that is done
following thelaboratory period. In the Post-lab, students analyze the efficiency or
utility of a given system call. Each Post-lab exercise should take roughly 120
minutes to complete.
6
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In-Lab
Pre Post Viva Total
Experiment Faculty
Sno Date Lab Lab Voce (50M)
Name Signature
(5M) LOGIC EXECUTION RESULT ANALYSIS (5M) (5 M)
(10M) (10M) (10M) (5M)
1.
2.
3.
4.
5.
6.
7
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
7.
8 (a).
8(b).
9.
10.
Total
8
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Lab 1: Write a python program to implement the character count and stuffing character
using framing method.
Date of the Session: / / Session Time: to
Learning outcome:
• Understanding of framing concept
• Understanding of character count and stuffing character
Pre-Lab Task:
9
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
10
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex is a developer in foster technology has just started learning about various framing concepts
and interested in learning character count and character stuffing. Rex a newbie
In this area, you are requested by Rex to help him to implement the character count and character
stuffing.
Writing space for the Problem: (For Student’s use only)
11
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
12
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
2. What are the advantages and disadvantages of character count and Stuffing
character?
13
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Lab 2: Write a python program to implement the bit stuffing concept using framing
methods.
Date of the Session: / / Session Time: to
Learning outcome:
• Understanding of Bit Stuffing concept
• Understanding of Byte stuffing concept
Pre-Lab Task:
14
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
15
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex has understood the character count and character stuffing concepts in Framing methods. At
present Rex is interested to implement bit stuffing concept. Now help Rex to implement Bit
stuffing concept using python Language.
Writing space for the Problem: (For Student’s use only)
16
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
17
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
18
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
19
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
20
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Lab 3: Write a python program to implement the Cyclic Redundancy Check (CRC) Method.
Date of the Session: / / Session Time: to
Learning outcome:
• Understanding the Concept of Error Detection Code.
• Understanding the Concept of CRC.
Pre-Lab Task:
(i) What do you mean by redundancy?
21
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
22
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex is so confused with the framing concepts, he is not understanding how to implement CRC, he
was puzzled with the Error Detection Code, now assist Rex to understand how to implement the
CRC Technique in Error Detection Code.
Writing space for the Problem:(For Student’s use only)
Sender Side
23
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
24
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
25
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
26
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
27
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Learning outcome:
Pre-Lab Task:
(i) What is Hamming Code?
28
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
29
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
30
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex is so confused with the framing concepts, he is not understanding how to implement Hamming
Code, he was puzzled with the Error Correction Code, now assist Rex to understand how to
implement the Hamming Code in Error Correction Code.
Writing space for the Problem: (For Student’s use only)
31
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
32
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
33
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Learning Outcome:
• Understanding the Longitudinal Redundancy Check (LRC)
• Understanding the Error Detection Code
Pre-Lab Task:
(i) What is meant 2-D Parity Check?
34
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
35
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex didn’t understand the Error Detection Codes particularly in LRC Technique. He wants to Gain
Knowledge on different error detection codes, so help Rex to implement 2-D Parity Check.
Writing space for the Problem: (For Student’s use only)
36
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
37
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
38
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Learning outcome:
• Understanding the shortest path Algorithm concepts
• Understanding the Packet Routing concept
Pre-Lab Task:
(i) Define routing?
39
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
40
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex perplexed with different types of routing Algorithms in network. He wants to understand
shortest path algorithm in routing algorithms, so assist Rex to implement shortest path Algorithm.
Writing space for the Problem:(For Student’s use only)
41
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
42
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
43
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Learning outcome:
• Remembering the different types Routing
• Understanding the Distance Vector Routing
Pre-Lab Task:
(i) What is Distance Vector Routing?
44
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
45
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex puzzled with different types of routing Algorithms in network. He wants to understand
Distance Vector Routing algorithm in routing algorithms, so assist Rex to implement DVR.
Writing space for the Problem:(For Student’s use only)
46
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
47
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
48
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Lab 8 (a): Write a Python Program to implement the Caesar cipher technique
Date of the Session: / / Session Time: to
Learning outcome:
• To understand Symmetric Crypto System.
• To understand the concept of Encryption and Decryption.
• To implement the concept of Onetime pad.
Pre-Lab Task:
(i) What is the need for encryption?
49
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
50
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Rex sent a message “hey” to Kevin through an insecure channel (it could be a wireless channel or
internet or courier or any channel that we cannot trust). Here, Robert is an eavesdropper. He always
tries to corrupt the message sent by Rex. To avoid this let’s encrypt the message sent by Rex using
a key ‘K’ which can be shared with the receiver, so that Robert cannot access the actual message.
He can only access the cipher text (encrypted message). Once the message is received by Kevin, he
must perform a decryption process using shared key to read the actual message sent by Rex.
Sample input :
Enter the msg: Sampleinput enter key :764
Sample output :
The encrypted msg is zgqwripttbz
The decrypted msg is : sampleinput
Writing space for the Problem:(For Student’s use only)
51
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
52
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
53
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
54
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Lab 8 (b): Write a Python Program to implement the Playfair cipher technique
Date of the Session: / / Session Time: to
Learning outcome:
• To understand how to construct a 5*5 matrix using the key in Playfair cipher.
• To understand how to construct a digraph in Playfair cipher.
• To learn how to encrypt and decrypt a message using a key in Playfair cipher.
Pre-Lab Task:
(i) What is Playfair cipher?
55
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
(v) Trace what will the encrypted message be using Playfair cipher if the message is
‘balloon’ and the key is ‘monarchy’.
Step1
56
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Bryce Walker saves the tapes and polaroids of Hannah Baker and Jessica Davis in a box. He
locked the box by encrypting the plain text “thirteenreaonswhy” using the key “tapes”. The
encryption technique used by him is Playfair cipher. To identify the cipher write a program.
57
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
58
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
59
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
60
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Learning outcome:
• To understand the concept of transposition ciphers
• To understand and implement the rail fence cipher.
Pre-Lab Task:
(i) What is transposition cipher?
61
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
62
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
The major of Indian army wants to store data about Naval submarine, S21in an encrypted manner
to safeguard it from the Pakistan army. He stores the data in various locations in the form of small
chunks.The Major used railfence cipher with three rails to encrypt the data.Pakistan army may find
about the data and may try to decrypt it. Help Indian army to encrypt the data and find how might
have the pakistan army decrypted it.
Input:- S21atlocation56
Output: Stan2alcto51oi6
Writing space for the Problem:(For Student’s use only)
63
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
64
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
65
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
66
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
67
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
Learning outcome:
• To understand the concept of Asymmetric encryption.
• To understand and implement the concept of RSA Algorithm.
Pre-Lab Task:
68
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
69
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
In Lab Task:
Crypto Bank has exciting offers for new customers at their bank with state-of-the-art security
features such as RSA algorithm encryption. Dave wants to deposit his bitcoin savings into
their bank and avail the offers. He contacts the bank and gets their Public Key. He then
proceeds to encrypt the currency data using the bank’s public key and sends the encrypted
data to the bank representatives. The bank acknowledges the receipt of delivery and proceeds
to decrypt the data using their Private key. The bank thus safely acquires the Bitcoin currency
and stores it in their vault. Implement this scenario.
Sample Input:
3 //value of p
7 //value of q
5 //value of e
2 //value of k
20 //value of msg
Sample Output:
Message data = 20.000000
Encrypted data = 20.000000
Original Message sent = 20.000000
Writing space for the Problem:(For Student’s use only)
70
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
71
COMPUTER NETWORKS AND SECURITY – 20CS2222AA/20CS2222PA
72