Compare commits

...

4 Commits

Author SHA1 Message Date
76ff4db369
Added code and output for B5. 2024-10-09 20:16:59 +05:30
d024c4a714
Added write-ups
(B5, C10, C11)
2024-10-09 20:16:59 +05:30
6144a7ba5b
Added code+output for C11. 2024-10-09 20:16:59 +05:30
4461978f4e
Added code+output for A2 and added link in README. (Thanks to Bhakti for
hybrid topology design in output 🙇)
(She made me add those credits)
2024-10-09 20:16:10 +05:30
8 changed files with 45 additions and 0 deletions

35
Codes/Code-B5.cpp Normal file
View File

@ -0,0 +1,35 @@
#include <iostream>
using namespace std;
void printSubnetMask(int prefixLength) {
int mask[4] = {0, 0, 0, 0};
for (int i = 0; i < prefixLength; ++i) {
mask[i / 8] |= (1 << (7 - (i % 8)));
}
cout << "Subnet Mask for /" << prefixLength << ": ";
cout << mask[0] << "." << mask[1] << "." << mask[2] << "." << mask[3] << std::endl;
}
int main() {
int prefixLength;
cout << "Enter the prefix length: ";
cin >> prefixLength;
if (prefixLength >= 0 && prefixLength <= 32) {
printSubnetMask(prefixLength);
}
else {
cout << "Invalid prefix length!" << std::endl;
}
return 0;
}
/*
OUTPUT:
Enter the prefix length: 22
Subnet Mask for /22: 255.255.252.0
Enter the prefix length: 0
Subnet Mask for /0: 0.0.0.0
Enter the prefix length: 32
Subnet Mask for /32: 255.255.255.255
*/

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -27,6 +27,10 @@ This Git repository is a comprehensive resource for the Computer Networks and Se
##### A2 - Network types, topologies and transmission media
- [Handout-A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-A2.pdf)
- [Write-up - A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20A2.pdf)
- [Output-A2](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-A2.pdf)
> [!NOTE]
> No code for assignment A2.
##### A3 - Error detection and correction using Hamming code and CRC
- [Code-A3 (CRC)](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-A3%20%28CRC%29.cpp)
@ -42,7 +46,10 @@ This Git repository is a comprehensive resource for the Computer Networks and Se
- [Output-A4](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-A4.pdf)
##### B5 - Subnetting and subnet mask
- [Code-B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-B5.cpp)
- [Handout-B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-B5.pdf)
- [Write-up - B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20B5.pdf)
- [Output-B5](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-B5.pdf)
##### B6 - Link state & distance vector
- [Code-B6](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-B6.py)
@ -71,11 +78,14 @@ This Git repository is a comprehensive resource for the Computer Networks and Se
##### C10 - DNS
- [Code-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-C10.py)
- [Handout-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C10.pdf)
- [Write-up - C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20C10.pdf)
- [Output-C10](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-C10.pdf)
##### C11 - DHCP
- [Code-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Codes/Code-C11.py)
- [Handout-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C11.pdf)
- [Write-up - C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Write-ups/Write-up%20-%20C11.pdf)
- [Output-C11](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Printable%20outputs/Output-C11.pdf)
##### C12 - TCP & HTTP traffic capture using Wireshark
- [Handout-C12](https://git.kska.io/sppu-te-comp-content/ComputerNetworksAndSecurity/src/branch/main/Handouts/Handout-C12.pdf)

BIN
Write-ups/Write-up - B5.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.