LEVEL 2 TASKS!!
2 / 10 / 2024
Task 1: Linux Based Task with Socket.io
Task Goal:
Set up a basic chat application using Node.js and Socket.io on a Linux system. The application should allow multiple users to connect and exchange messages in real-time.
Research Work: https://docs.google.com/document/d/1iYVusU-epqwA5ei-BqcRzSUyYir-c3DYeCX_Vjrqj_w/edit?usp=sharing
Task Work:
- Step 1: Setting up the softwares!!
If you don't have linux on your system, download it. I installed ubuntu. Next, I installed node.js and npm.
code:
sudo apt update
sudo apt install nodejs npm
Step 2: Coding the server block!!
A folder named *chat-app* is created and within it node.js project is initialized using the code 'npm init -y'. This will create a package.json file to manage your dependencies.
Now, *express* and *socket.io* is installed by the code *npm install express socket.io*
A file named *index.js* is created to handle the server-end operations using the language javascript.
Step 3: Coding the client-end block!!
A folder named public is created and within it a html file named index.html is created where the front-end operations is handled.
Step 4: Running the Application!!
Start the server using Node.js: 'node index.js'. The chat application should now be running on http://localhost:3000 . It looks something like this:
Step 5: Testing the Application!!
Check if the connection is established which would be notified in terminal.
Happy texting!!
Results:
Task 2: Understanding fundamentals of Gitbash and Github
Before jumping down into the key learnings of this task, let us understand the basic terminologies we need to know about this topic.
What is Git?
Well, git is a version control system which tracks the changes made on a code.
Personalized tracker of your code!!
What is GitHub?
GitHub is a library of your code. A library which stores all the details of your work as well as a platform that allows developers to share, and collaborate on code.
Then, what is Git Bash?
Git Bash is a command-line tool that allows you to use Git, a version control system, on Windows. It provides an environment similar to Linux, making it easier to run Git commands and other Unix-style commands that aren't natively available in Windows.
Task work:
In this task, firstly I created a repository in my local device using git command lines, which are cd (change directory) and mkdir (make a directory) and init(to initialise an empty git repository). Later, I wrote a code to display piece of information, a change which wasn't updated. Once the changes were done, I used git add, git commit (with a message) and git push to update my changes in the remote as well. Later, I accepted the pull request and ensured that all the changes were updated remote as well. Here are few glimpses:
Task 3: OSI MODEL
Task Goal:
Research and create a simple visual representation or diagram of the OSI model using a cloud-based diagramming tool.
Write a brief explanation of each layer of the OSI model and how it relates to cloud computing .
Research work: https://docs.google.com/document/d/1LY0RfFFFnt7Bfo5DpzXm-Z0f7LHXfp8dy-B97VEmIMs/edit?usp=sharing
OSI stands for Open System Intercommunication.
In detail explanation:
WHAT IS OSI MODEL?
The OSI model was created to standardize and simplify how devices communicate in a network. It provides a common framework for understanding and designing communication systems, ensuring that different technologies and products from various vendors can work together.
There are 7 layers of OSI model, which are:
- Application layer
- Presentation layer
- Session layer
- Transport layer
- Network layer
- Data Link layer
- Physical layer
Functions of each layer:
- Application layer: The top layer where end-user applications interact with the network. It provides network services directly to users and allows applications to communicate over the network.
- Presentation layer: This layer translates data between the application layer and the network. It handles data formatting, compression, and encryption, ensuring the application can understand the transmitted data.
- Session layer: This layer manages sessions or connections between applications. It establishes, maintains, and terminates communication sessions.
- Transport layer: This layer ensures reliable data transmission between devices. It breaks data into segments, manages flow control, and can provide error recovery.
- Network layer: The network layer is responsible for determining the best path for data to travel across multiple networks. It manages logical addressing through IP addresses and handles routing between different networks.
- Data Link layer: This layer ensures that data transferred over the physical layer is error-free. It manages how data is packaged into frames and provides addressing through MAC (Media Access Control) addresses
- Physical Layer: This layer is all about the physical connection between devices. It defines the hardware elements involved in the data transmission, such as cables, switches, and network interface cards (NICs).
Reference: https://youtu.be/vv4y_uOneC0?feature=shared
Result:
https://drive.google.com/file/d/17lCzxKdCcJlijykdzzuDMUbHdTEbtfAg/view?usp=sharing
Task 4: Encryption Techniques
Task Goal:
Implement a basic encryption and decryption program using Python with the PyCrypto library.
Research Work: https://docs.google.com/document/d/1BX8PeZXur9GYPRvwGi99-Cr9NSB-StDDkjjK5-jcXrk/edit?usp=sharing
What is encryption?
Encryption is a process that converts plain text (readable data) into a coded format (cipher text) so that only authorized users can read it.
How It Works:
Plain Text: This is the original readable data (like a message or a file).
Encryption: A special algorithm (or method) scrambles the plain text into an unreadable format using a key (a secret password or code).
Cipher Text: This is the scrambled version of the plain text. It looks like random data and is unreadable without the key.
Decryption: To read the original data again, the recipient uses the same key to turn the cipher text back into plain text.
Glimpse of code work:
Task 5: IP Addressing and Protocols
Task Goal:
Use Python and libraries like Beautiful Soup to scrape IP address data from a website and analyse it. This task will reinforce understanding of IP addressing and protocols such as TCP/IP.
Research Work: https://docs.google.com/document/d/1GPh1EVcsS0RqIdoEwKGoBjowjqq4Rz1XbrJsmcY-lH0/edit?usp=sharing
Task Work:
Step 1:
Firstly, python should be downloaded if it isn't installed yet. Then, in order to successively accomplish this task, the required libraries: request, Beautiful Soup
and re(built-in) must be installed.
Step 2:
Now, proceed by writing a code in the text editor to scrape an IP address from a website. I scrapped from the website https://hide.me/en/proxy (freeproxylist).
Step 3:
Now, test your code. You will be able to see the html fragments and IP addresses.
Results:
Step 4:
Lastly, analyse the IP addresses you received i.e. to sort out public and private ips and you are done with the job!!!
Results after analysis:
Task 7: Databases
Task Goal:
Set up a MySQL database and create a simple CRUD (Create, Read, Update, Delete) application using Node.js. This task will familiarize students with database management and querying.
Research Work: https://docs.google.com/document/d/1SKQiqZLDB_C8oqrM4-IdnEFg-KgWMR9NhzFJXEq2WxA/edit?usp=sharing
TASK WORK:
Step 1: Setting up the required software.
Ensure MySQL is installed and start the MySQL server to perform the task.
Step 2: CRUD Application
- In a node.js environment, create a folder named my my_app. Initialize a node.js project creating a package.json file with default settings.
- npm install express mysql body-parser cors --> Installs several packages (like Express for web applications and MySQL for database handling) necessary for my project.
- Create an js file and set-up express server.
- Parallely, create a database using the code CREATE DATABASE my_app;
- Interact with the database using the code USE my_app;
- Create/Write the body of the database i.e. the data elements of the database. Here, I created a database consisting of data elements like: id, name, email id and time stamp of registeration.
Step 3: Run the server!!
Test the CRUD Operations -->
-
Create User: POST http://localhost:3000/users with JSON body {"name": "John Doe", "email": "john@example.com"}
-
Read Users: GET http://localhost:3000/users
-
Update User: PUT http://localhost:3000/users/1 with JSON body {"name": "Jane Doe", "email": "jane@example.com"}
-
Delete User: DELETE http://localhost:3000/users/1
Interacting with MySQL from Node.js:
Use the code mysql -u root -p to connect to MySQL.
TASK RESULTS: