cover photo

COURSEWORK

Mithun's CL-CY-001 course work. Lv 2

Mithun SrinivasAUTHORACTIVE
This Report is yet to be approved by a Coordinator.

Mithun'S Level-1 tasks report

27 / 10 / 2024


Level-1-CL-CY-Report

Report for level 1 tasks

Task 1: Linux Based Task with Socket.io

The goal was to learn about websockets and create a chat application using node js I learnt about websockets in general and how they are responsible for building effienct chat systems.I was also introduced to Node.js and Express.js and the differnt methods of creating a chat app. I also built a real time chat app ith HTML and express.js

What is Socket io?

Socket.IO is a JavaScript library that enables real-time, bidirectional communication between a web server and clients (browsers or mobile apps). It's built on top of WebSocket technology, providing a more robust and flexible way to handle real-time events compared to traditional HTTP polling. image

What is the problem with polling??

With HTTP polling, the client constantly sends requests to the server asking for updates. This can be inefficient, wasting bandwidth and server resources on unnecessary communication

  • As the number of clients increases, the server load can become overwhelming due to the constant polling requests So Socket io was introduced

Express.js over node.js

Express.js is better than plain Node.js for web development because it simplifies routing, request handling, and middleware management, improving code organization

CORS in WebSockets: A Brief Overview

380484168-5ba1c2f4-41a8-440b-a98c-c25d0e356bd6

380484291-040f57b3-4701-4343-9cfe-ba985d660e77

TASK 2:Git Bash and GitHub

I got familiar with basic git commands while using git bash.I learnt how to create repository and add files into them.I then learnt how to commit changes and initaie pull request to repository.I also learnt about branching and merging

Understanding Git and Git Bash

Git is a distributed version control system that tracks changes in files over time. It allows you to collaborate effectively with others on projects, manage different versions of your code, and revert to previous states if necessary. (It can related to a bank account statements where all the credit and debit changes made in the bank account are tracked in the passbook)

Git Bash is a command-line interface specifically designed for Git. It provides a convenient way to interact with Git repositories and execute Git commands.

Basic Git Commands

Some basic definitions using the command "git help"

Pasted image 20241025222229

  1. git help: Provides documentation for any Git command.
  2. mkdir: Creates a new directory.
  3. cd: Changes the current directory.
  4. ls: Lists files and directories.
  5. git config --global user.name "": Sets a global Git username.
  6. whoami: Shows the current user’s username.
  7. pwd: Displays the current directory path.
  8. ls -l: Lists files with detailed information.
  9. git add: Stages files for commit.
  10. git commit: Saves staged changes to the repository.
  11. Creating repository in Git Bash vs. GitHub:
  • Git Bash: Initializes a local repository.

  • GitHub: Hosts a remote repository for collaboration.

    A snippet of the gitbash terminal you can make changes in your change repository

    • Pasted image 20241025225134

TASK 3:OSI MODEL

I learnt about the OSI model and how it works.I made the detail flowchart of osi model using draw.io

What is OSI model?

The Open Systems Interconnection (OSI) model is a conceptual framework that divides the communication process between computers into seven layers. Each layer handles a specific aspect of the communication, from the physical transmission of bits to the application-level protocols.

Application Layer: Directs user interactions, supporting applications like web browsers and email.

Presentation Layer: Translates and formats data and handles encryption and compression.

Session Layer: Manages and controls connections between devices.

Transport Layer: Ensures reliable data transfer, managing segmentation, and flow control.

Network Layer: Determines data routing across networks using logical addressing (e.g., IP).

Data Link Layer: Manages node-to-node data transfer within a network using MAC addresses.

Physical Layer: Handles the physical transmission of raw data (bits) via cables, radio waves, etc.

380485123-0f215da3-5014-43d8-93f9-3755b32f2cfa

Simple example to learn OSI model:

A My device sends a frame across a physical network using Ethernet cables.

  • The frame passes through various network devices, including: *Switch *Router
  • The frame ultimately reaches the destination: uvcemarvel.com
  • The server at uvcemarvel.com de-encapsulates the frame to extract the application data.
  • The data includes a web request from a user (Mithun) who wants to view the homepage of uvcemarvel.com to apply project track
  • The web server processes Mithun's request.
  • The server encapsulates the information needed for the response into a new frame.
  • The response frame is sent back through the network: *Switch
    • Router
  • Finally, the response is received by Mithun.

TASK 4:Encryption Techniques

The objective of the task was to learn about basic encryption and decryption using python.I learnt about Types of encryption techniques that is symmetric and asymmetric. I studied about AES AND RSA techniques.

Symmetric Encryption

Symmetric encryption is a cryptographic method that uses the same key for both encryption and decryption. This key is shared between the sender and the recipient.

Key Pair:

In symmetric encryption, there's only one key, which is shared between the sender and the recipient.

AES (Advanced Encryption Standard)

It is a powerful encryption algorithm used to secure data by scrambling it in a way that only those with the correct key can decipher. Imagine it as a lock and key system for digital information Pasted image 20241016185351

Encryption Process: The AES algorithm processes the plaintext in multiple rounds (10 rounds for 128-bit keys). Each round consists of several operations:

SubBytes: Substitutes bytes using a predefined substitution table. ShiftRows: Shifts rows of the state array to the left. MixColumns: Mixes the data in each column. AddRoundKey: Combines the state with the round key derived from the original key

Asymmetric encryption:

Asymmetric encryption, also known as public-key cryptography, involves the use of two distinct but mathematically related keys: a public key and a private key.

Key pair

The public key is shared openly and can be distributed to anyone who wants to send secure messages.

The private key is kept secret by the owner and is used to decrypt messages encrypted with the corresponding public key.

RSA TECHNIQUES

RSA is a widely used asymmetric encryption algorithm. Here's a simplified breakdown of the process:

1. Key Generation:

  • Choose two large prime numbers: These numbers should be kept secret.
  • Calculate the modulus: Multiply the two prime numbers to get the modulus (n).
  • Calculate the totient: Calculate the totient (φ(n)) of the modulus.
  • Choose an encryption exponent (e): Choose a number (e) that is relatively prime to φ(n) and satisfies 1 < e < φ(n).
  • Calculate the decryption exponent (d): Calculate the decryption exponent (d) such that (e * d) mod φ(n) = 1.

WHY AES OVER RSA?:

AES is preferred over RSA for bulk data encryption due to its speed, efficiency, and ability to handle large datasets effectively. RSA is typically used for secure key exchange rather than for encrypting large amounts of data directly. In many secure systems, both AES and RSA are used together, with RSA handling key exchange and AES providing fast data encryption

380485187-1eaae292-ced2-42c0-98bf-db50df8674c3 380485214-083fbcbe-ce27-4dca-bd0a-5473432e87ef
380485218-80da4388-2f35-4247-85e4-611eb3044f75

TASK 5:IP Addressing and Protocols

I learnt how to webscrape from a job website using pyhton libraries such as beautifulsoup4 and pycrytodome where I could filter out the jobs according to my skills I studied about the Ip address and protocols . I learnt how to analyze them and also about the subnets and NAT and how router plays the role in assigning the Ip address.

What is IP address?

Every device connected to the internet has a unique address called an Internet Protocol (IP) address. This address helps computers communicate with each other. It's like a digital postal code.

IP address structure:  IP addresses are displayed as a set of four digits- the default address may be 192.158.1.38. Each number on the set may range from 0 to 255. Therefore, the total IP address range ranges from 0.0.0.0 to 255.255.255.255.

IP address is basically divided into two parts: X1. X2. X3. X4 1. [X1. X2. X3] is the Network ID 2. [X4] is the Host ID

YOUR ROUTER GIVES YOU THE IP ADDRESS

This is done through a protocol called Dynamic Host Configuration Protocol (DHCP), which automatically assigns a local IP address (usually in the form of 192.168.x.x or 10.x.x.x) to devices on the local network. When the device wants to access the network that is not in the same range (same street) that's where default gateway aka router comes into play.

Protocols

Think of protocols as the rules of the road for internet traffic. They define how data is formatted, transmitted, and received. Some common protocols include:

  • HTTP (Hypertext Transfer Protocol): Used for transferring web pages.
  • TCP (Transmission Control Protocol): Ensures reliable data delivery.
  • UDP (User Datagram Protocol): Faster but less reliable than TCP, used for applications like streaming.
  • DNS (Domain Name System): Converts human-readable domain names into IP addresses.

Webscraping:

Web scraping is the process of extracting data from websites. It's like a digital librarian, collecting information from various online sources. For example, you might use a web scraper to gather product prices from different e-commerce websites. Web scraping uses intelligence automation methods to get thousands or even millions of data sets in a smaller amount of time.

How does it work?

  1. Request: The scraper sends a request to the website, asking for the HTML code of a specific page.
  2. Parsing: The scraper analyzes the HTML code to identify the data it wants to extract. In the context of web scraping, parsing refers to the process of analyzing the HTML code of a web page to identify and extract the desired data.
  3. Extraction: The scraper extracts the desired data, such as product names, prices, or descriptions.

SCRAPING IP ADDRESSES

image

WEBSCRAPING A WEBSITE 380485650-d0f3e52f-1639-42ee-bc75-bda886977558

TASK 6: Kali linux and SSH

I got familiar with kali linux and Basic commands of Nmap.I learnt the importance of SSh and the types of penetration testing.I did scanning of of a target ip and found the open ports and their versions

KALI Linux commands

Sudo command

In Kali Linux (and other Linux distributions), the sudo (short for "superuser do") command allows a permitted user to execute a command as the superuser (root) or another user, as specified by the security policy. It is primarily used for administrative tasks that require higher privileges than a normal user account. Pasted image 20241023150909

Ping ping command is a network utility used to test the reachability of a host on an IP network. It is commonly used to check if a particular system (device, server, or host) is online and responding to network requests.

Pasted image 20241023162006

SN command

The -sn option is used to perform a ping scan (also known as a "no port scan"). When you use this option, Nmap disables the default port scanning phase and instead focuses on host discovery. It checks whether the hosts on the network are up (alive) without probing their open ports. Pasted image 20241023180758

SSH

SSH (Secure Shell) is a network protocol that securely connects to remote systems. It encrypts data, ensuring that sensitive

TASK 7: Databases

I learnt how mysql works and got a handle of the mysql workbench interface. I used thunderclient to connect from the vs code to the mysql workbench I did some basic operations like create and read operations I connected the pakaage with mysql db using createpool technique

{1F35CE53-CA66-44F1-B6AF-84941E7FB7CE}

{CC399016-8E33-4DD3-8765-37E82134E4DA}{F713CB20-1C86-487A-8D95-5EF3E6BB4E08}

UVCE,
K. R Circle,
Bengaluru 01